Debugger: Fix Windows terminal execution.

The console trap seems to cause a spurious "* stopped"
message without reasons in gdb 7.4. Ignore once.
Fix warnings about empty file names in cleanupFullName()
for assembly frames.
Ignore "* running" in state InferiorSetupRequested, which
occurs for Windows terminals.

Task-number: QTCREATORBUG-7770
Change-Id: Ief6dff4a946eea1b1489caddf8748fb10a647dad
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
Friedemann Kleint
2012-08-29 11:42:28 +02:00
committed by hjk
parent 4dc6be6d43
commit 3e0950bd86
2 changed files with 26 additions and 19 deletions

View File

@@ -258,7 +258,7 @@ GdbEngine::GdbEngine(const DebuggerStartParameters &startParameters)
m_stackNeeded = false; m_stackNeeded = false;
m_preparedForQmlBreak = false; m_preparedForQmlBreak = false;
m_disassembleUsesComma = false; m_disassembleUsesComma = false;
m_actingOnExpectedStop = false; m_terminalTrap = startParameters.useTerminal;
m_fullStartDone = false; m_fullStartDone = false;
m_forceAsyncModel = false; m_forceAsyncModel = false;
@@ -466,9 +466,10 @@ 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") {
if (state() == InferiorRunOk) { if (state() == InferiorRunOk || state() == InferiorSetupRequested) {
// We get multiple *running after thread creation. // We get multiple *running after thread creation and in Windows terminals.
showMessage(_("NOTE: INFERIOR STILL RUNNING.")); showMessage(QString::fromLatin1("NOTE: INFERIOR STILL RUNNING IN STATE %1.").
arg(QLatin1String(DebuggerEngine::stateName(state()))));
} else { } else {
notifyInferiorRunOk(); notifyInferiorRunOk();
} }
@@ -1375,9 +1376,15 @@ void GdbEngine::handleAqcuiredInferior()
void GdbEngine::handleStopResponse(const GdbMi &data) void GdbEngine::handleStopResponse(const GdbMi &data)
{ {
// Ignore trap on Windows terminals, which results in
// spurious "* stopped" message.
if (!data.isValid() && m_terminalTrap && Abi::hostAbi().os() == Abi::WindowsOS) {
m_terminalTrap = false;
showMessage(_("IGNORING TERMINAL SIGTRAP"), LogMisc);
return;
}
// This is gdb 7+'s initial *stopped in response to attach. // This is gdb 7+'s initial *stopped in response to attach.
// For consistency, we just discard it. // For consistency, we just discard it.
m_actingOnExpectedStop = false;
if (state() == InferiorSetupRequested) if (state() == InferiorSetupRequested)
return; return;
@@ -1420,11 +1427,19 @@ void GdbEngine::handleStopResponse(const GdbMi &data)
BreakpointResponseId rid(data.findChild("bkptno").data()); BreakpointResponseId rid(data.findChild("bkptno").data());
const GdbMi frame = data.findChild("frame"); const GdbMi frame = data.findChild("frame");
const int lineNumber = frame.findChild("line").data().toInt(); int lineNumber = 0;
QString fullName = cleanupFullName(QString::fromLocal8Bit(frame.findChild("fullname").data())); QString fullName;
if (frame.isValid()) {
const GdbMi lineNumberG = frame.findChild("line");
if (lineNumberG.isValid()) {
lineNumber = lineNumberG.data().toInt();
fullName = cleanupFullName(QString::fromLocal8Bit(frame.findChild("fullname").data()));
if (fullName.isEmpty()) if (fullName.isEmpty())
fullName = QString::fromLocal8Bit(frame.findChild("file").data()); fullName = QString::fromLocal8Bit(frame.findChild("file").data());
} // found line number
} else {
showMessage(_("INVALID STOPPED REASON"), LogWarning);
}
if (rid.isValid() && frame.isValid() if (rid.isValid() && frame.isValid()
&& !isQmlStepBreakpoint(rid) && !isQmlStepBreakpoint(rid)
@@ -1455,7 +1470,6 @@ void GdbEngine::handleStopResponse(const GdbMi &data)
if (!m_commandsToRunOnTemporaryBreak.isEmpty()) { if (!m_commandsToRunOnTemporaryBreak.isEmpty()) {
QTC_ASSERT(state() == InferiorStopRequested, qDebug() << state()); QTC_ASSERT(state() == InferiorStopRequested, qDebug() << state());
m_actingOnExpectedStop = true;
notifyInferiorStopOk(); notifyInferiorStopOk();
flushQueuedCommands(); flushQueuedCommands();
if (state() == InferiorStopOk) { if (state() == InferiorStopOk) {
@@ -1488,7 +1502,6 @@ void GdbEngine::handleStopResponse(const GdbMi &data)
// That's expected. // That's expected.
} else { } else {
QTC_ASSERT(state() == InferiorStopRequested, qDebug() << state()); QTC_ASSERT(state() == InferiorStopRequested, qDebug() << state());
m_actingOnExpectedStop = true;
notifyInferiorStopOk(); notifyInferiorStopOk();
} }
@@ -1655,12 +1668,6 @@ void GdbEngine::handleStop2(const GdbMi &data)
&& reason == "signal-received" && reason == "signal-received"
&& data.findChild("signal-name").data() == "SIGTRAP") && data.findChild("signal-name").data() == "SIGTRAP")
{ {
if (!m_actingOnExpectedStop) {
// Ignore signals from command line start up traps.
showMessage(_("INTERNAL CONTINUE AFTER SIGTRAP"), LogMisc);
continueInferiorInternal();
return;
}
// This is the stopper thread. That also means that the // This is the stopper thread. That also means that the
// reported thread is not the one we'd like to expose // reported thread is not the one we'd like to expose
// to the user. // to the user.

View File

@@ -686,7 +686,7 @@ protected:
QString m_lastWinException; QString m_lastWinException;
QString m_lastMissingDebugInfo; QString m_lastMissingDebugInfo;
BreakpointResponseId m_qFatalBreakpointResponseId; BreakpointResponseId m_qFatalBreakpointResponseId;
bool m_actingOnExpectedStop; bool m_terminalTrap;
bool usesExecInterrupt() const; bool usesExecInterrupt() const;