Commit 7458a823 authored by Fawzi Mohamed's avatar Fawzi Mohamed Committed by hjk

ios: do not stop in debugger when debuggings an app

the attached process is seen as still running just after the attach
and continuing fails, immediately later a spontaneous stop is
detected and on ios (where we set continueAfterAttach) we
continue after the spontanous stop.
This also work in the desktop case.

Change-Id: I92fbcd3ba319da7d9e664f67c8cbbea00f0daa43
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
parent d7ede938
......@@ -618,7 +618,10 @@ class Dumper(DumperBase):
self.report('state="inferiorrunfailed"')
return
self.report('pid="%s"' % self.process.GetProcessID())
self.report('state="enginerunandinferiorstopok"')
# 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.report('state="enginerunandinferiorrunok"')
elif len(self.remoteChannel_) > 0:
self.process = self.target.ConnectRemote(
self.debugger.GetListener(),
......@@ -626,7 +629,10 @@ class Dumper(DumperBase):
if not error.Success():
self.report('state="inferiorrunfailed"')
return
self.report('state="enginerunandinferiorstopok"')
# 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.report('state="enginerunandinferiorrunok"')
else:
launchInfo = lldb.SBLaunchInfo(self.processArgs_.split())
launchInfo.SetWorkingDirectory(os.getcwd())
......
......@@ -83,7 +83,7 @@ static QByteArray tooltipIName(const QString &exp)
///////////////////////////////////////////////////////////////////////
LldbEngine::LldbEngine(const DebuggerStartParameters &startParameters)
: DebuggerEngine(startParameters)
: DebuggerEngine(startParameters), m_continueAtNextSpontaneousStop(false)
{
m_lastAgentId = 0;
m_lastToken = 0;
......@@ -197,13 +197,19 @@ void LldbEngine::setupInferior()
cmd.arg("executable", QFileInfo(sp.executable).absoluteFilePath());
cmd.arg("startMode", sp.startMode); // directly relying on this is brittle wrt. insertions, so check it here
cmd.arg("processArgs", sp.processArgs);
cmd.arg("attachPid", ((sp.startMode == AttachCrashedExternal || sp.startMode == AttachExternal)
? sp.attachPID : 0));
QTC_CHECK(!sp.attachPID || (sp.startMode == AttachCrashedExternal
|| sp.startMode == AttachExternal));
cmd.arg("attachPid", sp.attachPID);
cmd.arg("sysRoot", sp.sysRoot);
cmd.arg("remoteChannel", ((sp.startMode == AttachToRemoteProcess
|| sp.startMode == AttachToRemoteServer)
? sp.remoteChannel : QString()));
cmd.arg("platform", sp.platform);
QTC_CHECK(!sp.continueAfterAttach || (sp.startMode == AttachToRemoteProcess
|| sp.startMode == AttachExternal
|| sp.startMode == AttachToRemoteServer));
m_continueAtNextSpontaneousStop = false;
runCommand(cmd);
updateLocals(); // update display options
}
......@@ -1014,9 +1020,13 @@ void LldbEngine::refreshState(const GdbMi &reportedState)
notifyInferiorRunOk();
else if (newState == "inferiorrunfailed")
notifyInferiorRunFailed();
else if (newState == "stopped")
else if (newState == "stopped") {
notifyInferiorSpontaneousStop();
else if (newState == "inferiorstopok")
if (m_continueAtNextSpontaneousStop) {
m_continueAtNextSpontaneousStop = false;
continueInferior();
}
} else if (newState == "inferiorstopok")
notifyInferiorStopOk();
else if (newState == "inferiorstopfailed")
notifyInferiorStopFailed();
......@@ -1028,9 +1038,11 @@ void LldbEngine::refreshState(const GdbMi &reportedState)
notifyEngineRunFailed();
else if (newState == "inferiorsetupok")
notifyInferiorSetupOk();
else if (newState == "enginerunandinferiorrunok")
else if (newState == "enginerunandinferiorrunok") {
if (startParameters().continueAfterAttach)
m_continueAtNextSpontaneousStop = true;
notifyEngineRunAndInferiorRunOk();
else if (newState == "enginerunandinferiorstopok")
} else if (newState == "enginerunandinferiorstopok")
notifyEngineRunAndInferiorStopOk();
else if (newState == "inferiorshutdownok")
notifyInferiorShutdownOk();
......
......@@ -201,6 +201,7 @@ private:
// FIXME: Make generic.
int m_lastAgentId;
int m_lastToken;
int m_continueAtNextSpontaneousStop;
QMap<QPointer<DisassemblerAgent>, int> m_disassemblerAgents;
QMap<QPointer<MemoryAgent>, int> m_memoryAgents;
QHash<int, QPointer<QObject> > m_memoryAgentTokens;
......
......@@ -84,6 +84,8 @@ RunControl *IosDebugSupport::createDebugRunControl(IosRunConfiguration *runConfi
}
params.displayName = runConfig->appName();
params.remoteSetupNeeded = true;
if (!params.breakOnMain)
params.continueAfterAttach = true;
Debugger::DebuggerRunConfigurationAspect *aspect
= runConfig->extraAspect<Debugger::DebuggerRunConfigurationAspect>();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment