forked from qt-creator/qt-creator
debugger: more state work
This commit is contained in:
@@ -120,7 +120,8 @@ namespace Debugger {
|
|||||||
|
|
||||||
QDebug operator<<(QDebug d, DebuggerState state)
|
QDebug operator<<(QDebug d, DebuggerState state)
|
||||||
{
|
{
|
||||||
return d << DebuggerEngine::stateName(state) << '(' << int(state) << ')';
|
//return d << DebuggerEngine::stateName(state) << '(' << int(state) << ')';
|
||||||
|
return d << DebuggerEngine::stateName(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
QDebug operator<<(QDebug str, const DebuggerStartParameters &sp)
|
QDebug operator<<(QDebug str, const DebuggerStartParameters &sp)
|
||||||
@@ -243,6 +244,30 @@ public slots:
|
|||||||
void doInterruptInferior();
|
void doInterruptInferior();
|
||||||
void doFinishDebugger();
|
void doFinishDebugger();
|
||||||
|
|
||||||
|
void queueRunEngine() {
|
||||||
|
m_engine->setState(EngineRunRequested);
|
||||||
|
m_engine->showMessage(_("QUEUE: RUN ENGINE"));
|
||||||
|
QTimer::singleShot(0, this, SLOT(doRunEngine()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void queueShutdownEngine() {
|
||||||
|
m_engine->setState(EngineShutdownRequested);
|
||||||
|
m_engine->showMessage(_("QUEUE: SHUTDOWN ENGINE"));
|
||||||
|
QTimer::singleShot(0, this, SLOT(doShutdownEngine()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void queueShutdownInferior() {
|
||||||
|
m_engine->setState(InferiorShutdownRequested);
|
||||||
|
m_engine->showMessage(_("QUEUE: SHUTDOWN INFERIOR"));
|
||||||
|
QTimer::singleShot(0, this, SLOT(doShutdownInferior()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void queueFinishDebugger() {
|
||||||
|
m_engine->setState(DebuggerFinished, true);
|
||||||
|
m_engine->showMessage(_("QUEUE: SHUTDOWN INFERIOR"));
|
||||||
|
QTimer::singleShot(0, this, SLOT(doFinishDebugger()));
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DebuggerState state() const { return m_state; }
|
DebuggerState state() const { return m_state; }
|
||||||
|
|
||||||
@@ -630,7 +655,8 @@ void DebuggerEngine::setRegisterValue(int regnr, const QString &value)
|
|||||||
|
|
||||||
void DebuggerEngine::showMessage(const QString &msg, int channel, int timeout) const
|
void DebuggerEngine::showMessage(const QString &msg, int channel, int timeout) const
|
||||||
{
|
{
|
||||||
//qDebug() << channel << msg;
|
if (msg.size() && msg.at(0).isUpper() && msg.at(1).isUpper())
|
||||||
|
qDebug() << qPrintable(msg) << "IN STATE" << state();
|
||||||
d->m_runControl->showMessage(msg, channel);
|
d->m_runControl->showMessage(msg, channel);
|
||||||
plugin()->showMessage(msg, channel, timeout);
|
plugin()->showMessage(msg, channel, timeout);
|
||||||
}
|
}
|
||||||
@@ -1004,88 +1030,72 @@ static bool isAllowedTransition(DebuggerState from, DebuggerState to)
|
|||||||
|
|
||||||
void DebuggerEngine::notifyEngineSetupFailed()
|
void DebuggerEngine::notifyEngineSetupFailed()
|
||||||
{
|
{
|
||||||
SDEBUG(Q_FUNC_INFO);
|
showMessage(_("NOTE: ENGINE SETUP FAILED"));
|
||||||
QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state());
|
QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state());
|
||||||
setState(EngineSetupFailed);
|
setState(EngineSetupFailed);
|
||||||
d->m_runControl->startFailed();
|
d->m_runControl->startFailed();
|
||||||
QTimer::singleShot(0, d, SLOT(doShutdownEngine()));
|
d->queueShutdownEngine();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerEngine::notifyEngineSetupOk()
|
void DebuggerEngine::notifyEngineSetupOk()
|
||||||
{
|
{
|
||||||
SDEBUG(Q_FUNC_INFO);
|
showMessage(_("NOTE: ENGINE SETUP OK"));
|
||||||
QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state());
|
QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state());
|
||||||
setState(EngineSetupOk);
|
setState(EngineSetupOk);
|
||||||
d->m_runControl->startSuccessful();
|
d->m_runControl->startSuccessful();
|
||||||
|
showMessage(_("QUEUE: SETUP INFERIOR"));
|
||||||
QTimer::singleShot(0, d, SLOT(doSetupInferior()));
|
QTimer::singleShot(0, d, SLOT(doSetupInferior()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerEnginePrivate::doSetupInferior()
|
void DebuggerEnginePrivate::doSetupInferior()
|
||||||
{
|
{
|
||||||
SDEBUG(Q_FUNC_INFO);
|
|
||||||
QTC_ASSERT(state() == EngineSetupOk, qDebug() << state());
|
QTC_ASSERT(state() == EngineSetupOk, qDebug() << state());
|
||||||
m_engine->setState(InferiorSetupRequested);
|
m_engine->setState(InferiorSetupRequested);
|
||||||
|
m_engine->showMessage(_("CALL: SETUP INFERIOR"));
|
||||||
m_engine->setupInferior();
|
m_engine->setupInferior();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
// Default implemention, can be overridden.
|
|
||||||
void DebuggerEngine::setupInferior()
|
|
||||||
{
|
|
||||||
QTC_ASSERT(state() == EngineSetupOk, qDebug() << state());
|
|
||||||
notifyInferiorSetupOk();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void DebuggerEngine::notifyInferiorSetupFailed()
|
void DebuggerEngine::notifyInferiorSetupFailed()
|
||||||
{
|
{
|
||||||
SDEBUG(Q_FUNC_INFO);
|
showMessage(_("NOTE: INFERIOR SETUP FAILED"));
|
||||||
QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
|
QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
|
||||||
setState(InferiorSetupFailed);
|
setState(InferiorSetupFailed);
|
||||||
QTimer::singleShot(0, d, SLOT(doShutdownEngine()));
|
d->queueShutdownEngine();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerEngine::notifyInferiorSetupOk()
|
void DebuggerEngine::notifyInferiorSetupOk()
|
||||||
{
|
{
|
||||||
SDEBUG(Q_FUNC_INFO);
|
showMessage(_("NOTE: INFERIOR SETUP OK"));
|
||||||
QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
|
QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
|
||||||
setState(EngineRunRequested);
|
d->queueRunEngine();
|
||||||
QTimer::singleShot(0, d, SLOT(doRunEngine()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerEnginePrivate::doRunEngine()
|
void DebuggerEnginePrivate::doRunEngine()
|
||||||
{
|
{
|
||||||
SDEBUG(Q_FUNC_INFO);
|
m_engine->showMessage(_("CALL: RUN ENGINE"));
|
||||||
QTC_ASSERT(state() == EngineRunRequested, qDebug() << state());
|
QTC_ASSERT(state() == EngineRunRequested, qDebug() << state());
|
||||||
m_engine->runEngine();
|
m_engine->runEngine();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
// Default implemention, can be overridden.
|
|
||||||
void DebuggerEngine::runEngine()
|
|
||||||
{
|
|
||||||
QTC_ASSERT(state() == EngineRunRequested, qDebug() << state());
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void DebuggerEngine::notifyInferiorUnrunnable()
|
void DebuggerEngine::notifyInferiorUnrunnable()
|
||||||
{
|
{
|
||||||
SDEBUG(Q_FUNC_INFO);
|
showMessage(_("NOTE: INFERIOR UNRUNNABLE"));
|
||||||
QTC_ASSERT(state() == EngineRunRequested, qDebug() << state());
|
QTC_ASSERT(state() == EngineRunRequested, qDebug() << state());
|
||||||
setState(InferiorUnrunnable);
|
setState(InferiorUnrunnable);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerEngine::notifyEngineRunFailed()
|
void DebuggerEngine::notifyEngineRunFailed()
|
||||||
{
|
{
|
||||||
|
showMessage(_("NOTE: ENGINE RUN FAILED"));
|
||||||
SDEBUG(Q_FUNC_INFO);
|
SDEBUG(Q_FUNC_INFO);
|
||||||
QTC_ASSERT(state() == EngineRunRequested, qDebug() << state());
|
QTC_ASSERT(state() == EngineRunRequested, qDebug() << state());
|
||||||
setState(EngineRunFailed);
|
setState(EngineRunFailed);
|
||||||
QTimer::singleShot(0, d, SLOT(doShutdownInferior()));
|
d->queueShutdownInferior();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerEngine::notifyEngineRunAndInferiorRunOk()
|
void DebuggerEngine::notifyEngineRunAndInferiorRunOk()
|
||||||
{
|
{
|
||||||
SDEBUG(Q_FUNC_INFO);
|
showMessage(_("NOTE: ENGINE RUN AND INFERIOR RUN OK"));
|
||||||
QTC_ASSERT(state() == EngineRunRequested, qDebug() << state());
|
QTC_ASSERT(state() == EngineRunRequested, qDebug() << state());
|
||||||
setState(InferiorRunRequested);
|
setState(InferiorRunRequested);
|
||||||
notifyInferiorRunOk();
|
notifyInferiorRunOk();
|
||||||
@@ -1093,7 +1103,7 @@ void DebuggerEngine::notifyEngineRunAndInferiorRunOk()
|
|||||||
|
|
||||||
void DebuggerEngine::notifyEngineRunAndInferiorStopOk()
|
void DebuggerEngine::notifyEngineRunAndInferiorStopOk()
|
||||||
{
|
{
|
||||||
SDEBUG(Q_FUNC_INFO);
|
showMessage(_("NOTE: ENGINE RUN AND INFERIOR STOP OK"));
|
||||||
QTC_ASSERT(state() == EngineRunRequested, qDebug() << state());
|
QTC_ASSERT(state() == EngineRunRequested, qDebug() << state());
|
||||||
setState(InferiorStopRequested);
|
setState(InferiorStopRequested);
|
||||||
notifyInferiorStopOk();
|
notifyInferiorStopOk();
|
||||||
@@ -1101,111 +1111,104 @@ void DebuggerEngine::notifyEngineRunAndInferiorStopOk()
|
|||||||
|
|
||||||
void DebuggerEngine::notifyInferiorRunRequested()
|
void DebuggerEngine::notifyInferiorRunRequested()
|
||||||
{
|
{
|
||||||
SDEBUG(Q_FUNC_INFO);
|
showMessage(_("NOTE: INFERIOR RUN REQUESTED"));
|
||||||
QTC_ASSERT(state() == InferiorStopOk, qDebug() << state());
|
QTC_ASSERT(state() == InferiorStopOk, qDebug() << state());
|
||||||
setState(InferiorRunRequested);
|
setState(InferiorRunRequested);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerEngine::notifyInferiorRunOk()
|
void DebuggerEngine::notifyInferiorRunOk()
|
||||||
{
|
{
|
||||||
SDEBUG(Q_FUNC_INFO);
|
showMessage(_("NOTE: INFERIOR RUN OK"));
|
||||||
QTC_ASSERT(state() == InferiorRunRequested, qDebug() << state());
|
QTC_ASSERT(state() == InferiorRunRequested, qDebug() << state());
|
||||||
setState(InferiorRunOk);
|
setState(InferiorRunOk);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
void DebuggerEngine::notifyInferiorSpontaneousRun()
|
|
||||||
{
|
|
||||||
SDEBUG(Q_FUNC_INFO);
|
|
||||||
QTC_ASSERT(state() == InferiorStopOk, qDebug() << state());
|
|
||||||
setState(InferiorRunRequested);
|
|
||||||
setState(InferiorRunOk);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
void DebuggerEngine::notifyInferiorRunFailed()
|
void DebuggerEngine::notifyInferiorRunFailed()
|
||||||
{
|
{
|
||||||
XSDEBUG(Q_FUNC_INFO);
|
showMessage(_("NOTE: INFERIOR RUN FAILED"));
|
||||||
qDebug() << "NOTIFY_INFERIOR_RUN_FAILED";
|
|
||||||
QTC_ASSERT(state() == InferiorRunRequested, qDebug() << state());
|
QTC_ASSERT(state() == InferiorRunRequested, qDebug() << state());
|
||||||
setState(InferiorRunFailed);
|
setState(InferiorRunFailed);
|
||||||
setState(InferiorStopOk);
|
setState(InferiorStopOk);
|
||||||
if (isDying()) {
|
if (isDying())
|
||||||
QTimer::singleShot(0, d, SLOT(doShutdownInferior()));
|
d->queueShutdownInferior();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerEngine::notifyInferiorStopOk()
|
void DebuggerEngine::notifyInferiorStopOk()
|
||||||
{
|
{
|
||||||
SDEBUG(Q_FUNC_INFO);
|
showMessage(_("NOTE: INFERIOR STOP OK"));
|
||||||
|
// Ignore spurious notifications after we are set to die.
|
||||||
if (isDying()) {
|
if (isDying()) {
|
||||||
showMessage(_("STOPPED WHILE DYING. CONTINUING SHUTDOWN."));
|
showMessage(_("NOTE: ... WHILE DYING. "));
|
||||||
setState(InferiorStopOk);
|
// Forward state to "StopOk" if needed.
|
||||||
QTimer::singleShot(0, d, SLOT(doShutdownInferior()));
|
if (state() == InferiorStopRequested
|
||||||
} else {
|
|| state() == InferiorRunRequested
|
||||||
QTC_ASSERT(state() == InferiorStopRequested, qDebug() << state());
|
|| state() == InferiorRunOk) {
|
||||||
|
showMessage(_("NOTE: ... FORWARDING TO 'STOP OK'. "));
|
||||||
setState(InferiorStopOk);
|
setState(InferiorStopOk);
|
||||||
}
|
}
|
||||||
|
if (state() == InferiorStopOk || state() == InferiorStopFailed) {
|
||||||
|
d->queueShutdownInferior();
|
||||||
|
}
|
||||||
|
showMessage(_("NOTE: ... IGNORING STOP MESSAGE"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
QTC_ASSERT(state() == InferiorStopRequested, qDebug() << state());
|
||||||
|
setState(InferiorStopOk);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerEngine::notifyInferiorSpontaneousStop()
|
void DebuggerEngine::notifyInferiorSpontaneousStop()
|
||||||
{
|
{
|
||||||
SDEBUG(Q_FUNC_INFO);
|
showMessage(_("NOTE: INFERIOR SPONTANEOUES STOP"));
|
||||||
QTC_ASSERT(state() == InferiorRunOk, qDebug() << state());
|
QTC_ASSERT(state() == InferiorRunOk, qDebug() << state());
|
||||||
setState(InferiorStopOk);
|
setState(InferiorStopOk);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerEngine::notifyInferiorStopFailed()
|
void DebuggerEngine::notifyInferiorStopFailed()
|
||||||
{
|
{
|
||||||
SDEBUG(Q_FUNC_INFO);
|
showMessage(_("NOTE: INFERIOR STOP FAILED"));
|
||||||
QTC_ASSERT(state() == InferiorStopRequested, qDebug() << state());
|
QTC_ASSERT(state() == InferiorStopRequested, qDebug() << state());
|
||||||
setState(InferiorStopFailed);
|
setState(InferiorStopFailed);
|
||||||
QTimer::singleShot(0, d, SLOT(doShutdownEngine()));
|
d->queueShutdownEngine();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerEnginePrivate::doInterruptInferior()
|
void DebuggerEnginePrivate::doInterruptInferior()
|
||||||
{
|
{
|
||||||
SDEBUG(Q_FUNC_INFO);
|
|
||||||
QTC_ASSERT(state() == InferiorRunOk, qDebug() << state());
|
QTC_ASSERT(state() == InferiorRunOk, qDebug() << state());
|
||||||
m_engine->setState(InferiorStopRequested);
|
m_engine->setState(InferiorStopRequested);
|
||||||
|
m_engine->showMessage(_("CALL: INTERRUPT INFERIOR"));
|
||||||
m_engine->interruptInferior();
|
m_engine->interruptInferior();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerEnginePrivate::doShutdownInferior()
|
void DebuggerEnginePrivate::doShutdownInferior()
|
||||||
{
|
{
|
||||||
SDEBUG(Q_FUNC_INFO);
|
|
||||||
qDebug() << "DO_SHUTDOWN_INFERIOR";
|
|
||||||
m_engine->resetLocation();
|
m_engine->resetLocation();
|
||||||
m_targetState = DebuggerFinished;
|
m_targetState = DebuggerFinished;
|
||||||
m_engine->setState(InferiorShutdownRequested);
|
m_engine->showMessage(_("CALL: SHUTDOWN INFERIOR"));
|
||||||
m_engine->shutdownInferior();
|
m_engine->shutdownInferior();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerEngine::notifyInferiorShutdownOk()
|
void DebuggerEngine::notifyInferiorShutdownOk()
|
||||||
{
|
{
|
||||||
SDEBUG(Q_FUNC_INFO);
|
|
||||||
QTC_ASSERT(state() == InferiorShutdownRequested, qDebug() << state());
|
|
||||||
showMessage(_("INFERIOR SUCCESSFULLY SHUT DOWN"));
|
showMessage(_("INFERIOR SUCCESSFULLY SHUT DOWN"));
|
||||||
|
QTC_ASSERT(state() == InferiorShutdownRequested, qDebug() << state());
|
||||||
d->m_lastGoodState = DebuggerNotReady; // A "neutral" value.
|
d->m_lastGoodState = DebuggerNotReady; // A "neutral" value.
|
||||||
setState(InferiorShutdownOk);
|
setState(InferiorShutdownOk);
|
||||||
QTimer::singleShot(0, d, SLOT(doShutdownEngine()));
|
d->queueShutdownEngine();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerEngine::notifyInferiorShutdownFailed()
|
void DebuggerEngine::notifyInferiorShutdownFailed()
|
||||||
{
|
{
|
||||||
SDEBUG(Q_FUNC_INFO);
|
|
||||||
QTC_ASSERT(state() == InferiorShutdownRequested, qDebug() << state());
|
|
||||||
showMessage(_("INFERIOR SHUTDOWN FAILED"));
|
showMessage(_("INFERIOR SHUTDOWN FAILED"));
|
||||||
|
QTC_ASSERT(state() == InferiorShutdownRequested, qDebug() << state());
|
||||||
setState(InferiorShutdownFailed);
|
setState(InferiorShutdownFailed);
|
||||||
QTimer::singleShot(0, d, SLOT(doShutdownEngine()));
|
d->queueShutdownEngine();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerEngine::notifyInferiorIll()
|
void DebuggerEngine::notifyInferiorIll()
|
||||||
{
|
{
|
||||||
SDEBUG(Q_FUNC_INFO);
|
showMessage(_("NOTE: INFERIOR ILL"));
|
||||||
// This can be issued in almost any state. The inferior could still be
|
// This can be issued in almost any state. The inferior could still be
|
||||||
// alive as some previous notifications might have been bogus.
|
// alive as some previous notifications might have been bogus.
|
||||||
qDebug() << "SOMETHING IS WRONG WITH THE INFERIOR";
|
|
||||||
d->m_targetState = DebuggerFinished;
|
d->m_targetState = DebuggerFinished;
|
||||||
d->m_lastGoodState = d->m_state;
|
d->m_lastGoodState = d->m_state;
|
||||||
if (state() == InferiorRunRequested) {
|
if (state() == InferiorRunRequested) {
|
||||||
@@ -1215,35 +1218,28 @@ void DebuggerEngine::notifyInferiorIll()
|
|||||||
setState(InferiorRunFailed);
|
setState(InferiorRunFailed);
|
||||||
setState(InferiorStopOk);
|
setState(InferiorStopOk);
|
||||||
}
|
}
|
||||||
QTC_ASSERT(state() == InferiorStopOk, qDebug() << state());
|
d->queueShutdownInferior();
|
||||||
QTimer::singleShot(0, d, SLOT(doShutdownInferior()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerEnginePrivate::doShutdownEngine()
|
void DebuggerEnginePrivate::doShutdownEngine()
|
||||||
{
|
{
|
||||||
SDEBUG(Q_FUNC_INFO);
|
QTC_ASSERT(state() == EngineShutdownRequested, qDebug() << state());
|
||||||
QTC_ASSERT(state() == InferiorShutdownOk
|
|
||||||
|| state() == InferiorShutdownFailed
|
|
||||||
|| state() == InferiorSetupFailed,
|
|
||||||
qDebug() << state());
|
|
||||||
m_targetState = DebuggerFinished;
|
m_targetState = DebuggerFinished;
|
||||||
m_engine->setState(EngineShutdownRequested);
|
m_engine->showMessage(_("CALL: SHUTDOWN ENGINE"));
|
||||||
m_engine->shutdownEngine();
|
m_engine->shutdownEngine();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerEngine::notifyEngineShutdownOk()
|
void DebuggerEngine::notifyEngineShutdownOk()
|
||||||
{
|
{
|
||||||
SDEBUG(Q_FUNC_INFO);
|
showMessage(_("NOTE: ENGINE SHUTDOWN OK"));
|
||||||
QTC_ASSERT(state() == EngineShutdownRequested, qDebug() << state());
|
QTC_ASSERT(state() == EngineShutdownRequested, qDebug() << state());
|
||||||
showMessage(_("ENGINE SUCCESSFULLY SHUT DOWN"));
|
|
||||||
setState(EngineShutdownOk);
|
setState(EngineShutdownOk);
|
||||||
QTimer::singleShot(0, d, SLOT(doFinishDebugger()));
|
QTimer::singleShot(0, d, SLOT(doFinishDebugger()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerEngine::notifyEngineShutdownFailed()
|
void DebuggerEngine::notifyEngineShutdownFailed()
|
||||||
{
|
{
|
||||||
SDEBUG(Q_FUNC_INFO);
|
showMessage(_("NOTE: ENGINE SHUTDOWN FAILED"));
|
||||||
showMessage(_("ENGINE SHUTDOWN FAILED"));
|
|
||||||
QTC_ASSERT(state() == EngineShutdownRequested, qDebug() << state());
|
QTC_ASSERT(state() == EngineShutdownRequested, qDebug() << state());
|
||||||
setState(EngineShutdownFailed);
|
setState(EngineShutdownFailed);
|
||||||
QTimer::singleShot(0, d, SLOT(doFinishDebugger()));
|
QTimer::singleShot(0, d, SLOT(doFinishDebugger()));
|
||||||
@@ -1251,7 +1247,7 @@ void DebuggerEngine::notifyEngineShutdownFailed()
|
|||||||
|
|
||||||
void DebuggerEnginePrivate::doFinishDebugger()
|
void DebuggerEnginePrivate::doFinishDebugger()
|
||||||
{
|
{
|
||||||
SDEBUG(Q_FUNC_INFO);
|
m_engine->showMessage(_("NOTE: FINISH DEBUGGER"));
|
||||||
QTC_ASSERT(state() == EngineShutdownOk
|
QTC_ASSERT(state() == EngineShutdownOk
|
||||||
|| state() == EngineShutdownFailed, qDebug() << state());
|
|| state() == EngineShutdownFailed, qDebug() << state());
|
||||||
m_engine->resetLocation();
|
m_engine->resetLocation();
|
||||||
@@ -1261,33 +1257,32 @@ void DebuggerEnginePrivate::doFinishDebugger()
|
|||||||
|
|
||||||
void DebuggerEngine::notifyEngineIll()
|
void DebuggerEngine::notifyEngineIll()
|
||||||
{
|
{
|
||||||
SDEBUG(Q_FUNC_INFO);
|
showMessage(_("NOTE: ENGINE ILL ******"));
|
||||||
qDebug() << "SOMETHING IS WRONG WITH THE ENGINE";
|
|
||||||
d->m_targetState = DebuggerFinished;
|
d->m_targetState = DebuggerFinished;
|
||||||
d->m_lastGoodState = d->m_state;
|
d->m_lastGoodState = d->m_state;
|
||||||
if (state() == InferiorStopOk) {
|
switch (state()) {
|
||||||
QTimer::singleShot(0, d, SLOT(doShutdownInferior()));
|
case InferiorRunRequested:
|
||||||
} else {
|
case InferiorRunOk:
|
||||||
QTimer::singleShot(0, d, SLOT(doShutdownEngine()));
|
case InferiorStopRequested:
|
||||||
|
case InferiorStopOk:
|
||||||
|
qDebug() << "FORWARDING STATE TO " << InferiorShutdownFailed;
|
||||||
|
setState(InferiorShutdownFailed, true);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
d->queueShutdownEngine();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerEngine::notifyEngineSpontaneousShutdown()
|
void DebuggerEngine::notifyEngineSpontaneousShutdown()
|
||||||
{
|
{
|
||||||
SDEBUG(Q_FUNC_INFO);
|
showMessage(_("NOTE: ENGINE SPONTANEOUS SHUTDOWN"));
|
||||||
if (state() == EngineShutdownRequested) {
|
d->queueFinishDebugger();
|
||||||
setState(EngineShutdownOk, true);
|
|
||||||
QTimer::singleShot(0, d, SLOT(doFinishDebugger()));
|
|
||||||
} else {
|
|
||||||
qDebug() << "THE ENGINE SUDDENLY DIED";
|
|
||||||
setState(EngineShutdownOk, true);
|
|
||||||
QTimer::singleShot(0, d, SLOT(doFinishDebugger()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerEngine::notifyInferiorExited()
|
void DebuggerEngine::notifyInferiorExited()
|
||||||
{
|
{
|
||||||
XSDEBUG("NOTIFY_INFERIOR_EXIT");
|
showMessage(_("NOTE: INFERIOR EXITED"));
|
||||||
resetLocation();
|
resetLocation();
|
||||||
|
|
||||||
// This can be issued in almost any state. We assume, though,
|
// This can be issued in almost any state. We assume, though,
|
||||||
@@ -1299,6 +1294,7 @@ void DebuggerEngine::notifyInferiorExited()
|
|||||||
}
|
}
|
||||||
setState(InferiorShutdownRequested);
|
setState(InferiorShutdownRequested);
|
||||||
setState(InferiorShutdownOk);
|
setState(InferiorShutdownOk);
|
||||||
|
showMessage(_("QUEUE: SHUTDOWN ENGINE"));
|
||||||
QTimer::singleShot(0, d, SLOT(doShutdownEngine()));
|
QTimer::singleShot(0, d, SLOT(doShutdownEngine()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1393,7 +1389,7 @@ bool DebuggerEngine::isReverseDebugging() const
|
|||||||
// called by DebuggerRunControl
|
// called by DebuggerRunControl
|
||||||
void DebuggerEngine::quitDebugger()
|
void DebuggerEngine::quitDebugger()
|
||||||
{
|
{
|
||||||
qDebug() << "QUIT_DEBUGGER";
|
showMessage("QUIT DEBUGGER REQUESTED");
|
||||||
shutdownInferior();
|
shutdownInferior();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -265,6 +265,8 @@ protected:
|
|||||||
void notifyEngineRunAndInferiorRunOk();
|
void notifyEngineRunAndInferiorRunOk();
|
||||||
void notifyEngineRunAndInferiorStopOk();
|
void notifyEngineRunAndInferiorStopOk();
|
||||||
void notifyInferiorUnrunnable(); // Called by CoreAdapter.
|
void notifyInferiorUnrunnable(); // Called by CoreAdapter.
|
||||||
|
|
||||||
|
// Use notifyInferiorRunRequested() plus notifyInferiorRunOk() instead.
|
||||||
//void notifyInferiorSpontaneousRun();
|
//void notifyInferiorSpontaneousRun();
|
||||||
|
|
||||||
void notifyInferiorRunRequested();
|
void notifyInferiorRunRequested();
|
||||||
@@ -292,7 +294,7 @@ protected:
|
|||||||
virtual void shutdownInferior() = 0;
|
virtual void shutdownInferior() = 0;
|
||||||
virtual void shutdownEngine() = 0;
|
virtual void shutdownEngine() = 0;
|
||||||
|
|
||||||
//private: // FIXME. State transitions
|
private:
|
||||||
void setState(DebuggerState state, bool forced = false);
|
void setState(DebuggerState state, bool forced = false);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -1170,6 +1170,11 @@ void GdbEngine::handleStopResponse(const GdbMi &data)
|
|||||||
if (state() == InferiorSetupRequested)
|
if (state() == InferiorSetupRequested)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (isDying()) {
|
||||||
|
notifyInferiorStopOk();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const QByteArray reason = data.findChild("reason").data();
|
const QByteArray reason = data.findChild("reason").data();
|
||||||
|
|
||||||
if (isExitedReason(reason)) {
|
if (isExitedReason(reason)) {
|
||||||
@@ -1194,7 +1199,7 @@ void GdbEngine::handleStopResponse(const GdbMi &data)
|
|||||||
|
|
||||||
if (!m_commandsToRunOnTemporaryBreak.isEmpty()) {
|
if (!m_commandsToRunOnTemporaryBreak.isEmpty()) {
|
||||||
QTC_ASSERT(state() == InferiorStopRequested, qDebug() << state())
|
QTC_ASSERT(state() == InferiorStopRequested, qDebug() << state())
|
||||||
//setState(InferiorStopOk);
|
notifyInferiorStopOk();
|
||||||
flushQueuedCommands();
|
flushQueuedCommands();
|
||||||
if (state() == InferiorStopOk) {
|
if (state() == InferiorStopOk) {
|
||||||
QTC_ASSERT(m_commandsDoneCallback == 0, /**/);
|
QTC_ASSERT(m_commandsDoneCallback == 0, /**/);
|
||||||
@@ -1359,6 +1364,12 @@ void GdbEngine::handleStop1(const GdbResponse &response)
|
|||||||
|
|
||||||
void GdbEngine::handleStop1(const GdbMi &data)
|
void GdbEngine::handleStop1(const GdbMi &data)
|
||||||
{
|
{
|
||||||
|
if (isDying()) {
|
||||||
|
qDebug() << "HANDLING STOP WHILE DYING";
|
||||||
|
notifyInferiorStopOk();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
QByteArray reason = data.findChild("reason").data();
|
QByteArray reason = data.findChild("reason").data();
|
||||||
|
|
||||||
if (0 && m_gdbAdapter->isTrkAdapter()
|
if (0 && m_gdbAdapter->isTrkAdapter()
|
||||||
@@ -1735,18 +1746,6 @@ void GdbEngine::handleDetach(const GdbResponse &response)
|
|||||||
notifyInferiorExited();
|
notifyInferiorExited();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GdbEngine::quitDebugger()
|
|
||||||
{
|
|
||||||
// FIXME: The problem here is that the "kill" send in the shutdown()
|
|
||||||
// procedure might not receive a response anymore. So we need a way
|
|
||||||
// to force it down. On the other hand, there could be an answer,
|
|
||||||
// and regular the inferior shutdown procedure could take a while.
|
|
||||||
// And the RunControl::stop() is called synchroneously.
|
|
||||||
shutdownEngine();
|
|
||||||
//initializeVariables();
|
|
||||||
//setState(DebuggerNotReady);
|
|
||||||
}
|
|
||||||
|
|
||||||
int GdbEngine::currentFrame() const
|
int GdbEngine::currentFrame() const
|
||||||
{
|
{
|
||||||
return stackHandler()->currentIndex();
|
return stackHandler()->currentIndex();
|
||||||
@@ -3054,8 +3053,11 @@ void GdbEngine::activateSnapshot(int index)
|
|||||||
|
|
||||||
if (state() == InferiorUnrunnable) {
|
if (state() == InferiorUnrunnable) {
|
||||||
// All is well. We are looking at another core file.
|
// All is well. We are looking at another core file.
|
||||||
|
#if 0
|
||||||
|
// FIXME AAA
|
||||||
setState(EngineShutdownRequested);
|
setState(EngineShutdownRequested);
|
||||||
setState(DebuggerNotReady);
|
setState(DebuggerNotReady);
|
||||||
|
#endif
|
||||||
activateSnapshot2();
|
activateSnapshot2();
|
||||||
} else if (state() != DebuggerNotReady) {
|
} else if (state() != DebuggerNotReady) {
|
||||||
QMessageBox *mb = showMessageBox(QMessageBox::Critical,
|
QMessageBox *mb = showMessageBox(QMessageBox::Critical,
|
||||||
@@ -3078,20 +3080,18 @@ void GdbEngine::activateSnapshot(int index)
|
|||||||
void GdbEngine::handleActivateSnapshot(const GdbResponse &response)
|
void GdbEngine::handleActivateSnapshot(const GdbResponse &response)
|
||||||
{
|
{
|
||||||
Q_UNUSED(response);
|
Q_UNUSED(response);
|
||||||
setState(InferiorShutdownRequested);
|
quitDebugger();
|
||||||
setState(InferiorShutdownOk);
|
|
||||||
setState(EngineShutdownRequested);
|
|
||||||
setState(DebuggerNotReady);
|
|
||||||
activateSnapshot2();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GdbEngine::activateSnapshot2()
|
void GdbEngine::activateSnapshot2()
|
||||||
{
|
{
|
||||||
// Otherwise the stack data might be stale.
|
// Otherwise the stack data might be stale.
|
||||||
// See http://sourceware.org/bugzilla/show_bug.cgi?id=1124.
|
// See http://sourceware.org/bugzilla/show_bug.cgi?id=1124.
|
||||||
|
#if 0
|
||||||
setState(EngineSetupRequested);
|
setState(EngineSetupRequested);
|
||||||
postCommand("set stack-cache off");
|
postCommand("set stack-cache off");
|
||||||
handleAdapterStarted();
|
handleAdapterStarted();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -4301,14 +4301,12 @@ void GdbEngine::handleInferiorPrepared()
|
|||||||
void GdbEngine::finishInferiorSetup()
|
void GdbEngine::finishInferiorSetup()
|
||||||
{
|
{
|
||||||
QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
|
QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
|
||||||
showMessage(_("BREAKPOINTS SET, CONTINUING INFERIOR STARTUP"));
|
|
||||||
notifyInferiorSetupOk();
|
notifyInferiorSetupOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GdbEngine::runEngine()
|
void GdbEngine::runEngine()
|
||||||
{
|
{
|
||||||
QTC_ASSERT(state() == EngineRunRequested, qDebug() << state());
|
QTC_ASSERT(state() == EngineRunRequested, qDebug() << state());
|
||||||
showMessage(_("RUN ENGINE"));
|
|
||||||
m_gdbAdapter->runEngine();
|
m_gdbAdapter->runEngine();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -178,7 +178,6 @@ void TermGdbAdapter::stubExited()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
showMessage(_("STUB EXITED"));
|
showMessage(_("STUB EXITED"));
|
||||||
qDebug() << "STUB EXITED IN STATE: " << state();
|
|
||||||
m_engine->notifyEngineIll();
|
m_engine->notifyEngineIll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -269,6 +269,7 @@ void QmlEngine::setupEngine()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
notifyEngineSetupOk();
|
notifyEngineSetupOk();
|
||||||
|
|
||||||
//m_frameRate = new CanvasFrameRate(0);
|
//m_frameRate = new CanvasFrameRate(0);
|
||||||
//m_frameRate->show();
|
//m_frameRate->show();
|
||||||
}
|
}
|
||||||
@@ -313,24 +314,23 @@ void QmlEngine::setupConnection()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
notifyEngineSetupOk();
|
notifyEngineRunAndInferiorStopOk();
|
||||||
qDebug() << "CONNECTION SUCCESSFUL";
|
qDebug() << "CONNECTION SUCCESSFUL";
|
||||||
setState(InferiorRunRequested);
|
|
||||||
setState(InferiorRunOk);
|
|
||||||
|
|
||||||
// reloadEngines();
|
// reloadEngines();
|
||||||
|
// continueInferior();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlEngine::continueInferior()
|
void QmlEngine::continueInferior()
|
||||||
{
|
{
|
||||||
|
QTC_ASSERT(state() == InferiorStopOk, qDebug() << state());
|
||||||
SDEBUG("QmlEngine::continueInferior()");
|
SDEBUG("QmlEngine::continueInferior()");
|
||||||
QByteArray reply;
|
QByteArray reply;
|
||||||
QDataStream rs(&reply, QIODevice::WriteOnly);
|
QDataStream rs(&reply, QIODevice::WriteOnly);
|
||||||
rs << QByteArray("CONTINUE");
|
rs << QByteArray("CONTINUE");
|
||||||
sendMessage(reply);
|
sendMessage(reply);
|
||||||
setState(InferiorRunRequested);
|
notifyInferiorRunRequested();
|
||||||
setState(InferiorRunOk);
|
notifyInferiorRunOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlEngine::interruptInferior()
|
void QmlEngine::interruptInferior()
|
||||||
@@ -349,8 +349,8 @@ void QmlEngine::executeStep()
|
|||||||
QDataStream rs(&reply, QIODevice::WriteOnly);
|
QDataStream rs(&reply, QIODevice::WriteOnly);
|
||||||
rs << QByteArray("STEPINTO");
|
rs << QByteArray("STEPINTO");
|
||||||
sendMessage(reply);
|
sendMessage(reply);
|
||||||
setState(InferiorRunRequested);
|
notifyInferiorRunRequested();
|
||||||
setState(InferiorRunOk);
|
notifyInferiorRunOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlEngine::executeStepI()
|
void QmlEngine::executeStepI()
|
||||||
@@ -360,8 +360,8 @@ void QmlEngine::executeStepI()
|
|||||||
QDataStream rs(&reply, QIODevice::WriteOnly);
|
QDataStream rs(&reply, QIODevice::WriteOnly);
|
||||||
rs << QByteArray("STEPINTO");
|
rs << QByteArray("STEPINTO");
|
||||||
sendMessage(reply);
|
sendMessage(reply);
|
||||||
setState(InferiorRunRequested);
|
notifyInferiorRunRequested();
|
||||||
setState(InferiorRunOk);
|
notifyInferiorRunOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlEngine::executeStepOut()
|
void QmlEngine::executeStepOut()
|
||||||
@@ -371,8 +371,8 @@ void QmlEngine::executeStepOut()
|
|||||||
QDataStream rs(&reply, QIODevice::WriteOnly);
|
QDataStream rs(&reply, QIODevice::WriteOnly);
|
||||||
rs << QByteArray("STEPOUT");
|
rs << QByteArray("STEPOUT");
|
||||||
sendMessage(reply);
|
sendMessage(reply);
|
||||||
setState(InferiorRunRequested);
|
notifyInferiorRunRequested();
|
||||||
setState(InferiorRunOk);
|
notifyInferiorRunOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlEngine::executeNext()
|
void QmlEngine::executeNext()
|
||||||
@@ -381,8 +381,8 @@ void QmlEngine::executeNext()
|
|||||||
QDataStream rs(&reply, QIODevice::WriteOnly);
|
QDataStream rs(&reply, QIODevice::WriteOnly);
|
||||||
rs << QByteArray("STEPOVER");
|
rs << QByteArray("STEPOVER");
|
||||||
sendMessage(reply);
|
sendMessage(reply);
|
||||||
setState(InferiorRunRequested);
|
notifyInferiorRunRequested();
|
||||||
setState(InferiorRunOk);
|
notifyInferiorRunOk();
|
||||||
SDEBUG("QmlEngine::nextExec()");
|
SDEBUG("QmlEngine::nextExec()");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -632,8 +632,7 @@ void QmlEngine::messageReceived(const QByteArray &message)
|
|||||||
|
|
||||||
showMessage(_("RECEIVED RESPONSE: ") + quoteUnprintableLatin1(message));
|
showMessage(_("RECEIVED RESPONSE: ") + quoteUnprintableLatin1(message));
|
||||||
if (command == "STOPPED") {
|
if (command == "STOPPED") {
|
||||||
setState(InferiorStopRequested);
|
notifyInferiorSpontaneousStop();
|
||||||
setState(InferiorStopOk);
|
|
||||||
|
|
||||||
QList<QPair<QString, QPair<QString, qint32> > > backtrace;
|
QList<QPair<QString, QPair<QString, qint32> > > backtrace;
|
||||||
QList<QPair<QString, QVariant> > watches;
|
QList<QPair<QString, QVariant> > watches;
|
||||||
@@ -725,8 +724,8 @@ void QmlEngine::handleProcError(QProcess::ProcessError error)
|
|||||||
case QProcess::WriteError:
|
case QProcess::WriteError:
|
||||||
case QProcess::Timedout:
|
case QProcess::Timedout:
|
||||||
default:
|
default:
|
||||||
m_proc.kill();
|
//m_proc.kill();
|
||||||
setState(EngineShutdownRequested, true);
|
notifyEngineIll();
|
||||||
plugin()->showMessageBox(QMessageBox::Critical, tr("Gdb I/O Error"),
|
plugin()->showMessageBox(QMessageBox::Critical, tr("Gdb I/O Error"),
|
||||||
errorMessage(error));
|
errorMessage(error));
|
||||||
break;
|
break;
|
||||||
@@ -736,7 +735,8 @@ void QmlEngine::handleProcError(QProcess::ProcessError error)
|
|||||||
void QmlEngine::handleProcFinished(int code, QProcess::ExitStatus type)
|
void QmlEngine::handleProcFinished(int code, QProcess::ExitStatus type)
|
||||||
{
|
{
|
||||||
showMessage(_("QML VIEWER PROCESS FINISHED, status %1, code %2").arg(type).arg(code));
|
showMessage(_("QML VIEWER PROCESS FINISHED, status %1, code %2").arg(type).arg(code));
|
||||||
setState(DebuggerNotReady, true);
|
notifyEngineIll();
|
||||||
|
//setState(DebuggerNotReady, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlEngine::readProcStandardError()
|
void QmlEngine::readProcStandardError()
|
||||||
|
|||||||
@@ -75,7 +75,6 @@ public:
|
|||||||
~QmlEngine();
|
~QmlEngine();
|
||||||
|
|
||||||
void messageReceived(const QByteArray &message);
|
void messageReceived(const QByteArray &message);
|
||||||
using DebuggerEngine::setState;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// DebuggerEngine implementation
|
// DebuggerEngine implementation
|
||||||
|
|||||||
Reference in New Issue
Block a user