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>
This commit is contained in:
hjk
2012-08-21 11:30:59 +02:00
parent 5bbaef6b10
commit dd6604eef2
6 changed files with 40 additions and 25 deletions

View File

@@ -713,6 +713,7 @@ static bool isAllowedTransition(DebuggerState from, DebuggerState to)
case EngineRunRequested: case EngineRunRequested:
return to == EngineRunFailed return to == EngineRunFailed
|| to == InferiorRunRequested
|| to == InferiorRunOk || to == InferiorRunOk
|| to == InferiorStopOk || to == InferiorStopOk
|| to == InferiorUnrunnable; || to == InferiorUnrunnable;
@@ -922,6 +923,16 @@ void DebuggerEngine::notifyEngineRemoteSetupFailed(const QString &message)
qDebug() << this << "remoteSetupState" << d->remoteSetupState()); 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() void DebuggerEngine::notifyEngineRunAndInferiorRunOk()
{ {
showMessage(_("NOTE: ENGINE RUN AND INFERIOR RUN OK")); showMessage(_("NOTE: ENGINE RUN AND INFERIOR RUN OK"));
@@ -952,10 +963,15 @@ void DebuggerEngine::notifyInferiorRunRequested()
void DebuggerEngine::notifyInferiorRunOk() void DebuggerEngine::notifyInferiorRunOk()
{ {
if (state() == InferiorRunOk) {
showMessage(_("NOTE: INFERIOR RUN OK - REPEATED."));
return;
}
showMessage(_("NOTE: INFERIOR RUN OK")); showMessage(_("NOTE: INFERIOR RUN OK"));
showStatusMessage(tr("Running.")); showStatusMessage(tr("Running."));
// Transition from StopRequested can happen sin remotegdbadapter. // Transition from StopRequested can happen in remotegdbadapter.
QTC_ASSERT(state() == InferiorRunRequested QTC_ASSERT(state() == InferiorRunRequested
|| state() == InferiorStopOk
|| state() == InferiorStopRequested, qDebug() << this << state()); || state() == InferiorStopRequested, qDebug() << this << state());
setState(InferiorRunOk); setState(InferiorRunOk);
} }

View File

@@ -305,6 +305,7 @@ protected:
virtual void notifyInferiorSetupOk(); virtual void notifyInferiorSetupOk();
virtual void notifyInferiorSetupFailed(); virtual void notifyInferiorSetupFailed();
virtual void notifyEngineRunOkAndInferiorRunRequested();
virtual void notifyEngineRunAndInferiorRunOk(); virtual void notifyEngineRunAndInferiorRunOk();
virtual void notifyEngineRunAndInferiorStopOk(); virtual void notifyEngineRunAndInferiorStopOk();
virtual void notifyInferiorUnrunnable(); // Called by CoreAdapter. virtual void notifyInferiorUnrunnable(); // Called by CoreAdapter.

View File

@@ -88,7 +88,8 @@ void GdbAbstractPlainEngine::handleExecRun(const GdbResponse &response)
{ {
QTC_ASSERT(state() == EngineRunRequested, qDebug() << state()); QTC_ASSERT(state() == EngineRunRequested, qDebug() << state());
if (response.resultClass == GdbResultRunning) { if (response.resultClass == GdbResultRunning) {
notifyEngineRunAndInferiorRunOk(); //notifyEngineRunOkAndInferiorRunRequested();
notifyEngineRunAndInferiorRunOk(); // For gdb < 7.0
//showStatusMessage(tr("Running...")); //showStatusMessage(tr("Running..."));
showMessage(_("INFERIOR STARTED")); showMessage(_("INFERIOR STARTED"));
showMessage(msgInferiorSetupOk(), StatusBar); showMessage(msgInferiorSetupOk(), StatusBar);

View File

@@ -723,11 +723,6 @@ void GdbEngine::updateLocalsClassic()
m_pendingBreakpointRequests = 0; m_pendingBreakpointRequests = 0;
m_processedNames.clear(); m_processedNames.clear();
if (0 && debugPending)
qDebug() << "\nRESET PENDING";
//m_toolTipCache.clear();
clearToolTip();
QByteArray level = QByteArray::number(currentFrame()); QByteArray level = QByteArray::number(currentFrame());
// '2' is 'list with type and value' // '2' is 'list with type and value'
QByteArray cmd = "-stack-list-arguments 2 " + level + ' ' + level; QByteArray cmd = "-stack-list-arguments 2 " + level + ' ' + level;

View File

@@ -469,7 +469,12 @@ void GdbEngine::handleResponse(const QByteArray &buff)
m_pendingLogStreamOutput.clear(); m_pendingLogStreamOutput.clear();
m_pendingConsoleStreamOutput.clear(); m_pendingConsoleStreamOutput.clear();
} else if (asyncClass == "running") { } 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") { } else if (asyncClass == "library-loaded") {
// Archer has 'id="/usr/lib/libdrm.so.2", // Archer has 'id="/usr/lib/libdrm.so.2",
// target-name="/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) void GdbEngine::handleExecuteJumpToLine(const GdbResponse &response)
{ {
if (response.resultClass == GdbResultRunning) { if (response.resultClass == GdbResultRunning) {
doNotifyInferiorRunOk(); // All is fine. Waiting for a *running
// All is fine. Waiting for the temporary breakpoint to be hit. // and the temporary breakpoint to be hit.
notifyInferiorRunOk(); // Only needed for gdb < 7.0.
} 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"));
@@ -1314,8 +1320,8 @@ void GdbEngine::handleExecuteJumpToLine(const GdbResponse &response)
void GdbEngine::handleExecuteRunToLine(const GdbResponse &response) void GdbEngine::handleExecuteRunToLine(const GdbResponse &response)
{ {
if (response.resultClass == GdbResultRunning) { if (response.resultClass == GdbResultRunning) {
doNotifyInferiorRunOk(); // All is fine. Waiting for a *running
// All is fine. Waiting for the temporary breakpoint to be hit. // and the temporary breakpoint to be hit.
} else if (response.resultClass == GdbResultDone) { } else if (response.resultClass == GdbResultDone) {
// This happens on old gdb (Mac). gdb is not stopped yet, // This happens on old gdb (Mac). gdb is not stopped yet,
// but merely accepted the continue. // but merely accepted the continue.
@@ -1480,7 +1486,6 @@ void GdbEngine::handleStopResponse(const GdbMi &data)
// be handled in the result handler. // be handled in the result handler.
// -- or -- // -- or --
// *stopped arriving earlier than ^done response to an -exec-step // *stopped arriving earlier than ^done response to an -exec-step
doNotifyInferiorRunOk();
notifyInferiorSpontaneousStop(); notifyInferiorSpontaneousStop();
} else if (state() == InferiorStopOk) { } else if (state() == InferiorStopOk) {
// That's expected. // That's expected.
@@ -1875,7 +1880,8 @@ void GdbEngine::handleExecuteContinue(const GdbResponse &response)
{ {
QTC_ASSERT(state() == InferiorRunRequested, qDebug() << state()); QTC_ASSERT(state() == InferiorRunRequested, qDebug() << state());
if (response.resultClass == GdbResultRunning) { if (response.resultClass == GdbResultRunning) {
doNotifyInferiorRunOk(); // All is fine. Waiting for a *running.
notifyInferiorRunOk(); // Only needed for gdb < 7.0.
return; return;
} }
QByteArray msg = response.data.findChild("msg").data(); QByteArray msg = response.data.findChild("msg").data();
@@ -2136,12 +2142,6 @@ void GdbEngine::continueInferiorInternal()
postCommand("-exec-continue", RunRequest, CB(handleExecuteContinue)); postCommand("-exec-continue", RunRequest, CB(handleExecuteContinue));
} }
void GdbEngine::doNotifyInferiorRunOk()
{
clearToolTip();
notifyInferiorRunOk();
}
void GdbEngine::autoContinueInferior() void GdbEngine::autoContinueInferior()
{ {
resetLocation(); resetLocation();
@@ -2181,7 +2181,8 @@ void GdbEngine::handleExecuteStep(const GdbResponse &response)
} }
QTC_ASSERT(state() == InferiorRunRequested, qDebug() << state()); QTC_ASSERT(state() == InferiorRunRequested, qDebug() << state());
if (response.resultClass == GdbResultRunning) { if (response.resultClass == GdbResultRunning) {
doNotifyInferiorRunOk(); // All is fine. Waiting for a *running.
notifyInferiorRunOk(); // Only needed for gdb < 7.0.
return; return;
} }
QByteArray msg = response.data.findChild("msg").data(); QByteArray msg = response.data.findChild("msg").data();
@@ -2258,7 +2259,8 @@ void GdbEngine::handleExecuteNext(const GdbResponse &response)
} }
QTC_ASSERT(state() == InferiorRunRequested, qDebug() << state()); QTC_ASSERT(state() == InferiorRunRequested, qDebug() << state());
if (response.resultClass == GdbResultRunning) { if (response.resultClass == GdbResultRunning) {
doNotifyInferiorRunOk(); // All is fine. Waiting for a *running.
notifyInferiorRunOk(); // Only needed for gdb < 7.0.
return; return;
} }
QTC_ASSERT(state() == InferiorStopOk, qDebug() << state()); QTC_ASSERT(state() == InferiorStopOk, qDebug() << state());
@@ -3871,9 +3873,10 @@ QString GdbEngine::tooltipExpression() const
return m_toolTipContext.isNull() ? QString() : m_toolTipContext->expression; return m_toolTipContext.isNull() ? QString() : m_toolTipContext->expression;
} }
void GdbEngine::clearToolTip() void GdbEngine::resetLocation()
{ {
m_toolTipContext.reset(); m_toolTipContext.reset();
DebuggerEngine::resetLocation();
} }
bool GdbEngine::setToolTipExpression(const QPoint &mousePos, bool GdbEngine::setToolTipExpression(const QPoint &mousePos,

View File

@@ -414,7 +414,6 @@ private: ////////// Inferior Management //////////
protected: protected:
void continueInferiorInternal(); void continueInferiorInternal();
void doNotifyInferiorRunOk();
void autoContinueInferior(); void autoContinueInferior();
void continueInferior(); void continueInferior();
void interruptInferior(); void interruptInferior();
@@ -441,6 +440,7 @@ private: ////////// View & Data Stuff //////////
void selectThread(int index); void selectThread(int index);
void activateFrame(int index); void activateFrame(int index);
void resetLocation();
// //
// Breakpoint specific stuff // Breakpoint specific stuff
@@ -659,7 +659,6 @@ protected:
static QByteArray tooltipIName(const QString &exp); static QByteArray tooltipIName(const QString &exp);
QString tooltipExpression() const; QString tooltipExpression() const;
void clearToolTip();
QScopedPointer<GdbToolTipContext> m_toolTipContext; QScopedPointer<GdbToolTipContext> m_toolTipContext;