Index: source/Target/Process.cpp =================================================================== --- source/Target/Process.cpp +++ source/Target/Process.cpp @@ -1733,10 +1733,17 @@ Error error = PrivateResume(); if (error.Success()) { - StateType state = WaitForProcessToStop (NULL, NULL, true, listener_sp.get(), stream); + EventSP event_sp; + StateType state = WaitForProcessToStop (NULL, &event_sp, true, listener_sp.get(), stream); const bool must_be_alive = false; // eStateExited is ok, so this must be false if (!StateIsStoppedState(state, must_be_alive)) error.SetErrorStringWithFormat("process not in stopped state after synchronous resume: %s", StateAsCString(state)); + else + { + // Target was stopped. Need to notify listeners about it. + RestoreProcessEvents(); + BroadcastEvent(event_sp); + } } // Undo the hijacking of process events... Index: source/Target/Target.cpp =================================================================== --- source/Target/Target.cpp +++ source/Target/Target.cpp @@ -2617,12 +2617,23 @@ error = m_process_sp->PrivateResume(); if (error.Success()) { - state = m_process_sp->WaitForProcessToStop (NULL, NULL, true, hijack_listener_sp.get(), stream); + state = m_process_sp->WaitForProcessToStop (NULL, &event_sp, true, hijack_listener_sp.get(), stream); const bool must_be_alive = false; // eStateExited is ok, so this must be false if (!StateIsStoppedState(state, must_be_alive)) { error.SetErrorStringWithFormat("process isn't stopped: %s", StateAsCString(state)); } + else + { + // Target was stopped. Need to notify listeners about it. + m_process_sp->RestoreProcessEvents(); + m_process_sp->BroadcastEvent(event_sp); + + // there is a race condition where this thread will return up the call stack to the main command + // handler and show an (lldb) prompt before HandlePrivateEvent (from PrivateStateThread) has + // a chance to call PushProcessIOHandler() + m_process_sp->SyncIOHandler(2000); + } } } else @@ -2648,9 +2659,9 @@ { assert(synchronous_execution && launch_info.GetFlags().Test(eLaunchFlagStopAtEntry)); - // Target was stopped at entry as was intended. Need to notify the listeners about it. + // Target was stopped at entry as was intended. Need to notify listeners about it. m_process_sp->RestoreProcessEvents(); - m_process_sp->HandlePrivateEvent(event_sp); + m_process_sp->BroadcastEvent(event_sp); // there is a race condition where this thread will return up the call stack to the main command // handler and show an (lldb) prompt before HandlePrivateEvent (from PrivateStateThread) has Index: test/functionalities/signal/TestSendSignal.py =================================================================== --- test/functionalities/signal/TestSendSignal.py +++ test/functionalities/signal/TestSendSignal.py @@ -41,8 +41,9 @@ self.assertTrue(got_event, "Got an event") state = lldb.SBProcess.GetStateFromEvent(event) self.assertTrue(state == expected_state, - "It was the %s state." % - lldb.SBDebugger_StateAsCString(expected_state)) + "It was the %s state (act: %s)." % ( + lldb.SBDebugger_StateAsCString(expected_state), + lldb.SBDebugger_StateAsCString(state))) def send_signal(self): """Test that lldb command 'process signal SIGUSR1' sends a signal to the inferior process.""" @@ -90,6 +91,8 @@ # Disable our breakpoint, we don't want to hit it anymore... breakpoint.SetEnabled(False) + self.match_state(process_listener, lldb.eStateStopped) + # Now continue: process.Continue()