[Lldb-commits] [PATCH] D14989: Fix race during process interruption
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Wed Nov 25 08:01:28 PST 2015
labath created this revision.
labath added reviewers: clayborg, jingham.
labath added a subscriber: lldb-commits.
The following situation was occuring in TestAttachResume:
- we did a "continue" from a breakpoint (which involves a private start-stop to step over the
breakpoint)
- after receiving the stop-reply from the step-over, we issue a "detach" (which requires a
process interrupt)
- at this moment, the public state is "running", private state is "about-to-be-stopped" (the
stopped event was broadcast, but it was not received yet)
- StopForDestroyOrDetach (public thread) notes the public state is running, sends an interrupt
request to the private thread
- private thread gets the eBroadcastBitInterrupt (before the eStateStopped message), and asks the
process plugin to stop (via Halt())
- process plugin says it has nothing to do as the process is already stopped
- private thread shrugs and carries on. receives the stop event, restores the breakpoint and
resumes the process.
- after a while, the public thread times out and says it failed to stop the process
This patch does the following:
- splits Halt() into two functions, private and public, their usage depends on the context
- public Halt(): sends eBroadcastBitInterrupt to the private thread and waits for the Stop
event
- HaltPrivate(): asks the plugin to stop and makes a note that the halt was requested. When the
next stop event comes it sets the interrupt flag on it.
- removes HijackPrivateProcessEvents(), as the only user (old Halt()) has gone away
- removes the m_currently_handling_event hack, as the new Halt() does not need it
- adds a use_run_lock parameter to public Halt() and WaitForProcessToStop(). This was needed
because RunThreadPlan uses Halt() while holding the run lock and we don't want Halt() to take
it away from him.
http://reviews.llvm.org/D14989
Files:
include/lldb/Target/Process.h
packages/Python/lldbsuite/test/expression_command/timeout/TestCallWithTimeout.py
packages/Python/lldbsuite/test/functionalities/attach_resume/TestAttachResume.py
source/Target/Process.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14989.41147.patch
Type: text/x-patch
Size: 19243 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20151125/94ca0f7c/attachment-0001.bin>
More information about the lldb-commits
mailing list