forked from qt-creator/qt-creator
debugger: adjust pdb engine to state machine changes
This commit is contained in:
@@ -942,12 +942,12 @@ static bool isAllowedTransition(DebuggerState from, DebuggerState to)
|
|||||||
{
|
{
|
||||||
switch (from) {
|
switch (from) {
|
||||||
case DebuggerNotReady:
|
case DebuggerNotReady:
|
||||||
return to == EngineSetupRequested || to == DebuggerNotReady;
|
return to == EngineSetupRequested;
|
||||||
|
|
||||||
case EngineSetupRequested:
|
case EngineSetupRequested:
|
||||||
return to == EngineSetupOk || to == EngineSetupFailed;
|
return to == EngineSetupOk || to == EngineSetupFailed;
|
||||||
case EngineSetupFailed:
|
case EngineSetupFailed:
|
||||||
return to == DebuggerNotReady;
|
return to == DebuggerFinished;
|
||||||
case EngineSetupOk:
|
case EngineSetupOk:
|
||||||
return to == InferiorSetupRequested || to == EngineShutdownRequested;
|
return to == InferiorSetupRequested || to == EngineShutdownRequested;
|
||||||
|
|
||||||
@@ -1273,10 +1273,15 @@ void DebuggerEngine::notifyEngineIll()
|
|||||||
void DebuggerEngine::notifyEngineSpontaneousShutdown()
|
void DebuggerEngine::notifyEngineSpontaneousShutdown()
|
||||||
{
|
{
|
||||||
SDEBUG(Q_FUNC_INFO);
|
SDEBUG(Q_FUNC_INFO);
|
||||||
|
if (state() == EngineShutdownRequested) {
|
||||||
|
setState(EngineShutdownOk, true);
|
||||||
|
QTimer::singleShot(0, d, SLOT(doFinishDebugger()));
|
||||||
|
} else {
|
||||||
qDebug() << "THE ENGINE SUDDENLY DIED";
|
qDebug() << "THE ENGINE SUDDENLY DIED";
|
||||||
setState(EngineShutdownOk, true);
|
setState(EngineShutdownOk, true);
|
||||||
QTimer::singleShot(0, d, SLOT(doFinishDebugger()));
|
QTimer::singleShot(0, d, SLOT(doFinishDebugger()));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void DebuggerEngine::notifyInferiorExited()
|
void DebuggerEngine::notifyInferiorExited()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -129,10 +129,6 @@ void PdbEngine::shutdownEngine()
|
|||||||
QTC_ASSERT(state() == EngineShutdownRequested, qDebug() << state());
|
QTC_ASSERT(state() == EngineShutdownRequested, qDebug() << state());
|
||||||
SDEBUG("PdbEngine::shutdownEngine()");
|
SDEBUG("PdbEngine::shutdownEngine()");
|
||||||
m_pdbProc.kill();
|
m_pdbProc.kill();
|
||||||
//if (m_scriptEngine->isEvaluating())
|
|
||||||
// m_scriptEngine->abortEvaluation();
|
|
||||||
//m_scriptEngine->setAgent(0);
|
|
||||||
notifyEngineShutdownOk();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PdbEngine::setupEngine()
|
void PdbEngine::setupEngine()
|
||||||
@@ -178,7 +174,7 @@ void PdbEngine::setupEngine()
|
|||||||
if (!m_pdbProc.waitForStarted()) {
|
if (!m_pdbProc.waitForStarted()) {
|
||||||
const QString msg = tr("Unable to start pdb '%1': %2")
|
const QString msg = tr("Unable to start pdb '%1': %2")
|
||||||
.arg(m_pdb, m_pdbProc.errorString());
|
.arg(m_pdb, m_pdbProc.errorString());
|
||||||
setState(EngineSetupFailed);
|
notifyEngineSetupFailed();
|
||||||
showMessage(_("ADAPTER START FAILED"));
|
showMessage(_("ADAPTER START FAILED"));
|
||||||
if (!msg.isEmpty()) {
|
if (!msg.isEmpty()) {
|
||||||
const QString title = tr("Adapter start failed");
|
const QString title = tr("Adapter start failed");
|
||||||
@@ -206,59 +202,60 @@ void PdbEngine::runEngine()
|
|||||||
{
|
{
|
||||||
showStatusMessage(tr("Running requested..."), 5000);
|
showStatusMessage(tr("Running requested..."), 5000);
|
||||||
SDEBUG("PdbEngine::runEngine()");
|
SDEBUG("PdbEngine::runEngine()");
|
||||||
continueInferior();
|
notifyEngineRunAndInferiorRunOk();
|
||||||
|
postCommand("continue", CB(handleUpdateAll));
|
||||||
}
|
}
|
||||||
|
|
||||||
void PdbEngine::interruptInferior()
|
void PdbEngine::interruptInferior()
|
||||||
{
|
{
|
||||||
setState(InferiorStopOk);
|
notifyInferiorStopOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PdbEngine::executeStep()
|
void PdbEngine::executeStep()
|
||||||
{
|
{
|
||||||
resetLocation();
|
resetLocation();
|
||||||
setState(InferiorRunRequested);
|
notifyInferiorRunRequested();
|
||||||
setState(InferiorRunOk);
|
notifyInferiorRunOk();
|
||||||
postCommand("step", CB(handleUpdateAll));
|
postCommand("step", CB(handleUpdateAll));
|
||||||
}
|
}
|
||||||
|
|
||||||
void PdbEngine::executeStepI()
|
void PdbEngine::executeStepI()
|
||||||
{
|
{
|
||||||
resetLocation();
|
resetLocation();
|
||||||
setState(InferiorRunRequested);
|
notifyInferiorRunRequested();
|
||||||
setState(InferiorRunOk);
|
notifyInferiorRunOk();
|
||||||
postCommand("step", CB(handleUpdateAll));
|
postCommand("step", CB(handleUpdateAll));
|
||||||
}
|
}
|
||||||
|
|
||||||
void PdbEngine::executeStepOut()
|
void PdbEngine::executeStepOut()
|
||||||
{
|
{
|
||||||
resetLocation();
|
resetLocation();
|
||||||
setState(InferiorRunRequested);
|
notifyInferiorRunRequested();
|
||||||
setState(InferiorRunOk);
|
notifyInferiorRunOk();
|
||||||
postCommand("finish", CB(handleUpdateAll));
|
postCommand("finish", CB(handleUpdateAll));
|
||||||
}
|
}
|
||||||
|
|
||||||
void PdbEngine::executeNext()
|
void PdbEngine::executeNext()
|
||||||
{
|
{
|
||||||
resetLocation();
|
resetLocation();
|
||||||
setState(InferiorRunRequested);
|
notifyInferiorRunRequested();
|
||||||
setState(InferiorRunOk);
|
notifyInferiorRunOk();
|
||||||
postCommand("next", CB(handleUpdateAll));
|
postCommand("next", CB(handleUpdateAll));
|
||||||
}
|
}
|
||||||
|
|
||||||
void PdbEngine::executeNextI()
|
void PdbEngine::executeNextI()
|
||||||
{
|
{
|
||||||
resetLocation();
|
resetLocation();
|
||||||
setState(InferiorRunRequested);
|
notifyInferiorRunRequested();
|
||||||
setState(InferiorRunOk);
|
notifyInferiorRunOk();
|
||||||
postCommand("next", CB(handleUpdateAll));
|
postCommand("next", CB(handleUpdateAll));
|
||||||
}
|
}
|
||||||
|
|
||||||
void PdbEngine::continueInferior()
|
void PdbEngine::continueInferior()
|
||||||
{
|
{
|
||||||
resetLocation();
|
resetLocation();
|
||||||
setState(InferiorRunRequested);
|
notifyInferiorRunRequested();
|
||||||
setState(InferiorRunOk);
|
notifyInferiorRunOk();
|
||||||
// Callback will be triggered e.g. when breakpoint is hit.
|
// Callback will be triggered e.g. when breakpoint is hit.
|
||||||
postCommand("continue", CB(handleUpdateAll));
|
postCommand("continue", CB(handleUpdateAll));
|
||||||
}
|
}
|
||||||
@@ -561,8 +558,8 @@ void PdbEngine::handlePdbError(QProcess::ProcessError error)
|
|||||||
case QProcess::WriteError:
|
case QProcess::WriteError:
|
||||||
case QProcess::Timedout:
|
case QProcess::Timedout:
|
||||||
default:
|
default:
|
||||||
|
//setState(EngineShutdownRequested, true);
|
||||||
m_pdbProc.kill();
|
m_pdbProc.kill();
|
||||||
setState(EngineShutdownRequested, true);
|
|
||||||
plugin()->showMessageBox(QMessageBox::Critical, tr("Pdb I/O Error"),
|
plugin()->showMessageBox(QMessageBox::Critical, tr("Pdb I/O Error"),
|
||||||
errorMessage(error));
|
errorMessage(error));
|
||||||
break;
|
break;
|
||||||
@@ -599,9 +596,7 @@ QString PdbEngine::errorMessage(QProcess::ProcessError error) const
|
|||||||
void PdbEngine::handlePdbFinished(int code, QProcess::ExitStatus type)
|
void PdbEngine::handlePdbFinished(int code, QProcess::ExitStatus type)
|
||||||
{
|
{
|
||||||
showMessage(_("PDB PROCESS FINISHED, status %1, code %2").arg(type).arg(code));
|
showMessage(_("PDB PROCESS FINISHED, status %1, code %2").arg(type).arg(code));
|
||||||
//shutdown();
|
notifyEngineSpontaneousShutdown();
|
||||||
//initializeVariables();
|
|
||||||
setState(DebuggerNotReady, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PdbEngine::readPdbStandardError()
|
void PdbEngine::readPdbStandardError()
|
||||||
@@ -661,8 +656,7 @@ void PdbEngine::handleResponse(const QByteArray &response0)
|
|||||||
frame.line = lineNumber;
|
frame.line = lineNumber;
|
||||||
if (frame.line > 0 && QFileInfo(frame.file).exists()) {
|
if (frame.line > 0 && QFileInfo(frame.file).exists()) {
|
||||||
gotoLocation(frame, true);
|
gotoLocation(frame, true);
|
||||||
setState(InferiorStopRequested);
|
notifyInferiorSpontaneousStop();
|
||||||
setState(InferiorStopOk);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -678,8 +672,7 @@ void PdbEngine::handleFirstCommand(const PdbResponse &response)
|
|||||||
void PdbEngine::handleUpdateAll(const PdbResponse &response)
|
void PdbEngine::handleUpdateAll(const PdbResponse &response)
|
||||||
{
|
{
|
||||||
Q_UNUSED(response);
|
Q_UNUSED(response);
|
||||||
setState(InferiorStopRequested);
|
notifyInferiorSpontaneousStop();
|
||||||
setState(InferiorStopOk);
|
|
||||||
updateAll();
|
updateAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user