From dd6604eef25013ece1e095d10c308a8f82041b55 Mon Sep 17 00:00:00 2001 From: hjk <qthjk@ovi.com> Date: Tue, 21 Aug 2012 11:30:59 +0200 Subject: [PATCH] debugger: use *running instead of ^running as running notification. This is closer to internal gdb state. There are still a few workarounds for gdb < 7.0 which probably should be dropped as BFD 2.18.50.20080226 yields "assertion fail elf32-i386.c:366" on stock Ubuntu 12.04 gcc, so stock gdb 6.8 cannot be used with that compiler anyways. Change-Id: I22c4e0ce91f634cc171d65f0ad07d68d679af10c Reviewed-by: David Schulz <david.schulz@nokia.com> Reviewed-by: hjk <qthjk@ovi.com> --- src/plugins/debugger/debuggerengine.cpp | 18 +++++++++- src/plugins/debugger/debuggerengine.h | 1 + .../debugger/gdb/abstractplaingdbadapter.cpp | 3 +- src/plugins/debugger/gdb/classicgdbengine.cpp | 5 --- src/plugins/debugger/gdb/gdbengine.cpp | 35 ++++++++++--------- src/plugins/debugger/gdb/gdbengine.h | 3 +- 6 files changed, 40 insertions(+), 25 deletions(-) diff --git a/src/plugins/debugger/debuggerengine.cpp b/src/plugins/debugger/debuggerengine.cpp index 4d2f088ae26..0ee1117ba99 100644 --- a/src/plugins/debugger/debuggerengine.cpp +++ b/src/plugins/debugger/debuggerengine.cpp @@ -713,6 +713,7 @@ static bool isAllowedTransition(DebuggerState from, DebuggerState to) case EngineRunRequested: return to == EngineRunFailed + || to == InferiorRunRequested || to == InferiorRunOk || to == InferiorStopOk || to == InferiorUnrunnable; @@ -922,6 +923,16 @@ void DebuggerEngine::notifyEngineRemoteSetupFailed(const QString &message) qDebug() << this << "remoteSetupState" << d->remoteSetupState()); } +void DebuggerEngine::notifyEngineRunOkAndInferiorRunRequested() +{ + showMessage(_("NOTE: ENGINE RUN OK AND INFERIOR RUN REQUESTED")); + d->m_progress.setProgressValue(1000); + d->m_progress.reportFinished(); + QTC_ASSERT(state() == EngineRunRequested, qDebug() << this << state()); + showStatusMessage(tr("Running.")); + setState(InferiorRunRequested); +} + void DebuggerEngine::notifyEngineRunAndInferiorRunOk() { showMessage(_("NOTE: ENGINE RUN AND INFERIOR RUN OK")); @@ -952,10 +963,15 @@ void DebuggerEngine::notifyInferiorRunRequested() void DebuggerEngine::notifyInferiorRunOk() { + if (state() == InferiorRunOk) { + showMessage(_("NOTE: INFERIOR RUN OK - REPEATED.")); + return; + } showMessage(_("NOTE: INFERIOR RUN OK")); showStatusMessage(tr("Running.")); - // Transition from StopRequested can happen sin remotegdbadapter. + // Transition from StopRequested can happen in remotegdbadapter. QTC_ASSERT(state() == InferiorRunRequested + || state() == InferiorStopOk || state() == InferiorStopRequested, qDebug() << this << state()); setState(InferiorRunOk); } diff --git a/src/plugins/debugger/debuggerengine.h b/src/plugins/debugger/debuggerengine.h index 580a3e4db7e..e4a260dae5d 100644 --- a/src/plugins/debugger/debuggerengine.h +++ b/src/plugins/debugger/debuggerengine.h @@ -305,6 +305,7 @@ protected: virtual void notifyInferiorSetupOk(); virtual void notifyInferiorSetupFailed(); + virtual void notifyEngineRunOkAndInferiorRunRequested(); virtual void notifyEngineRunAndInferiorRunOk(); virtual void notifyEngineRunAndInferiorStopOk(); virtual void notifyInferiorUnrunnable(); // Called by CoreAdapter. diff --git a/src/plugins/debugger/gdb/abstractplaingdbadapter.cpp b/src/plugins/debugger/gdb/abstractplaingdbadapter.cpp index 2b76292dfba..3decbaa8109 100644 --- a/src/plugins/debugger/gdb/abstractplaingdbadapter.cpp +++ b/src/plugins/debugger/gdb/abstractplaingdbadapter.cpp @@ -88,7 +88,8 @@ void GdbAbstractPlainEngine::handleExecRun(const GdbResponse &response) { QTC_ASSERT(state() == EngineRunRequested, qDebug() << state()); if (response.resultClass == GdbResultRunning) { - notifyEngineRunAndInferiorRunOk(); + //notifyEngineRunOkAndInferiorRunRequested(); + notifyEngineRunAndInferiorRunOk(); // For gdb < 7.0 //showStatusMessage(tr("Running...")); showMessage(_("INFERIOR STARTED")); showMessage(msgInferiorSetupOk(), StatusBar); diff --git a/src/plugins/debugger/gdb/classicgdbengine.cpp b/src/plugins/debugger/gdb/classicgdbengine.cpp index bdce5a52e0d..b775b6e815b 100644 --- a/src/plugins/debugger/gdb/classicgdbengine.cpp +++ b/src/plugins/debugger/gdb/classicgdbengine.cpp @@ -723,11 +723,6 @@ void GdbEngine::updateLocalsClassic() m_pendingBreakpointRequests = 0; m_processedNames.clear(); - if (0 && debugPending) - qDebug() << "\nRESET PENDING"; - //m_toolTipCache.clear(); - clearToolTip(); - QByteArray level = QByteArray::number(currentFrame()); // '2' is 'list with type and value' QByteArray cmd = "-stack-list-arguments 2 " + level + ' ' + level; diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index cfea2e6e9b2..74d1383c4c4 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -469,7 +469,12 @@ void GdbEngine::handleResponse(const QByteArray &buff) m_pendingLogStreamOutput.clear(); m_pendingConsoleStreamOutput.clear(); } else if (asyncClass == "running") { - // Archer has 'thread-id="all"' here + if (state() == InferiorRunOk) { + // We get multiple *running after thread creation. + showMessage(_("NOTE: INFERIOR STILL RUNNING.")); + } else { + notifyInferiorRunOk(); + } } else if (asyncClass == "library-loaded") { // Archer has 'id="/usr/lib/libdrm.so.2", // target-name="/usr/lib/libdrm.so.2", @@ -1301,8 +1306,9 @@ void GdbEngine::handleQuerySources(const GdbResponse &response) void GdbEngine::handleExecuteJumpToLine(const GdbResponse &response) { if (response.resultClass == GdbResultRunning) { - doNotifyInferiorRunOk(); - // All is fine. Waiting for the temporary breakpoint to be hit. + // All is fine. Waiting for a *running + // and the temporary breakpoint to be hit. + notifyInferiorRunOk(); // Only needed for gdb < 7.0. } else if (response.resultClass == GdbResultDone) { // This happens on old gdb. Trigger the effect of a '*stopped'. showStatusMessage(tr("Jumped. Stopped")); @@ -1314,8 +1320,8 @@ void GdbEngine::handleExecuteJumpToLine(const GdbResponse &response) void GdbEngine::handleExecuteRunToLine(const GdbResponse &response) { if (response.resultClass == GdbResultRunning) { - doNotifyInferiorRunOk(); - // All is fine. Waiting for the temporary breakpoint to be hit. + // All is fine. Waiting for a *running + // and the temporary breakpoint to be hit. } else if (response.resultClass == GdbResultDone) { // This happens on old gdb (Mac). gdb is not stopped yet, // but merely accepted the continue. @@ -1480,7 +1486,6 @@ void GdbEngine::handleStopResponse(const GdbMi &data) // be handled in the result handler. // -- or -- // *stopped arriving earlier than ^done response to an -exec-step - doNotifyInferiorRunOk(); notifyInferiorSpontaneousStop(); } else if (state() == InferiorStopOk) { // That's expected. @@ -1875,7 +1880,8 @@ void GdbEngine::handleExecuteContinue(const GdbResponse &response) { QTC_ASSERT(state() == InferiorRunRequested, qDebug() << state()); if (response.resultClass == GdbResultRunning) { - doNotifyInferiorRunOk(); + // All is fine. Waiting for a *running. + notifyInferiorRunOk(); // Only needed for gdb < 7.0. return; } QByteArray msg = response.data.findChild("msg").data(); @@ -2136,12 +2142,6 @@ void GdbEngine::continueInferiorInternal() postCommand("-exec-continue", RunRequest, CB(handleExecuteContinue)); } -void GdbEngine::doNotifyInferiorRunOk() -{ - clearToolTip(); - notifyInferiorRunOk(); -} - void GdbEngine::autoContinueInferior() { resetLocation(); @@ -2181,7 +2181,8 @@ void GdbEngine::handleExecuteStep(const GdbResponse &response) } QTC_ASSERT(state() == InferiorRunRequested, qDebug() << state()); if (response.resultClass == GdbResultRunning) { - doNotifyInferiorRunOk(); + // All is fine. Waiting for a *running. + notifyInferiorRunOk(); // Only needed for gdb < 7.0. return; } QByteArray msg = response.data.findChild("msg").data(); @@ -2258,7 +2259,8 @@ void GdbEngine::handleExecuteNext(const GdbResponse &response) } QTC_ASSERT(state() == InferiorRunRequested, qDebug() << state()); if (response.resultClass == GdbResultRunning) { - doNotifyInferiorRunOk(); + // All is fine. Waiting for a *running. + notifyInferiorRunOk(); // Only needed for gdb < 7.0. return; } QTC_ASSERT(state() == InferiorStopOk, qDebug() << state()); @@ -3871,9 +3873,10 @@ QString GdbEngine::tooltipExpression() const return m_toolTipContext.isNull() ? QString() : m_toolTipContext->expression; } -void GdbEngine::clearToolTip() +void GdbEngine::resetLocation() { m_toolTipContext.reset(); + DebuggerEngine::resetLocation(); } bool GdbEngine::setToolTipExpression(const QPoint &mousePos, diff --git a/src/plugins/debugger/gdb/gdbengine.h b/src/plugins/debugger/gdb/gdbengine.h index cd2e513653f..0a4599ec360 100644 --- a/src/plugins/debugger/gdb/gdbengine.h +++ b/src/plugins/debugger/gdb/gdbengine.h @@ -414,7 +414,6 @@ private: ////////// Inferior Management ////////// protected: void continueInferiorInternal(); - void doNotifyInferiorRunOk(); void autoContinueInferior(); void continueInferior(); void interruptInferior(); @@ -441,6 +440,7 @@ private: ////////// View & Data Stuff ////////// void selectThread(int index); void activateFrame(int index); + void resetLocation(); // // Breakpoint specific stuff @@ -659,7 +659,6 @@ protected: static QByteArray tooltipIName(const QString &exp); QString tooltipExpression() const; - void clearToolTip(); QScopedPointer<GdbToolTipContext> m_toolTipContext; -- GitLab