forked from qt-creator/qt-creator
Debugger: Combine some gdb startup code paths
After splitting out terminal and core handling they are essentially the same. Change-Id: I603cea74186eada5728295b430c9385812dcc4cd Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -3719,8 +3719,24 @@ static SourcePathMap mergeStartParametersSourcePathMap(const DebuggerRunParamete
|
|||||||
// Starting up & shutting down
|
// Starting up & shutting down
|
||||||
//
|
//
|
||||||
|
|
||||||
void GdbEngine::startGdb(const QStringList &args)
|
void GdbEngine::setupEngine()
|
||||||
{
|
{
|
||||||
|
CHECK_STATE(EngineSetupRequested);
|
||||||
|
showMessage("TRYING TO START ADAPTER");
|
||||||
|
|
||||||
|
if (isRemoteEngine() && HostOsInfo::isWindowsHost())
|
||||||
|
m_gdbProc.setUseCtrlCStub(runParameters().useCtrlCStub); // This is only set for QNX
|
||||||
|
|
||||||
|
QStringList gdbArgs;
|
||||||
|
if (isPlainEngine()) {
|
||||||
|
if (!m_outputCollector.listen()) {
|
||||||
|
handleAdapterStartFailed(tr("Cannot set up communication with child process: %1")
|
||||||
|
.arg(m_outputCollector.errorString()));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
gdbArgs.append("--tty=" + m_outputCollector.serverName());
|
||||||
|
}
|
||||||
|
|
||||||
const QString tests = QString::fromLocal8Bit(qgetenv("QTC_DEBUGGER_TESTS"));
|
const QString tests = QString::fromLocal8Bit(qgetenv("QTC_DEBUGGER_TESTS"));
|
||||||
foreach (const QStringRef &test, tests.splitRef(QLatin1Char(',')))
|
foreach (const QStringRef &test, tests.splitRef(QLatin1Char(',')))
|
||||||
m_testCases.insert(test.toInt());
|
m_testCases.insert(test.toInt());
|
||||||
@@ -3739,12 +3755,10 @@ void GdbEngine::startGdb(const QStringList &args)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList gdbArgs;
|
|
||||||
gdbArgs << "-i";
|
gdbArgs << "-i";
|
||||||
gdbArgs << "mi";
|
gdbArgs << "mi";
|
||||||
if (!boolSetting(LoadGdbInit))
|
if (!boolSetting(LoadGdbInit))
|
||||||
gdbArgs << "-n";
|
gdbArgs << "-n";
|
||||||
gdbArgs += args;
|
|
||||||
|
|
||||||
connect(&m_gdbProc, &QProcess::errorOccurred, this, &GdbEngine::handleGdbError);
|
connect(&m_gdbProc, &QProcess::errorOccurred, this, &GdbEngine::handleGdbError);
|
||||||
connect(&m_gdbProc, static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished),
|
connect(&m_gdbProc, static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished),
|
||||||
@@ -4245,52 +4259,6 @@ bool GdbEngine::isTermEngine() const
|
|||||||
return !isCoreEngine() && !isAttachEngine() && !isRemoteEngine() && terminal();
|
return !isCoreEngine() && !isAttachEngine() && !isRemoteEngine() && terminal();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GdbEngine::setupEngine()
|
|
||||||
{
|
|
||||||
m_startMode = runParameters().startMode;
|
|
||||||
|
|
||||||
CHECK_STATE(EngineSetupRequested);
|
|
||||||
showMessage("TRYING TO START ADAPTER");
|
|
||||||
|
|
||||||
if (isAttachEngine()) {
|
|
||||||
|
|
||||||
startGdb();
|
|
||||||
|
|
||||||
} else if (isRemoteEngine()) {
|
|
||||||
|
|
||||||
if (HostOsInfo::isWindowsHost())
|
|
||||||
m_gdbProc.setUseCtrlCStub(runParameters().useCtrlCStub); // This is only set for QNX
|
|
||||||
|
|
||||||
startGdb();
|
|
||||||
|
|
||||||
} else if (isTermEngine()) {
|
|
||||||
|
|
||||||
showMessage("TRYING TO START ADAPTER");
|
|
||||||
|
|
||||||
startGdb();
|
|
||||||
|
|
||||||
} else if (isCoreEngine()) {
|
|
||||||
|
|
||||||
CHECK_STATE(EngineSetupRequested);
|
|
||||||
showMessage("TRYING TO START ADAPTER");
|
|
||||||
|
|
||||||
startGdb();
|
|
||||||
|
|
||||||
} else if (isPlainEngine()) {
|
|
||||||
|
|
||||||
QStringList gdbArgs;
|
|
||||||
|
|
||||||
if (!m_outputCollector.listen()) {
|
|
||||||
handleAdapterStartFailed(tr("Cannot set up communication with child process: %1")
|
|
||||||
.arg(m_outputCollector.errorString()));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
gdbArgs.append("--tty=" + m_outputCollector.serverName());
|
|
||||||
|
|
||||||
startGdb(gdbArgs);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void GdbEngine::setupInferior()
|
void GdbEngine::setupInferior()
|
||||||
{
|
{
|
||||||
CHECK_STATE(InferiorSetupRequested);
|
CHECK_STATE(InferiorSetupRequested);
|
||||||
|
@@ -96,7 +96,6 @@ private: ////////// General Interface //////////
|
|||||||
|
|
||||||
////////// Gdb Process Management //////////
|
////////// Gdb Process Management //////////
|
||||||
|
|
||||||
void startGdb(const QStringList &args = QStringList());
|
|
||||||
void handleInferiorShutdown(const DebuggerResponse &response);
|
void handleInferiorShutdown(const DebuggerResponse &response);
|
||||||
void handleGdbExit(const DebuggerResponse &response);
|
void handleGdbExit(const DebuggerResponse &response);
|
||||||
void setLinuxOsAbi();
|
void setLinuxOsAbi();
|
||||||
|
Reference in New Issue
Block a user