diff --git a/share/qtcreator/debugger/lldbbridge.py b/share/qtcreator/debugger/lldbbridge.py index 7a20042c40b..f63605e3a86 100644 --- a/share/qtcreator/debugger/lldbbridge.py +++ b/share/qtcreator/debugger/lldbbridge.py @@ -711,8 +711,13 @@ class Dumper(DumperBase): self.report('pid="%s"' % self.process.GetProcessID()) # Even if it stops it seems that LLDB assumes it is running # and later detects that it did stop after all, so it is be - # better to mirror that and wait for the spontaneous stop. - self.reportState("enginerunandinferiorrunok") + # better to mirror that and wait for the spontaneous stop + if self.process and self.process.GetState() == lldb.eStateStopped: + # lldb stops the process after attaching. This happens before the + # eventloop starts. Relay the correct state back. + self.reportState("enginerunandinferiorstopok") + else: + self.reportState("enginerunandinferiorrunok") elif self.startMode_ == AttachToRemoteServer or self.startMode_ == AttachToRemoteProcess: self.process = self.target.ConnectRemote( self.debugger.GetListener(), diff --git a/src/plugins/debugger/lldb/lldbengine.cpp b/src/plugins/debugger/lldb/lldbengine.cpp index 92b4ae97a28..d081383efc0 100644 --- a/src/plugins/debugger/lldb/lldbengine.cpp +++ b/src/plugins/debugger/lldb/lldbengine.cpp @@ -937,9 +937,10 @@ void LldbEngine::handleStateNotification(const GdbMi &reportedState) if (runParameters().continueAfterAttach) m_continueAtNextSpontaneousStop = true; notifyEngineRunAndInferiorRunOk(); - } else if (newState == "enginerunandinferiorstopok") + } else if (newState == "enginerunandinferiorstopok") { notifyEngineRunAndInferiorStopOk(); - else if (newState == "enginerunokandinferiorunrunnable") + continueInferior(); + } else if (newState == "enginerunokandinferiorunrunnable") notifyEngineRunOkAndInferiorUnrunnable(); else if (newState == "inferiorshutdownok") notifyInferiorShutdownOk();