debugger: fix "unexpected" state changes when aborting the debugger

Change-Id: Icec2e3333eb019c51ab32e7bb10887dec1ce9e16
Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
hjk
2011-10-31 16:15:48 +01:00
committed by hjk
parent 71dfe61c88
commit 7ed1064971
7 changed files with 44 additions and 14 deletions

View File

@@ -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 "
@@ -4751,6 +4754,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)
{