summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhjk <qtc-committer@nokia.com>2009-10-05 08:56:02 +0200
committerhjk <qtc-committer@nokia.com>2009-10-05 08:56:02 +0200
commit5ab3be8cc43ed08a382cb2e2ce74ceb15709e71b (patch)
tree4115124e419740bc62d7a1effb17418676d2dc74 /src
parentdd09a4a16d9e7b55c3afde27c399c1006670aedb (diff)
downloadqt-creator-5ab3be8cc43ed08a382cb2e2ce74ceb15709e71b.tar.gz
debugger: handle failure of -exec-step gracefully if debug information is
missing.
Diffstat (limited to 'src')
-rw-r--r--src/plugins/debugger/gdb/gdbengine.cpp40
1 files changed, 27 insertions, 13 deletions
diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp
index 74c9b61ef6..3575b61a3f 100644
--- a/src/plugins/debugger/gdb/gdbengine.cpp
+++ b/src/plugins/debugger/gdb/gdbengine.cpp
@@ -793,24 +793,38 @@ void GdbEngine::handleResultRecord(const GdbResponse &response)
return;
if (!m_cookieForToken.contains(token)) {
- // In theory this should not happen, in practice it does.
+ // In theory this should not happen (rather the error should be
+ // reported in the "first" response to the command) in practice it
+ // does. We try to handle a few situations we are aware of gracefully.
+ // Ideally, this code should not be present at all.
debugMessage(_("COOKIE FOR TOKEN %1 ALREADY EATEN. "
"TWO RESPONSES FOR ONE COMMAND?").arg(token));
if (response.resultClass == GdbResultError) {
QByteArray msg = response.data.findChild("msg").data();
- showMessageBox(QMessageBox::Critical,
- tr("Executable failed"), QString::fromLocal8Bit(msg));
- showStatusMessage(tr("Process failed to start."));
- // Handle a case known to occur on Linux/gdb 6.8 when debugging moc
- // with helpers enabled. In this case we get a second response with
- // msg="Cannot find new threads: generic error"
- if (msg == "Cannot find new threads: generic error")
+ if (msg == "Cannot find new threads: generic error") {
+ // Handle a case known to occur on Linux/gdb 6.8 when debugging moc
+ // with helpers enabled. In this case we get a second response with
+ // msg="Cannot find new threads: generic error"
+ showMessageBox(QMessageBox::Critical,
+ tr("Executable failed"), QString::fromLocal8Bit(msg));
+ showStatusMessage(tr("Process failed to start."));
shutdown();
- // Handle a case known to appear on gdb 6.4 symbianelf when
- // the stack is cut due to access to protected memory.
- if (msg == "\"finish\" not meaningful in the outermost frame.") {
+ } else if (msg == "\"finish\" not meaningful in the outermost frame.") {
+ // Handle a case known to appear on gdb 6.4 symbianelf when
+ // the stack is cut due to access to protected memory.
setState(InferiorStopping);
setState(InferiorStopped);
+ } else if (msg.startsWith("Cannot find bounds of current function")) {
+ // Happens when running "-exec-next" in a function for which
+ // there is no debug information. Divert to "-exec-next-step"
+ setState(InferiorStopping);
+ setState(InferiorStopped);
+ nextIExec();
+ } else {
+ showMessageBox(QMessageBox::Critical,
+ tr("Executable failed"), QString::fromLocal8Bit(msg));
+ showStatusMessage(tr("Executable failed: %1")
+ .arg(QString::fromLocal8Bit(msg)));
}
}
return;
@@ -1367,8 +1381,8 @@ void GdbEngine::handleExecContinue(const GdbResponse &response)
QTC_ASSERT(state() == InferiorRunning, /**/);
} else if (response.resultClass == GdbResultError) {
QTC_ASSERT(state() == InferiorRunningRequested, /**/);
- const QByteArray &msg = response.data.findChild("msg").data();
- if (msg == "Cannot find bounds of current function") {
+ QByteArray msg = response.data.findChild("msg").data();
+ if (msg.startsWith("Cannot find bounds of current function")) {
setState(InferiorStopped);
showStatusMessage(tr("Stopped."), 5000);
//showStatusMessage(tr("No debug information available. "