Debugger: Move GdbEngine connections to constructor

In constrast to the LldbEngine this did properly disconnect
on restart, but moving it to the constructor avoid the need
to disconnect and follows the intended pattern.

Change-Id: I9a5727c1f6b76c0282de159251803f6ff5e76eb4
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2017-10-27 13:31:57 +02:00
parent f318dcde4b
commit 81677fca97

View File

@@ -211,6 +211,15 @@ GdbEngine::GdbEngine()
connect(action(UseDynamicType), &SavedAction::valueChanged,
this, &GdbEngine::reloadLocals);
connect(&m_gdbProc, &QProcess::errorOccurred,
this, &GdbEngine::handleGdbError);
connect(&m_gdbProc, static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished),
this, &GdbEngine::handleGdbFinished);
connect(&m_gdbProc, &QtcProcess::readyReadStandardOutput,
this, &GdbEngine::readGdbStandardOutput);
connect(&m_gdbProc, &QtcProcess::readyReadStandardError,
this, &GdbEngine::readGdbStandardError);
// Output
connect(&m_outputCollector, &OutputCollector::byteDelivery,
this, &GdbEngine::readDebuggeeOutput);
@@ -3745,7 +3754,6 @@ void GdbEngine::setupEngine()
foreach (int test, m_testCases)
showMessage("ENABLING TEST CASE: " + QString::number(test));
m_gdbProc.disconnect(); // From any previous runs
m_expectTerminalTrap = terminal();
const DebuggerRunParameters &rp = runParameters();
@@ -3762,12 +3770,6 @@ void GdbEngine::setupEngine()
if (!boolSetting(LoadGdbInit))
gdbArgs << "-n";
connect(&m_gdbProc, &QProcess::errorOccurred, this, &GdbEngine::handleGdbError);
connect(&m_gdbProc, static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished),
this, &GdbEngine::handleGdbFinished);
connect(&m_gdbProc, &QtcProcess::readyReadStandardOutput, this, &GdbEngine::readGdbStandardOutput);
connect(&m_gdbProc, &QtcProcess::readyReadStandardError, this, &GdbEngine::readGdbStandardError);
showMessage("STARTING " + rp.debugger.executable + " " + gdbArgs.join(' '));
m_gdbProc.setCommand(rp.debugger.executable, QtcProcess::joinArgs(gdbArgs));
if (QFileInfo(rp.debugger.workingDirectory).isDir())