Continue process after lldb attach

lldb stops the process after attaching and the event loop is not yet started.
This makes the debugger wait for events while process is in stopped state

Task-number: QTCREATORBUG-15705
Change-Id: Iae6fe94fc483d963b377582c4cbbb443be5e6cba
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Vikas Pachdha
2016-09-14 14:31:27 +02:00
parent 95fa0e397b
commit 1787d00e6e
2 changed files with 10 additions and 4 deletions

View File

@@ -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(),

View File

@@ -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();