forked from qt-creator/qt-creator
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:
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user