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>
This commit is contained in:
hjk
2011-10-31 17:36:08 +01:00
committed by hjk
parent 384a8ed1cf
commit 755f5fc327
6 changed files with 43 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 "
@@ -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)
{