This is an archive of the discontinued LLVM Phabricator instance.

Address flakyness in TestAttachResume
ClosedPublic

Authored by labath on Sep 1 2015, 6:13 AM.

Details

Summary

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).

Diff Detail

Event Timeline

labath updated this revision to Diff 33684.Sep 1 2015, 6:13 AM
labath retitled this revision from to Address flakyness in TestAttachResume.
labath updated this object.
labath added reviewers: zturner, clayborg.
labath added a subscriber: lldb-commits.
labath updated this revision to Diff 33689.Sep 1 2015, 7:21 AM

I've found another source or racyness in the test. The test verified that the process resumes and
stops after a "continue". However, if these two events happened two fast, the initial start event
would be lost, and the test would end up confused. I have implemented this in a safer manner and
made a utility function out of it, as I know of a couple of other tests which need the same
functionality.

clayborg accepted this revision.Sep 1 2015, 11:29 AM
clayborg edited edge metadata.
This revision is now accepted and ready to land.Sep 1 2015, 11:29 AM
This revision was automatically updated to reflect the committed changes.