From 0ad7e0545b1313300c8d75044568e5aba4095bfd Mon Sep 17 00:00:00 2001 From: Jim Ingham Date: Thu, 25 Apr 2013 02:04:59 +0000 Subject: In Process::ProcessEventData::DoOnRemoval, we need to handle the case where NO thread has a stop reason specially, and make sure we stop. This shouldn't happen, but if it does, the user will probably want to see it. llvm-svn: 180244 --- lldb/source/Target/Process.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'lldb/source/Target/Process.cpp') diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index 149c225e2bb..f60adca741e 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -4094,6 +4094,12 @@ Process::ProcessEventData::DoOnRemoval (Event *event_ptr) bool still_should_stop = false; + // Sometimes - for instance if we have a bug in the stub we are talking to, we stop but no thread has a + // valid stop reason. In that case we should just stop, because we have no way of telling what the right + // thing to do is, and it's better to let the user decide than continue behind their backs. + + bool does_anybody_have_an_opinion = false; + for (idx = 0; idx < num_threads; ++idx) { curr_thread_list = m_process_sp->GetThreadList(); @@ -4121,6 +4127,7 @@ Process::ProcessEventData::DoOnRemoval (Event *event_ptr) StopInfoSP stop_info_sp = thread_sp->GetStopInfo (); if (stop_info_sp && stop_info_sp->IsValid()) { + does_anybody_have_an_opinion = true; bool this_thread_wants_to_stop; if (stop_info_sp->GetOverrideShouldStop()) { @@ -4152,7 +4159,7 @@ Process::ProcessEventData::DoOnRemoval (Event *event_ptr) if (m_process_sp->GetPrivateState() != eStateRunning) { - if (!still_should_stop) + if (!still_should_stop && does_anybody_have_an_opinion) { // We've been asked to continue, so do that here. SetRestarted(true); -- cgit v1.2.3