summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Ingham <jingham@apple.com>2012-05-23 15:46:31 +0000
committerJim Ingham <jingham@apple.com>2012-05-23 15:46:31 +0000
commit04e0a2270ab079c98c4bde9a5c023de64443e758 (patch)
treec04305a66cf068e0b08c09490e1cb7996d636681
parent8152e22073821cf0a69367a99ffa5871dc2fdf78 (diff)
downloadbcm5719-llvm-04e0a2270ab079c98c4bde9a5c023de64443e758.tar.gz
bcm5719-llvm-04e0a2270ab079c98c4bde9a5c023de64443e758.zip
Process::Destroy should Halt before it tries to destroy so we don't have race conditions where we are in the middle of trying to service an event when we go to Destroy.
The AttachCompletionHandler should note that it has restarted the target if it indeed does so. llvm-svn: 157327
-rw-r--r--lldb/source/Target/Process.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index 658204cfbd6..832feaac9ae 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -2553,6 +2553,7 @@ Process::AttachCompletionHandler::PerformAction (lldb::EventSP &event_sp)
{
--m_exec_count;
m_process->PrivateResume ();
+ Process::ProcessEventData::SetRestartedInEvent (event_sp.get(), true);
return eEventActionRetry;
}
else
@@ -3026,6 +3027,31 @@ Process::Destroy ()
if (error.Success())
{
DisableAllBreakpointSites();
+ if (m_public_state.GetValue() == eStateRunning)
+ {
+ error = Halt();
+ if (error.Success())
+ {
+ // Consume the halt event.
+ EventSP stop_event;
+ TimeValue timeout (TimeValue::Now());
+ timeout.OffsetWithMicroSeconds(1000);
+ StateType state = WaitForProcessToStop (&timeout);
+ if (state != eStateStopped)
+ {
+ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
+ if (log)
+ log->Printf("Process::Destroy() Halt failed to stop, state is: %s", StateAsCString(state));
+ }
+ }
+ else
+ {
+ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
+ if (log)
+ log->Printf("Process::Destroy() Halt got error: %s", error.AsCString());
+ }
+ }
+
error = DoDestroy();
if (error.Success())
{
OpenPOWER on IntegriCloud