forked from qt-creator/qt-creator
debugger: refactor startup logic
This commit is contained in:
@@ -47,9 +47,9 @@ AbstractPlainGdbAdapter::AbstractPlainGdbAdapter(GdbEngine *engine,
|
||||
{
|
||||
}
|
||||
|
||||
void AbstractPlainGdbAdapter::startInferior()
|
||||
void AbstractPlainGdbAdapter::setupInferior()
|
||||
{
|
||||
QTC_ASSERT(state() == InferiorStarting, qDebug() << state());
|
||||
QTC_ASSERT(state() == InferiorSettingUp, qDebug() << state());
|
||||
if (!startParameters().processArgs.isEmpty()) {
|
||||
QString args = startParameters().processArgs.join(_(" "));
|
||||
m_engine->postCommand("-exec-arguments " + toLocalEncoding(args));
|
||||
@@ -60,7 +60,7 @@ void AbstractPlainGdbAdapter::startInferior()
|
||||
|
||||
void AbstractPlainGdbAdapter::handleFileExecAndSymbols(const GdbResponse &response)
|
||||
{
|
||||
QTC_ASSERT(state() == InferiorStarting, qDebug() << state());
|
||||
QTC_ASSERT(state() == InferiorSettingUp, qDebug() << state());
|
||||
if (response.resultClass == GdbResultDone) {
|
||||
if (infoTargetNecessary()) {
|
||||
// Old gdbs do not announce the PID for programs without pthreads.
|
||||
@@ -76,11 +76,11 @@ void AbstractPlainGdbAdapter::handleFileExecAndSymbols(const GdbResponse &respon
|
||||
// Extend the message a bit in unknown cases.
|
||||
if (!ba.endsWith("File format not recognized"))
|
||||
msg = tr("Starting executable failed:\n") + msg;
|
||||
m_engine->handleInferiorStartFailed(msg);
|
||||
m_engine->handleInferiorSetupFailed(msg);
|
||||
}
|
||||
}
|
||||
|
||||
void AbstractPlainGdbAdapter::startInferiorPhase2()
|
||||
void AbstractPlainGdbAdapter::runAdapter()
|
||||
{
|
||||
setState(InferiorRunningRequested);
|
||||
m_engine->postCommand("-exec-run", GdbEngine::RunRequest, CB(handleExecRun));
|
||||
@@ -91,7 +91,7 @@ void AbstractPlainGdbAdapter::handleExecRun(const GdbResponse &response)
|
||||
if (response.resultClass == GdbResultRunning) {
|
||||
QTC_ASSERT(state() == InferiorRunning, qDebug() << state());
|
||||
showMessage(_("INFERIOR STARTED"));
|
||||
showMessage(msgInferiorStarted(), StatusBar);
|
||||
showMessage(msgInferiorSetupOk(), StatusBar);
|
||||
// FIXME: That's the wrong place for it.
|
||||
if (theDebuggerBoolSetting(EnableReverseDebugging))
|
||||
m_engine->postCommand("target record");
|
||||
@@ -100,7 +100,7 @@ void AbstractPlainGdbAdapter::handleExecRun(const GdbResponse &response)
|
||||
QString msg = fromLocalEncoding(response.data.findChild("msg").data());
|
||||
//QTC_ASSERT(status() == InferiorRunning, /**/);
|
||||
//interruptInferior();
|
||||
m_engine->handleInferiorStartFailed(msg);
|
||||
m_engine->handleInferiorSetupFailed(msg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,10 +118,10 @@ void AbstractPlainGdbAdapter::handleInfoTarget(const GdbResponse &response)
|
||||
m_engine->postCommand("tbreak *0x" + needle.cap(1).toAscii());
|
||||
// Do nothing here - inferiorPrepared handles the sequencing.
|
||||
} else {
|
||||
m_engine->handleInferiorStartFailed(_("Parsing start address failed"));
|
||||
m_engine->handleInferiorSetupFailed(_("Parsing start address failed"));
|
||||
}
|
||||
} else if (response.resultClass == GdbResultError) {
|
||||
m_engine->handleInferiorStartFailed(_("Fetching start address failed"));
|
||||
m_engine->handleInferiorSetupFailed(_("Fetching start address failed"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user