[Lldb-commits] [PATCH] D12527: Address flakyness in TestAttachResume
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Tue Sep 1 06:13:43 PDT 2015
labath created this revision.
labath added reviewers: zturner, clayborg.
labath added a subscriber: lldb-commits.
The test (among other things) attempts to verify that detaching works while the inferior is
running. However, this was racy since the inferior could end up stopping again before we got a
chance to detach from it (the test could be made to fail reliably by inserting a sleep just after
the last "continue" command). The reason for the stop was that we had a breakpoint set in a place
that can be hit by multiple threads, and we stop because another thread hit a breakpoint.
I fix this by moving the breakpoint to a place that is reachable from only one thread. I also
make sure that the same thread cannot hit the breakpoint if we are exceptionaly slow by flipping
a flag which makes the breakpoint unreachable (I cannot just disable or delete the breakpoint as
the test makes it a point to try detaching while breakpoints are still set).
@@ -8,15 +8,17 @@
+volatile bool debugger_flag = true; // The debugger will flip this to false
void *start(void *data)
size_t idx = (size_t)data;
for (i=0; i<30; i++)
- if ( idx == 0 )
- std::this_thread::sleep_for(std::chrono::seconds(1)); // Set breakpoint here
+ if ( idx == 0 && debugger_flag)
+ std::this_thread::sleep_for(std::chrono::microseconds(1)); // Set breakpoint here
@@ -14,16 +14,14 @@
mydir = TestBase.compute_mydir(__file__)
- @expectedFlakeyLinux('llvm.org/pr19478') # intermittent ~2/14 runs
@@ -81,12 +79,11 @@
'Process not stopped after breakpoint')
- # This test runs a bunch of threads in the same little function with this
- # breakpoint. We want to make sure the breakpoint got hit at least once,
- # but more than one thread may hit it at a time. So we really only care
- # that is isn't 0 times, not how many times it is.
self.expect('br list', 'Breakpoint not hit',
- patterns = ['hit count = [1-9]'])
+ substrs = ['hit count = 1'])
+ # Make sure the breakpoint is not hit again.
+ self.expect("expr debugger_flag = false", substrs=[" = false"]);
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 2507 bytes
Desc: not available
More information about the lldb-commits