Go to file
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
clang [OPENMP 4.5] Parsing/sema analysis for 'priority' clause. 2015-12-01 10:17:31 +00:00
clang-tools-extra [clang-tidy] google-explicit-constructor: improve the warning message 2015-11-28 02:25:02 +00:00
compiler-rt [asan] Correctly release memory allocated during early startup. 2015-12-01 09:22:41 +00:00
debuginfo-tests
libclc integer: remove explicit casts from _MIN definitions 2015-10-06 19:12:12 +00:00
libcxx Last bit of P0006; mark it as complete 2015-11-30 05:39:30 +00:00
libcxxabi c++abi: use __builtin_offsetof instead of offsetof 2015-11-18 05:33:38 +00:00
libunwind Make it possible to use libunwind without heap. 2015-11-09 06:57:29 +00:00
lld [ELF] Rearrange relocation codes in natural order. NFC. 2015-12-01 08:41:20 +00:00
lldb Fix race during process interruption 2015-12-01 11:28:47 +00:00
llgo [llgo] Force exporting __morestack from llgoi 2015-11-27 04:46:46 +00:00
llvm Allow known and unknown probabilities coexist in MBB's successor list. 2015-12-01 11:05:39 +00:00
openmp Fix honoring of OMP_THREAD_LIMIT in the teams construct 2015-11-30 20:14:05 +00:00
polly Remove non-debug printing of domain set 2015-11-30 22:59:41 +00:00