forked from qt-creator/qt-creator
debugger: more state work
This commit is contained in:
@@ -1223,7 +1223,9 @@ void DebuggerEnginePrivate::doShutdownEngine()
|
|||||||
{
|
{
|
||||||
SDEBUG(Q_FUNC_INFO);
|
SDEBUG(Q_FUNC_INFO);
|
||||||
QTC_ASSERT(state() == InferiorShutdownOk
|
QTC_ASSERT(state() == InferiorShutdownOk
|
||||||
|| state() == InferiorShutdownFailed, qDebug() << state());
|
|| state() == InferiorShutdownFailed
|
||||||
|
|| state() == InferiorSetupFailed,
|
||||||
|
qDebug() << state());
|
||||||
m_targetState = DebuggerFinished;
|
m_targetState = DebuggerFinished;
|
||||||
m_engine->setState(EngineShutdownRequested);
|
m_engine->setState(EngineShutdownRequested);
|
||||||
m_engine->shutdownEngine();
|
m_engine->shutdownEngine();
|
||||||
|
|||||||
@@ -89,8 +89,6 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
DebuggerState state() const
|
DebuggerState state() const
|
||||||
{ return m_engine->state(); }
|
{ return m_engine->state(); }
|
||||||
void setState(DebuggerState state)
|
|
||||||
{ m_engine->setState(state); }
|
|
||||||
const DebuggerStartParameters &startParameters() const
|
const DebuggerStartParameters &startParameters() const
|
||||||
{ return m_engine->startParameters(); }
|
{ return m_engine->startParameters(); }
|
||||||
void showMessage(const QString &msg, int channel = LogDebug, int timeout = 1)
|
void showMessage(const QString &msg, int channel = LogDebug, int timeout = 1)
|
||||||
|
|||||||
@@ -77,7 +77,11 @@ void AttachGdbAdapter::setupInferior()
|
|||||||
void AttachGdbAdapter::runEngine()
|
void AttachGdbAdapter::runEngine()
|
||||||
{
|
{
|
||||||
QTC_ASSERT(state() == EngineRunRequested, qDebug() << state());
|
QTC_ASSERT(state() == EngineRunRequested, qDebug() << state());
|
||||||
m_engine->notifyInferiorStopOk();
|
m_engine->notifyEngineRunAndInferiorStopOk();
|
||||||
|
m_engine->notifyInferiorRunRequested();
|
||||||
|
m_engine->continueInferiorInternal();
|
||||||
|
m_engine->showStatusMessage(tr("Attached to process %1.")
|
||||||
|
.arg(m_engine->inferiorPid()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void AttachGdbAdapter::handleAttach(const GdbResponse &response)
|
void AttachGdbAdapter::handleAttach(const GdbResponse &response)
|
||||||
@@ -87,7 +91,7 @@ void AttachGdbAdapter::handleAttach(const GdbResponse &response)
|
|||||||
showMessage(_("INFERIOR ATTACHED"));
|
showMessage(_("INFERIOR ATTACHED"));
|
||||||
showMessage(msgAttachedToStoppedInferior(), StatusBar);
|
showMessage(msgAttachedToStoppedInferior(), StatusBar);
|
||||||
m_engine->handleInferiorPrepared();
|
m_engine->handleInferiorPrepared();
|
||||||
m_engine->updateAll();
|
//m_engine->updateAll();
|
||||||
} else {
|
} else {
|
||||||
QString msg = QString::fromLocal8Bit(response.data.findChild("msg").data());
|
QString msg = QString::fromLocal8Bit(response.data.findChild("msg").data());
|
||||||
m_engine->notifyInferiorSetupFailed(msg);
|
m_engine->notifyInferiorSetupFailed(msg);
|
||||||
|
|||||||
@@ -1073,7 +1073,7 @@ void GdbEngine::handleExecuteJumpToLine(const GdbResponse &response)
|
|||||||
} else if (response.resultClass == GdbResultDone) {
|
} else if (response.resultClass == GdbResultDone) {
|
||||||
// This happens on old gdb. Trigger the effect of a '*stopped'.
|
// This happens on old gdb. Trigger the effect of a '*stopped'.
|
||||||
showStatusMessage(tr("Jumped. Stopped"));
|
showStatusMessage(tr("Jumped. Stopped"));
|
||||||
setState(InferiorStopOk);
|
notifyInferiorSpontaneousStop();
|
||||||
handleStop1(response);
|
handleStop1(response);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1091,7 +1091,7 @@ void GdbEngine::handleExecuteRunToLine(const GdbResponse &response)
|
|||||||
//>122^done
|
//>122^done
|
||||||
gotoLocation(m_targetFrame, true);
|
gotoLocation(m_targetFrame, true);
|
||||||
showStatusMessage(tr("Target line hit. Stopped"));
|
showStatusMessage(tr("Target line hit. Stopped"));
|
||||||
setState(InferiorStopOk);
|
notifyInferiorSpontaneousStop();
|
||||||
handleStop1(response);
|
handleStop1(response);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1712,7 +1712,7 @@ void GdbEngine::handleGdbExit(const GdbResponse &response)
|
|||||||
postCommand("-gdb-exit", GdbEngine::ExitRequest, CB(handleGdbExit));
|
postCommand("-gdb-exit", GdbEngine::ExitRequest, CB(handleGdbExit));
|
||||||
break;
|
break;
|
||||||
case InferiorSetupRequested: // This may take some time, so just short-circuit it
|
case InferiorSetupRequested: // This may take some time, so just short-circuit it
|
||||||
setState(InferiorSetupFailed);
|
notifyInferiorSetupFailed();
|
||||||
gdbProc()->kill();
|
gdbProc()->kill();
|
||||||
break;
|
break;
|
||||||
case InferiorStopFailed: // Tough luck, I guess. But unreachable as of now anyway.
|
case InferiorStopFailed: // Tough luck, I guess. But unreachable as of now anyway.
|
||||||
@@ -1725,7 +1725,13 @@ void GdbEngine::detachDebugger()
|
|||||||
{
|
{
|
||||||
QTC_ASSERT(state() == InferiorStopOk, qDebug() << state());
|
QTC_ASSERT(state() == InferiorStopOk, qDebug() << state());
|
||||||
QTC_ASSERT(startMode() != AttachCore, qDebug() << startMode());
|
QTC_ASSERT(startMode() != AttachCore, qDebug() << startMode());
|
||||||
postCommand("detach");
|
postCommand("detach", GdbEngine::ExitRequest, CB(handleDetach));
|
||||||
|
}
|
||||||
|
|
||||||
|
void GdbEngine::handleDetach(const GdbResponse &response)
|
||||||
|
{
|
||||||
|
Q_UNUSED(response);
|
||||||
|
QTC_ASSERT(state() == InferiorStopOk, qDebug() << state());
|
||||||
notifyInferiorExited();
|
notifyInferiorExited();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1737,8 +1743,8 @@ void GdbEngine::quitDebugger()
|
|||||||
// and regular the inferior shutdown procedure could take a while.
|
// and regular the inferior shutdown procedure could take a while.
|
||||||
// And the RunControl::stop() is called synchroneously.
|
// And the RunControl::stop() is called synchroneously.
|
||||||
shutdownEngine();
|
shutdownEngine();
|
||||||
initializeVariables();
|
//initializeVariables();
|
||||||
setState(DebuggerNotReady);
|
//setState(DebuggerNotReady);
|
||||||
}
|
}
|
||||||
|
|
||||||
int GdbEngine::currentFrame() const
|
int GdbEngine::currentFrame() const
|
||||||
|
|||||||
@@ -490,6 +490,7 @@ private: ////////// View & Data Stuff //////////
|
|||||||
void handleDebuggingHelperEditValue(const GdbResponse &response);
|
void handleDebuggingHelperEditValue(const GdbResponse &response);
|
||||||
void handleDebuggingHelperSetup(const GdbResponse &response);
|
void handleDebuggingHelperSetup(const GdbResponse &response);
|
||||||
void handleDebuggingHelperVersionCheckClassic(const GdbResponse &response);
|
void handleDebuggingHelperVersionCheckClassic(const GdbResponse &response);
|
||||||
|
void handleDetach(const GdbResponse &response);
|
||||||
|
|
||||||
Q_SLOT void createFullBacktrace();
|
Q_SLOT void createFullBacktrace();
|
||||||
void handleCreateFullBacktrace(const GdbResponse &response);
|
void handleCreateFullBacktrace(const GdbResponse &response);
|
||||||
|
|||||||
@@ -210,7 +210,7 @@ void RemoteGdbServerAdapter::handleTargetRemote(const GdbResponse &record)
|
|||||||
{
|
{
|
||||||
QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
|
QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
|
||||||
if (record.resultClass == GdbResultDone) {
|
if (record.resultClass == GdbResultDone) {
|
||||||
setState(InferiorStopOk);
|
m_engine->notifyInferiorStopOk();
|
||||||
// gdb server will stop the remote application itself.
|
// gdb server will stop the remote application itself.
|
||||||
showMessage(_("INFERIOR STARTED"));
|
showMessage(_("INFERIOR STARTED"));
|
||||||
showMessage(msgAttachedToStoppedInferior(), StatusBar);
|
showMessage(msgAttachedToStoppedInferior(), StatusBar);
|
||||||
|
|||||||
@@ -1604,7 +1604,7 @@ void TrkGdbAdapter::handleTargetRemote(const GdbResponse &record)
|
|||||||
{
|
{
|
||||||
QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
|
QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
|
||||||
if (record.resultClass == GdbResultDone) {
|
if (record.resultClass == GdbResultDone) {
|
||||||
setState(InferiorStopOk);
|
m_engine->notifyInferiorStopOk();
|
||||||
m_engine->handleInferiorPrepared();
|
m_engine->handleInferiorPrepared();
|
||||||
} else {
|
} else {
|
||||||
QString msg = tr("Connecting to TRK server adapter failed:\n")
|
QString msg = tr("Connecting to TRK server adapter failed:\n")
|
||||||
|
|||||||
Reference in New Issue
Block a user