[Lldb-commits] [PATCH] D13056: Fix race condition during process detach

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Tue Sep 22 06:48:07 PDT 2015

labath created this revision.
labath added reviewers: jingham, clayborg.
labath added a subscriber: lldb-commits.

The following situation occured in TestAttachResume:

The inferior was stoped at a breakpoint and we did a continue, immediately followed by a detach.
Since there was a trap instruction under the IP, the continue did a step-over-breakpoint before
resuming the inferior for real. In some cases, the detach command was executed between these two
events (after the step-over stop, but before continue). Here, public state was running, but
private state was stopped. This caused a problem because HaltForDestroyOrDetach was checking the
public state to see whether it needs to stop the process (call Halt()), but Halt() was checking
the private state and concluded that there is nothing for it to do.

Solution: Instead of Halt() call SendAsyncInterrupt(), which will then cause Halt() to be
executed in the context of the private state thread. I also rename HaltForDestroyOrDetach to
reflect it does not call halt directly.



-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13056.35371.patch
Type: text/x-patch
Size: 6280 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150922/9284448f/attachment.bin>

More information about the lldb-commits mailing list