summaryrefslogtreecommitdiffstats
path: root/lldb/tools/debugserver/source
diff options
context:
space:
mode:
authorJim Ingham <jingham@apple.com>2012-04-25 17:45:26 +0000
committerJim Ingham <jingham@apple.com>2012-04-25 17:45:26 +0000
commit5d2735e502d9123a1213ae64f9c559bc016838e3 (patch)
treefb1098a577aaad4f0c456a470e644238a6c17474 /lldb/tools/debugserver/source
parent7ce39cdb9fdcc0c293c0143b803c3767ee6699ec (diff)
downloadbcm5719-llvm-5d2735e502d9123a1213ae64f9c559bc016838e3.tar.gz
bcm5719-llvm-5d2735e502d9123a1213ae64f9c559bc016838e3.zip
Suspend program threads before sending the SIGSTOP & resuming, so other threads won't get into trouble while we are waiting for the SIGSTOP.
rdar://problem/11174834 llvm-svn: 155560
Diffstat (limited to 'lldb/tools/debugserver/source')
-rw-r--r--lldb/tools/debugserver/source/MacOSX/MachProcess.cpp12
-rw-r--r--lldb/tools/debugserver/source/MacOSX/MachProcess.h2
2 files changed, 9 insertions, 5 deletions
diff --git a/lldb/tools/debugserver/source/MacOSX/MachProcess.cpp b/lldb/tools/debugserver/source/MacOSX/MachProcess.cpp
index f2daa5283f0..83cbe2c6bbf 100644
--- a/lldb/tools/debugserver/source/MacOSX/MachProcess.cpp
+++ b/lldb/tools/debugserver/source/MacOSX/MachProcess.cpp
@@ -335,7 +335,7 @@ bool
MachProcess::Kill (const struct timespec *timeout_abstime)
{
DNBLogThreadedIf(LOG_PROCESS, "MachProcess::Kill ()");
- nub_state_t state = DoSIGSTOP(true);
+ nub_state_t state = DoSIGSTOP(true, false, NULL);
DNBLogThreadedIf(LOG_PROCESS, "MachProcess::Kill() DoSIGSTOP() state = %s", DNBStateAsString(state));
errno = 0;
::ptrace (PT_KILL, m_pid, 0, 0);
@@ -373,7 +373,7 @@ MachProcess::Signal (int signal, const struct timespec *timeout_abstime)
}
nub_state_t
-MachProcess::DoSIGSTOP (bool clear_bps_and_wps, uint32_t *thread_idx_ptr)
+MachProcess::DoSIGSTOP (bool clear_bps_and_wps, bool allow_running, uint32_t *thread_idx_ptr)
{
nub_state_t state = GetState();
DNBLogThreadedIf(LOG_PROCESS, "MachProcess::DoSIGSTOP() state = %s", DNBStateAsString (state));
@@ -398,7 +398,11 @@ MachProcess::DoSIGSTOP (bool clear_bps_and_wps, uint32_t *thread_idx_ptr)
// No threads were stopped with a SIGSTOP, we need to run and halt the
// process with a signal
DNBLogThreadedIf(LOG_PROCESS, "MachProcess::DoSIGSTOP() state = %s -- resuming process", DNBStateAsString (state));
- m_thread_actions = DNBThreadResumeActions (eStateRunning, 0);
+ if (allow_running)
+ m_thread_actions = DNBThreadResumeActions (eStateRunning, 0);
+ else
+ m_thread_actions = DNBThreadResumeActions (eStateSuspended, 0);
+
PrivateResume ();
// Reset the event that says we were indeed running
@@ -432,7 +436,7 @@ MachProcess::Detach()
DNBLogThreadedIf(LOG_PROCESS, "MachProcess::Detach()");
uint32_t thread_idx = UINT32_MAX;
- nub_state_t state = DoSIGSTOP(true, &thread_idx);
+ nub_state_t state = DoSIGSTOP(true, true, &thread_idx);
DNBLogThreadedIf(LOG_PROCESS, "MachProcess::Detach() DoSIGSTOP() returned %s", DNBStateAsString(state));
{
diff --git a/lldb/tools/debugserver/source/MacOSX/MachProcess.h b/lldb/tools/debugserver/source/MacOSX/MachProcess.h
index af9fb698bfb..6d99edc4772 100644
--- a/lldb/tools/debugserver/source/MacOSX/MachProcess.h
+++ b/lldb/tools/debugserver/source/MacOSX/MachProcess.h
@@ -248,7 +248,7 @@ private:
nub_size_t RemoveTrapsFromBuffer (nub_addr_t addr, nub_size_t size, uint8_t *buf) const;
uint32_t Flags () const { return m_flags; }
- nub_state_t DoSIGSTOP (bool clear_bps_and_wps, uint32_t *thread_idx_ptr = NULL);
+ nub_state_t DoSIGSTOP (bool clear_bps_and_wps, bool allow_running, uint32_t *thread_idx_ptr);
pid_t m_pid; // Process ID of child process
cpu_type_t m_cpu_type; // The CPU type of this process
OpenPOWER on IntegriCloud