Commit 0a560b10 authored by hjk's avatar hjk

debugger: work around a bug in gdb/MI in gdb 6.8/Ubuntu

When trying to debug qmake or another bootstrapped application loading the
dumpers failed as they are binarily incompatible. So failing is expected and
fine. However, gdb 6.8-debian produces in this case _two_ responses for
'-exec-continue produces' ('^running' and '^error,msg="Cannot find new threads:
generic error"') which is impossible according to the MI docs. In theory...
parent db96f274
......@@ -762,6 +762,25 @@ void GdbEngine::handleResultRecord(const GdbResultRecord &record)
if (token == -1)
return;
if (!m_cookieForToken.contains(token)) {
// In theory this should not happen, in practice it does.
debugMessage(_("COOKIE FOR TOKEN %1 ALREADY EATEN. "
"TWO RESPONSES FOR ONE COMMAND?").arg(token));
// 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 (record.resultClass == GdbResultError) {
QByteArray msg = record.data.findChild("msg").data();
QMessageBox::critical(q->mainWindow(), tr("Error"),
tr("Executable failed:\n") + QString::fromLocal8Bit(msg));
q->showStatusMessage(tr("Process failed to start."));
exitDebugger();
//qq->notifyInferiorStopped();
//qq->notifyInferiorExited();
}
return;
}
GdbCommand cmd = m_cookieForToken.take(token);
if (theDebuggerBoolSetting(LogTimeStamps)) {
emit gdbOutputAvailable(LogTime, _("Response time: %1: %2 s")
......@@ -1162,7 +1181,7 @@ void GdbEngine::handleAsyncOutput(const GdbMi &data)
GdbMi frameData = data.findChild("frame");
if (frameData.findChild("func").data() == "_start"
&& frameData.findChild("from").data() == "/lib/ld-linux.so.2") {
postCommand(_("-exec-continue"));
postCommand(_("-exec-continue"), CB(handleExecContinue));
return;
}
}
......@@ -1812,7 +1831,7 @@ void GdbEngine::runToFunctionExec(const QString &functionName)
qq->notifyInferiorRunningRequested();
// that should be "^running". We need to handle the resulting
// "Stopped"
postCommand(_("-exec-continue"));
postCommand(_("-exec-continue"), CB(handleExecContinue));
//postCommand(_("-exec-continue"), handleExecRunToFunction);
}
......
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