diff options
| author | Jim Ingham <jingham@apple.com> | 2013-03-29 01:18:12 +0000 |
|---|---|---|
| committer | Jim Ingham <jingham@apple.com> | 2013-03-29 01:18:12 +0000 |
| commit | 8af3b9ca673178f2c67846b606fcfe62a44b4e2b (patch) | |
| tree | 9ba1603e81e14b24175baf21a287e09c11e2fdd8 /lldb/source/Plugins/Process | |
| parent | dcb1d856d77c0267a4008aae2f6d47d1df0512d8 (diff) | |
| download | bcm5719-llvm-8af3b9ca673178f2c67846b606fcfe62a44b4e2b.tar.gz bcm5719-llvm-8af3b9ca673178f2c67846b606fcfe62a44b4e2b.zip | |
Rationalize how we do Halt-ing before Destroy and Detach.
<rdar://problem/13527167>
llvm-svn: 178325
Diffstat (limited to 'lldb/source/Plugins/Process')
| -rw-r--r-- | lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp | 93 | ||||
| -rw-r--r-- | lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h | 11 |
2 files changed, 3 insertions, 101 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp index 05c39f97fb5..00861951116 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -1671,99 +1671,6 @@ ProcessGDBRemote::DoHalt (bool &caused_stop) } Error -ProcessGDBRemote::InterruptIfRunning -( - bool discard_thread_plans, - bool catch_stop_event, - EventSP &stop_event_sp -) -{ - Error error; - - Log *log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS)); - - bool paused_private_state_thread = false; - const bool is_running = m_gdb_comm.IsRunning(); - if (log) - log->Printf ("ProcessGDBRemote::InterruptIfRunning(discard_thread_plans=%i, catch_stop_event=%i) is_running=%i", - discard_thread_plans, - catch_stop_event, - is_running); - - if (discard_thread_plans) - { - if (log) - log->Printf ("ProcessGDBRemote::InterruptIfRunning() discarding all thread plans"); - m_thread_list.DiscardThreadPlans(); - } - if (is_running) - { - if (catch_stop_event) - { - if (log) - log->Printf ("ProcessGDBRemote::InterruptIfRunning() pausing private state thread"); - PausePrivateStateThread(); - paused_private_state_thread = true; - } - - bool timed_out = false; - Mutex::Locker locker; - - if (!m_gdb_comm.SendInterrupt (locker, 1, timed_out)) - { - if (timed_out) - error.SetErrorString("timed out sending interrupt packet"); - else - error.SetErrorString("unknown error sending interrupt packet"); - if (paused_private_state_thread) - ResumePrivateStateThread(); - return error; - } - - if (catch_stop_event) - { - // LISTEN HERE - TimeValue timeout_time; - timeout_time = TimeValue::Now(); - timeout_time.OffsetWithSeconds(5); - StateType state = WaitForStateChangedEventsPrivate (&timeout_time, stop_event_sp); - - timed_out = state == eStateInvalid; - if (log) - log->Printf ("ProcessGDBRemote::InterruptIfRunning() catch stop event: state = %s, timed-out=%i", StateAsCString(state), timed_out); - - if (timed_out) - error.SetErrorString("unable to verify target stopped"); - } - - if (paused_private_state_thread) - { - if (log) - log->Printf ("ProcessGDBRemote::InterruptIfRunning() resuming private state thread"); - ResumePrivateStateThread(); - } - } - return error; -} - -Error -ProcessGDBRemote::WillDetach () -{ - Log *log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS)); - if (log) - log->Printf ("ProcessGDBRemote::WillDetach()"); - - bool discard_thread_plans = true; - bool catch_stop_event = true; - EventSP event_sp; - - // FIXME: InterruptIfRunning should be done in the Process base class, or better still make Halt do what is - // needed. This shouldn't be a feature of a particular plugin. - - return InterruptIfRunning (discard_thread_plans, catch_stop_event, event_sp); -} - -Error ProcessGDBRemote::DoDetach() { Error error; diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h index 957a84f2909..dc4ec561b03 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h @@ -141,10 +141,10 @@ public: DoHalt (bool &caused_stop); virtual lldb_private::Error - WillDetach (); - - virtual lldb_private::Error DoDetach (); + + virtual bool + DetachRequiresHalt() { return true; } virtual lldb_private::Error DoSignal (int signal); @@ -383,11 +383,6 @@ protected: const char *bytes, size_t bytes_len); - lldb_private::Error - InterruptIfRunning (bool discard_thread_plans, - bool catch_stop_event, - lldb::EventSP &stop_event_sp); - lldb_private::DynamicLoader * GetDynamicLoader (); |

