llvm-project/lldb
Pavel Labath df55f522bd Fix race during process interruption
Summary:
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.

Reviewers: clayborg, jingham

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D14989

llvm-svn: 254403
2015-12-01 11:28:47 +00:00
..
cmake Use thumb instruction set for ldb-server on android arm 2015-11-20 10:51:39 +00:00
docs Have debugserver send the OS version string plus 2015-08-12 03:27:33 +00:00
examples Python 3 - modernize exception catching syntax. 2015-11-03 19:49:05 +00:00
include Fix race during process interruption 2015-12-01 11:28:47 +00:00
lib Add more autotools/gmake NetBSD glue 2015-11-15 02:00:09 +00:00
lit Create a check-lldb-unit target to run unit tests. 2015-03-13 20:55:07 +00:00
lldb.xcodeproj Fix Xcode project after recent Windows core file changes. 2015-11-20 23:53:53 +00:00
lldb.xcworkspace Working on getting the OSX build green 2015-05-12 02:20:27 +00:00
packages/Python/lldbsuite Fix race during process interruption 2015-12-01 11:28:47 +00:00
resources Only export public symbols with the cmake build. 2015-09-04 00:00:41 +00:00
scripts Unpack the output on the client, completing the cycle. 2015-11-30 22:31:24 +00:00
source Fix race during process interruption 2015-12-01 11:28:47 +00:00
test Remove `lldb.root` and just look for the file we care about. 2015-11-20 17:40:57 +00:00
third_party/Python/module Python 3 - Fix some issues with class / instance variables in unittest2. 2015-11-06 21:37:07 +00:00
tools Add more autotools/gmake NetBSD glue 2015-11-15 02:00:09 +00:00
unittests Fix a bug in PythonExceptionState and add unittest coverage. 2015-11-13 01:50:19 +00:00
utils Python 3: Modernize exception raising syntax. 2015-11-03 21:01:45 +00:00
www Add a sketched out section on adding Language and LanguageRuntime plugins for language support 2015-11-02 22:26:55 +00:00
.arcconfig Update .arcconfig to point to reviews.llvm.org 2014-05-20 21:24:59 +00:00
.clang-format Create an expression parser for Go. 2015-11-02 19:30:40 +00:00
.gitignore Update .gitignore to exclude pyproj folder (used for Python IDE) 2015-11-13 01:24:58 +00:00
CMakeLists.txt Fix CMake dependency on lldb.py 2015-11-18 21:09:55 +00:00
CODE_OWNERS.txt Added myself to the CODE_OWNERS.txt list for a few subsystems. 2015-11-09 01:24:36 +00:00
INSTALL.txt Revert the patch to Test Commit Access 2015-07-06 11:26:51 +00:00
LICENSE.TXT
Makefile Allow to override python-config executable name from command line 2015-11-15 01:56:21 +00:00
use_lldb_suite_root.py Preparation for turning lldbsuite into a Python package. 2015-10-27 22:33:47 +00:00