diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index d71a87afacd..1806339162b 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -167,10 +167,8 @@ GdbEngine::GdbEngine() connect(&s.useDynamicType, &BaseAspect::changed, this, &GdbEngine::reloadLocals); - connect(&m_gdbProc, &QtcProcess::errorOccurred, - this, &GdbEngine::handleGdbError); - connect(&m_gdbProc, &QtcProcess::finished, - this, &GdbEngine::handleGdbFinished); + connect(&m_gdbProc, &QtcProcess::done, + this, &GdbEngine::handleGdbDone); connect(&m_gdbProc, &QtcProcess::readyReadStandardOutput, this, &GdbEngine::readGdbStandardOutput); connect(&m_gdbProc, &QtcProcess::readyReadStandardError, @@ -4074,35 +4072,22 @@ void GdbEngine::reloadDebuggingHelpers() reloadLocals(); } -void GdbEngine::handleGdbError(QProcess::ProcessError error) +void GdbEngine::handleGdbDone() { - QString msg = RunWorker::userMessageForProcessError(error, runParameters().debugger.command.executable()); - QString errorString = m_gdbProc.errorString(); - if (!errorString.isEmpty()) - msg += '\n' + errorString; - showMessage("HANDLE GDB ERROR: " + msg); - // Show a message box for asynchronously reported issues. - switch (error) { - case QProcess::FailedToStart: - // This should be handled by the code trying to start the process. - break; - case QProcess::Crashed: - // At this time, m_gdbProc.state() can still return Running. - // Wait for finished() instead. - break; - case QProcess::ReadError: - case QProcess::WriteError: - case QProcess::Timedout: - default: - //m_gdbProc->kill(); - //notifyEngineIll(); - AsynchronousMessageBox::critical(tr("GDB I/O Error"), msg); - break; - } -} + const QProcess::ProcessError error = m_gdbProc.error(); + if (error != QProcess::UnknownError) { + QString msg = RunWorker::userMessageForProcessError(error, + runParameters().debugger.command.executable()); + const QString errorString = m_gdbProc.errorString(); + if (!errorString.isEmpty()) + msg += '\n' + errorString; + showMessage("HANDLE GDB ERROR: " + msg); -void GdbEngine::handleGdbFinished() -{ + if (error == QProcess::FailedToStart) + return; // This should be handled by the code trying to start the process. + + AsynchronousMessageBox::critical(tr("GDB I/O Error"), msg); + } if (m_commandTimer.isActive()) m_commandTimer.stop(); diff --git a/src/plugins/debugger/gdb/gdbengine.h b/src/plugins/debugger/gdb/gdbengine.h index 54ee843ed23..a8dd2882e0d 100644 --- a/src/plugins/debugger/gdb/gdbengine.h +++ b/src/plugins/debugger/gdb/gdbengine.h @@ -111,8 +111,7 @@ private: ////////// General Interface ////////// // The engine is still running just fine, but it failed to acquire a debuggee. void notifyInferiorSetupFailedHelper(const QString &msg); - void handleGdbFinished(); - void handleGdbError(QProcess::ProcessError error); + void handleGdbDone(); void readGdbStandardOutput(); void readGdbStandardError(); void readDebuggeeOutput(const QByteArray &ba);