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);
}
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));
// 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
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));
{
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