debugger: work on handling gdb crashes gracefully

This commit is contained in:
hjk
2009-09-25 11:06:51 +02:00
parent 978cf4bda8
commit 00f676708b
13 changed files with 93 additions and 68 deletions

View File

@@ -59,7 +59,7 @@ PlainGdbAdapter::PlainGdbAdapter(GdbEngine *engine, QObject *parent)
{
QTC_ASSERT(state() == DebuggerNotReady, qDebug() << state());
connect(&m_gdbProc, SIGNAL(error(QProcess::ProcessError)),
this, SIGNAL(error(QProcess::ProcessError)));
this, SLOT(handleGdbError(QProcess::ProcessError)));
connect(&m_gdbProc, SIGNAL(readyReadStandardOutput()),
this, SIGNAL(readyReadStandardOutput()));
connect(&m_gdbProc, SIGNAL(readyReadStandardError()),
@@ -118,9 +118,7 @@ void PlainGdbAdapter::startAdapter()
setEnvironment(startParameters().environment);
}
QString location = theDebuggerStringSetting(GdbLocation);
//showStatusMessage(tr("Starting Debugger: ") + loc + _c(' ') + gdbArgs.join(_(" ")));
m_gdbProc.start(location, gdbArgs);
m_gdbProc.start(theDebuggerStringSetting(GdbLocation), gdbArgs);
}
void PlainGdbAdapter::handleGdbStarted()
@@ -130,6 +128,12 @@ void PlainGdbAdapter::handleGdbStarted()
emit adapterStarted();
}
void PlainGdbAdapter::handleGdbError(QProcess::ProcessError error)
{
debugMessage(_("PLAIN ADAPTER, HANDLE GDB ERROR"));
emit adapterCrashed(m_engine->errorMessage(error));
}
void PlainGdbAdapter::prepareInferior()
{
QTC_ASSERT(state() == AdapterStarted, qDebug() << state());
@@ -238,6 +242,7 @@ void PlainGdbAdapter::interruptInferior()
void PlainGdbAdapter::shutdown()
{
debugMessage(_("PLAIN ADAPTER SHUTDOWN %1").arg(state()));
switch (state()) {
case InferiorRunningRequested:
@@ -275,6 +280,7 @@ void PlainGdbAdapter::shutdown()
void PlainGdbAdapter::handleKill(const GdbResponse &response)
{
debugMessage(_("PLAIN ADAPTER HANDLE KILL " + response.toString()));
if (response.resultClass == GdbResultDone) {
setState(InferiorShutDown);
emit inferiorShutDown();
@@ -300,8 +306,7 @@ void PlainGdbAdapter::handleExit(const GdbResponse &response)
void PlainGdbAdapter::handleGdbFinished(int, QProcess::ExitStatus)
{
debugMessage(_("GDB PROESS FINISHED"));
setState(DebuggerNotReady);
debugMessage(_("GDB PROCESS FINISHED"));
emit adapterShutDown();
}