summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhjk <qtc-committer@nokia.com>2011-10-31 17:36:08 +0100
committerhjk <qthjk@ovi.com>2011-11-02 08:29:48 +0100
commit755f5fc327cea2f9e60ac49999cee115e32fd00d (patch)
tree46f58a72ed5bb093da390e491c3a88889adff125 /src
parent384a8ed1cf96e8f6dd1b14508f94352aa579c3de (diff)
downloadqt-creator-755f5fc327cea2f9e60ac49999cee115e32fd00d.tar.gz
debugger: cleaner debugger aborting
Make the second "Abort Debugger" kill the gdb process directly instead of relying on further communication. Also fix some "unexpected" (but harmless) state transitions. Change-Id: I0938ec76420fbd77ec4b7348819dd7f63763547f Reviewed-by: hjk <qthjk@ovi.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/debugger/debuggerconstants.h2
-rw-r--r--src/plugins/debugger/debuggerengine.cpp11
-rw-r--r--src/plugins/debugger/debuggerengine.h3
-rw-r--r--src/plugins/debugger/debuggerplugin.cpp18
-rw-r--r--src/plugins/debugger/gdb/gdbengine.cpp22
-rw-r--r--src/plugins/debugger/gdb/gdbengine.h1
6 files changed, 43 insertions, 14 deletions
diff --git a/src/plugins/debugger/debuggerconstants.h b/src/plugins/debugger/debuggerconstants.h
index bf2260608c..81d5e3e414 100644
--- a/src/plugins/debugger/debuggerconstants.h
+++ b/src/plugins/debugger/debuggerconstants.h
@@ -60,7 +60,7 @@ const char INTERRUPT[] = "Debugger.Interrupt";
const char CONTINUE[] = "Debugger.Continue";
const char STOP[] = "Debugger.Stop";
const char HIDDEN_STOP[] = "Debugger.HiddenStop";
-const char RESET[] = "Debugger.Reset";
+const char ABORT[] = "Debugger.Abort";
const char STEP[] = "Debugger.StepLine";
const char STEPOUT[] = "Debugger.StepOut";
const char NEXT[] = "Debugger.NextLine";
diff --git a/src/plugins/debugger/debuggerengine.cpp b/src/plugins/debugger/debuggerengine.cpp
index 246166c68d..eb6feae023 100644
--- a/src/plugins/debugger/debuggerengine.cpp
+++ b/src/plugins/debugger/debuggerengine.cpp
@@ -1209,7 +1209,7 @@ bool DebuggerEngine::isReverseDebugging() const
// Called by DebuggerRunControl.
void DebuggerEngine::quitDebugger()
{
- showMessage("QUIT DEBUGGER REQUESTED");
+ showMessage(_("QUIT DEBUGGER REQUESTED IN STATE %1").arg(state()));
d->m_targetState = DebuggerFinished;
switch (state()) {
case InferiorStopOk:
@@ -1225,6 +1225,9 @@ void DebuggerEngine::quitDebugger()
case EngineRunFailed:
case DebuggerFinished:
break;
+ case InferiorSetupRequested:
+ notifyInferiorSetupFailed();
+ break;
default:
// FIXME: We should disable the actions connected to that.
notifyInferiorIll();
@@ -1232,6 +1235,12 @@ void DebuggerEngine::quitDebugger()
}
}
+void DebuggerEngine::abortDebugger()
+{
+ // Overridden in e.g. GdbEngine.
+ quitDebugger();
+}
+
void DebuggerEngine::requestInterruptInferior()
{
d->doInterruptInferior();
diff --git a/src/plugins/debugger/debuggerengine.h b/src/plugins/debugger/debuggerengine.h
index 2b5165217d..6eeb167c20 100644
--- a/src/plugins/debugger/debuggerengine.h
+++ b/src/plugins/debugger/debuggerengine.h
@@ -267,6 +267,7 @@ public:
virtual void resetLocation();
virtual void gotoLocation(const Internal::Location &location);
virtual void quitDebugger(); // called by DebuggerRunControl
+ virtual void abortDebugger(); // called by DebuggerPlugin
virtual void updateViews();
bool isSlaveEngine() const;
@@ -342,7 +343,7 @@ protected:
virtual void detachDebugger();
virtual void exitDebugger();
virtual void executeStep();
- virtual void executeStepOut() ;
+ virtual void executeStepOut();
virtual void executeNext();
virtual void executeStepI();
virtual void executeNextI();
diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp
index 739dd37888..60f1bedcf0 100644
--- a/src/plugins/debugger/debuggerplugin.cpp
+++ b/src/plugins/debugger/debuggerplugin.cpp
@@ -809,10 +809,10 @@ public slots:
currentEngine()->requestInterruptInferior();
}
- void handleExecReset()
+ void handleAbort()
{
currentEngine()->resetLocation();
- currentEngine()->notifyEngineIll(); // FIXME: Check.
+ currentEngine()->abortDebugger();
}
void handleExecStep()
@@ -1040,7 +1040,7 @@ public:
QAction *m_exitAction; // On application output button if "Stop" is possible
QAction *m_interruptAction; // On the fat debug button if "Pause" is possible
QAction *m_undisturbableAction; // On the fat debug button if nothing can be done
- QAction *m_resetAction;
+ QAction *m_abortAction;
QAction *m_stepAction;
QAction *m_stepOutAction;
QAction *m_runToLineAction; // In the debug menu
@@ -2070,7 +2070,7 @@ void DebuggerPluginPrivate::setInitialState()
action(OperateByInstruction)->setEnabled(false);
m_exitAction->setEnabled(false);
- m_resetAction->setEnabled(false);
+ m_abortAction->setEnabled(false);
m_interruptAction->setEnabled(false);
m_continueAction->setEnabled(false);
@@ -2201,7 +2201,7 @@ void DebuggerPluginPrivate::updateState(DebuggerEngine *engine)
&& (stopped || isCore);
action(OperateByInstruction)->setEnabled(canOperateByInstruction);
- m_resetAction->setEnabled(state != DebuggerNotReady
+ m_abortAction->setEnabled(state != DebuggerNotReady
&& state != DebuggerFinished);
m_stepAction->setEnabled(stopped || state == DebuggerNotReady);
@@ -2792,10 +2792,10 @@ void DebuggerPluginPrivate::extensionsInitialized()
act->setIcon(m_interruptIcon);
act->setEnabled(false);
- act = m_resetAction = new QAction(tr("Abort Debugging"), this);
+ act = m_abortAction = new QAction(tr("Abort Debugging"), this);
act->setToolTip(tr("Aborts debugging and "
"resets the debugger to the initial state."));
- connect(act, SIGNAL(triggered()), SLOT(handleExecReset()));
+ connect(act, SIGNAL(triggered()), SLOT(handleAbort()));
act = m_nextAction = new QAction(tr("Step Over"), this);
act->setIcon(QIcon(__(":/debugger/images/debugger_stepover_small.png")));
@@ -3063,8 +3063,8 @@ void DebuggerPluginPrivate::extensionsInitialized()
Constants::HIDDEN_STOP, globalcontext);
cmd->setDefaultKeySequence(QKeySequence(Constants::STOP_KEY));
- cmd = am->registerAction(m_resetAction,
- Constants::RESET, globalcontext);
+ cmd = am->registerAction(m_abortAction,
+ Constants::ABORT, globalcontext);
//cmd->setDefaultKeySequence(QKeySequence(Constants::RESET_KEY));
cmd->setDefaultText(tr("Reset Debugger"));
debugMenu->addAction(cmd, CC::G_DEFAULT_ONE);
diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp
index 0356b1f65e..3f24f7475c 100644
--- a/src/plugins/debugger/gdb/gdbengine.cpp
+++ b/src/plugins/debugger/gdb/gdbengine.cpp
@@ -261,8 +261,11 @@ QString GdbEngine::errorMessage(QProcess::ProcessError error)
"permissions to invoke the program.\n%2")
.arg(m_gdb, gdbProc()->errorString());
case QProcess::Crashed:
- return tr("The gdb process crashed some time after starting "
- "successfully.");
+ if (targetState() == DebuggerFinished)
+ return tr("The gdb process crashed some time after starting "
+ "successfully.");
+ else
+ return tr("The gdb process was ended forcefully");
case QProcess::Timedout:
return tr("The last waitFor...() function timed out. "
"The state of QProcess is unchanged, and you can try calling "
@@ -4730,6 +4733,21 @@ void GdbEngine::handleGdbFinished(int code, QProcess::ExitStatus type)
}
}
+void GdbEngine::abortDebugger()
+{
+ if (targetState() == DebuggerFinished) {
+ // We already tried. Try harder.
+ showMessage(_("ABORTING DEBUGGER. SECOND TIME."));
+ QTC_ASSERT(m_gdbAdapter, return);
+ QTC_ASSERT(m_gdbAdapter->gdbProc(), return);
+ m_gdbAdapter->gdbProc()->kill();
+ } else {
+ // Be friendly the first time. This will change targetState().
+ showMessage(_("ABORTING DEBUGGER. FIRST TIME."));
+ quitDebugger();
+ }
+}
+
void GdbEngine::handleAdapterStartFailed(const QString &msg,
const QString &settingsIdHint)
{
diff --git a/src/plugins/debugger/gdb/gdbengine.h b/src/plugins/debugger/gdb/gdbengine.h
index 6dc50b4df8..fc082f49f1 100644
--- a/src/plugins/debugger/gdb/gdbengine.h
+++ b/src/plugins/debugger/gdb/gdbengine.h
@@ -242,6 +242,7 @@ private: ////////// General Interface //////////
virtual void shutdownEngine();
virtual void shutdownInferior();
virtual void notifyInferiorSetupFailed();
+ virtual void abortDebugger();
virtual bool acceptsDebuggerCommands() const;
virtual void executeDebuggerCommand(const QString &command);