GdbEngine: Connect to QtcProcess::done() signal

Instead of connecting to errorOccurred() and finished() signals.

Change-Id: Icf3e3d8cfdae3890cb4991da8b7d7e74e529ad39
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Jarek Kobus
2022-04-14 10:39:51 +02:00
parent a26f0ba808
commit 876047d6cf
2 changed files with 17 additions and 33 deletions

View File

@@ -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();
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);
// 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;
}
}
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();

View File

@@ -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);