centralize exec-continue calling and error handling

This commit is contained in:
Oswald Buddenhagen
2009-10-20 14:08:59 +02:00
parent a8b39c54d7
commit b2ae433a58
5 changed files with 14 additions and 32 deletions

View File

@@ -1055,7 +1055,7 @@ void GdbEngine::handleStopResponse(const GdbMi &data)
QString pat = theDebuggerStringSetting(SelectedPluginBreakpointsPattern);
debugMessage(_("PATTERN: ") + pat);
postCommand(_("sharedlibrary ") + pat);
continueInferior();
continueInferiorInternal();
showStatusMessage(tr("Loading %1...").arg(dataStr));
return;
}
@@ -1070,7 +1070,7 @@ void GdbEngine::handleStopResponse(const GdbMi &data)
// args=[],from="C:\\WINDOWS\\system32\\ntdll.dll"}
//if (reason == "signal-received"
// && data.findChild("signal-name").data() == "SIGTRAP") {
// continueInferior();
// continueInferiorInternal();
// return;
//}
@@ -1178,8 +1178,7 @@ void GdbEngine::handleStop1(const GdbMi &data)
GdbMi frameData = data.findChild("frame");
if (frameData.findChild("func").data() == "_start"
&& frameData.findChild("from").data() == "/lib/ld-linux.so.2") {
setState(InferiorRunningRequested);
postCommand(_("-exec-continue"), RunRequest, CB(handleExecContinue));
continueInferiorInternal();
return;
}
}
@@ -1314,17 +1313,16 @@ void GdbEngine::handleExecContinue(const GdbResponse &response)
QTC_ASSERT(state() == InferiorRunning, /**/);
} else {
QTC_ASSERT(state() == InferiorRunningRequested, /**/);
setState(InferiorStopped);
QByteArray msg = response.data.findChild("msg").data();
if (msg.startsWith("Cannot find bounds of current function")) {
setState(InferiorStopped);
showStatusMessage(tr("Stopped."), 5000);
//showStatusMessage(tr("No debug information available. "
// "Leaving function..."));
//stepOutExec();
} else {
showMessageBox(QMessageBox::Critical, tr("Error"),
tr("Starting executable failed:\n") + QString::fromLocal8Bit(msg));
QTC_ASSERT(state() == InferiorRunning, /**/);
showMessageBox(QMessageBox::Critical, tr("Execution Error"),
tr("Cannot continue debugged process:\n") + QString::fromLocal8Bit(msg));
shutdown();
}
}
@@ -1531,8 +1529,6 @@ void GdbEngine::startDebugger(const DebuggerStartParametersPtr &sp)
void GdbEngine::continueInferiorInternal()
{
QTC_ASSERT(state() == InferiorStopped, qDebug() << state());
m_manager->resetLocation();
setTokenBarrier();
setState(InferiorRunningRequested);
postCommand(_("-exec-continue"), RunRequest, CB(handleExecContinue));
}
@@ -1545,6 +1541,8 @@ void GdbEngine::autoContinueInferior()
void GdbEngine::continueInferior()
{
m_manager->resetLocation();
setTokenBarrier();
continueInferiorInternal();
showStatusMessage(tr("Running requested..."), 5000);
}
@@ -1627,12 +1625,10 @@ void GdbEngine::runToFunctionExec(const QString &functionName)
QTC_ASSERT(state() == InferiorStopped, qDebug() << state());
setTokenBarrier();
postCommand(_("-break-insert -t ") + functionName);
setState(InferiorRunningRequested);
showStatusMessage(tr("Run to function %1 requested...").arg(functionName), 5000);
// that should be "^running". We need to handle the resulting
// "Stopped"
postCommand(_("-exec-continue"), RunRequest, CB(handleExecContinue));
continueInferiorInternal();
//setState(InferiorRunningRequested);
//postCommand(_("-exec-continue"), handleExecRunToFunction);
showStatusMessage(tr("Run to function %1 requested...").arg(functionName), 5000);
}
void GdbEngine::jumpToLineExec(const QString &fileName, int lineNumber)

View File

@@ -209,7 +209,7 @@ void RemoteGdbAdapter::handleTargetRemote(const GdbResponse &record)
void RemoteGdbAdapter::startInferiorPhase2()
{
m_engine->continueInferior();
m_engine->continueInferiorInternal();
}
void RemoteGdbAdapter::interruptInferior()

View File

@@ -130,8 +130,7 @@ void TermGdbAdapter::handleStubAttached(const GdbResponse &response)
void TermGdbAdapter::startInferiorPhase2()
{
setState(InferiorRunningRequested);
m_engine->postCommand(_("-exec-continue"), GdbEngine::RunRequest);
m_engine->continueInferiorInternal();
}
void TermGdbAdapter::interruptInferior()

View File

@@ -1649,19 +1649,7 @@ void TrkGdbAdapter::handleTargetRemote(const GdbResponse &record)
void TrkGdbAdapter::startInferiorPhase2()
{
setState(InferiorRunningRequested);
m_engine->postCommand(_("-exec-continue"), GdbEngine::RunRequest, CB(handleFirstContinue));
}
void TrkGdbAdapter::handleFirstContinue(const GdbResponse &record)
{
QTC_ASSERT(state() == InferiorRunning, qDebug() << state());
if (record.resultClass == GdbResultDone) {
debugMessage(_("INFERIOR STARTED"));
showStatusMessage(msgInferiorRunning());
} else {
emit inferiorStartFailed(msgConnectRemoteServerFailed(record.toString()));
}
m_engine->continueInferiorInternal();
}
//

View File

@@ -180,7 +180,6 @@ private:
Q_SLOT void waitForTrkConnect();
void handleTargetRemote(const GdbResponse &response);
void handleFirstContinue(const GdbResponse &response);
//
// TRK