Commit dd6604ee authored by hjk's avatar hjk

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: default avatarDavid Schulz <david.schulz@nokia.com>
Reviewed-by: default avatarhjk <qthjk@ovi.com>
parent 5bbaef6b
......@@ -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);
}
......
......@@ -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.
......
......@@ -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);
......
......@@ -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;
......
......@@ -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,
......
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment