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: hjk <hjk121@nokiamail.com>
This commit is contained in:
Fawzi Mohamed
2013-11-19 10:45:00 +01:00
committed by hjk
parent d7ede938e1
commit 7458a8235a
4 changed files with 30 additions and 9 deletions

View File

@@ -618,7 +618,10 @@ class Dumper(DumperBase):
self.report('state="inferiorrunfailed"') self.report('state="inferiorrunfailed"')
return return
self.report('pid="%s"' % self.process.GetProcessID()) 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: elif len(self.remoteChannel_) > 0:
self.process = self.target.ConnectRemote( self.process = self.target.ConnectRemote(
self.debugger.GetListener(), self.debugger.GetListener(),
@@ -626,7 +629,10 @@ class Dumper(DumperBase):
if not error.Success(): if not error.Success():
self.report('state="inferiorrunfailed"') self.report('state="inferiorrunfailed"')
return 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: else:
launchInfo = lldb.SBLaunchInfo(self.processArgs_.split()) launchInfo = lldb.SBLaunchInfo(self.processArgs_.split())
launchInfo.SetWorkingDirectory(os.getcwd()) launchInfo.SetWorkingDirectory(os.getcwd())

View File

@@ -83,7 +83,7 @@ static QByteArray tooltipIName(const QString &exp)
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
LldbEngine::LldbEngine(const DebuggerStartParameters &startParameters) LldbEngine::LldbEngine(const DebuggerStartParameters &startParameters)
: DebuggerEngine(startParameters) : DebuggerEngine(startParameters), m_continueAtNextSpontaneousStop(false)
{ {
m_lastAgentId = 0; m_lastAgentId = 0;
m_lastToken = 0; m_lastToken = 0;
@@ -197,13 +197,19 @@ void LldbEngine::setupInferior()
cmd.arg("executable", QFileInfo(sp.executable).absoluteFilePath()); 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("startMode", sp.startMode); // directly relying on this is brittle wrt. insertions, so check it here
cmd.arg("processArgs", sp.processArgs); 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("sysRoot", sp.sysRoot);
cmd.arg("remoteChannel", ((sp.startMode == AttachToRemoteProcess cmd.arg("remoteChannel", ((sp.startMode == AttachToRemoteProcess
|| sp.startMode == AttachToRemoteServer) || sp.startMode == AttachToRemoteServer)
? sp.remoteChannel : QString())); ? sp.remoteChannel : QString()));
cmd.arg("platform", sp.platform); cmd.arg("platform", sp.platform);
QTC_CHECK(!sp.continueAfterAttach || (sp.startMode == AttachToRemoteProcess
|| sp.startMode == AttachExternal
|| sp.startMode == AttachToRemoteServer));
m_continueAtNextSpontaneousStop = false;
runCommand(cmd); runCommand(cmd);
updateLocals(); // update display options updateLocals(); // update display options
} }
@@ -1014,9 +1020,13 @@ void LldbEngine::refreshState(const GdbMi &reportedState)
notifyInferiorRunOk(); notifyInferiorRunOk();
else if (newState == "inferiorrunfailed") else if (newState == "inferiorrunfailed")
notifyInferiorRunFailed(); notifyInferiorRunFailed();
else if (newState == "stopped") else if (newState == "stopped") {
notifyInferiorSpontaneousStop(); notifyInferiorSpontaneousStop();
else if (newState == "inferiorstopok") if (m_continueAtNextSpontaneousStop) {
m_continueAtNextSpontaneousStop = false;
continueInferior();
}
} else if (newState == "inferiorstopok")
notifyInferiorStopOk(); notifyInferiorStopOk();
else if (newState == "inferiorstopfailed") else if (newState == "inferiorstopfailed")
notifyInferiorStopFailed(); notifyInferiorStopFailed();
@@ -1028,9 +1038,11 @@ void LldbEngine::refreshState(const GdbMi &reportedState)
notifyEngineRunFailed(); notifyEngineRunFailed();
else if (newState == "inferiorsetupok") else if (newState == "inferiorsetupok")
notifyInferiorSetupOk(); notifyInferiorSetupOk();
else if (newState == "enginerunandinferiorrunok") else if (newState == "enginerunandinferiorrunok") {
if (startParameters().continueAfterAttach)
m_continueAtNextSpontaneousStop = true;
notifyEngineRunAndInferiorRunOk(); notifyEngineRunAndInferiorRunOk();
else if (newState == "enginerunandinferiorstopok") } else if (newState == "enginerunandinferiorstopok")
notifyEngineRunAndInferiorStopOk(); notifyEngineRunAndInferiorStopOk();
else if (newState == "inferiorshutdownok") else if (newState == "inferiorshutdownok")
notifyInferiorShutdownOk(); notifyInferiorShutdownOk();

View File

@@ -201,6 +201,7 @@ private:
// FIXME: Make generic. // FIXME: Make generic.
int m_lastAgentId; int m_lastAgentId;
int m_lastToken; int m_lastToken;
int m_continueAtNextSpontaneousStop;
QMap<QPointer<DisassemblerAgent>, int> m_disassemblerAgents; QMap<QPointer<DisassemblerAgent>, int> m_disassemblerAgents;
QMap<QPointer<MemoryAgent>, int> m_memoryAgents; QMap<QPointer<MemoryAgent>, int> m_memoryAgents;
QHash<int, QPointer<QObject> > m_memoryAgentTokens; QHash<int, QPointer<QObject> > m_memoryAgentTokens;

View File

@@ -84,6 +84,8 @@ RunControl *IosDebugSupport::createDebugRunControl(IosRunConfiguration *runConfi
} }
params.displayName = runConfig->appName(); params.displayName = runConfig->appName();
params.remoteSetupNeeded = true; params.remoteSetupNeeded = true;
if (!params.breakOnMain)
params.continueAfterAttach = true;
Debugger::DebuggerRunConfigurationAspect *aspect Debugger::DebuggerRunConfigurationAspect *aspect
= runConfig->extraAspect<Debugger::DebuggerRunConfigurationAspect>(); = runConfig->extraAspect<Debugger::DebuggerRunConfigurationAspect>();