Debugger: Use Utils::CommandLine for gdb process

Change-Id: I3744ae33a26f868c22730d144738526ba5d6b154
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2019-06-04 15:44:59 +02:00
parent da6f4901f0
commit 95a89b5615

View File

@@ -3523,14 +3523,16 @@ void GdbEngine::setupEngine()
if (isRemoteEngine() && HostOsInfo::isWindowsHost())
m_gdbProc.setUseCtrlCStub(runParameters().useCtrlCStub); // This is only set for QNX
QStringList gdbArgs;
const DebuggerRunParameters &rp = runParameters();
CommandLine gdbCommand{FilePath::fromString(rp.debugger.executable), {}};
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());
gdbCommand.addArg("--tty=" + m_outputCollector.serverName());
}
const QString tests = QString::fromLocal8Bit(qgetenv("QTC_DEBUGGER_TESTS"));
@@ -3541,7 +3543,6 @@ void GdbEngine::setupEngine()
m_expectTerminalTrap = terminal();
const DebuggerRunParameters &rp = runParameters();
if (rp.debugger.executable.isEmpty()) {
handleGdbStartFailed();
handleAdapterStartFailed(
@@ -3550,14 +3551,12 @@ void GdbEngine::setupEngine()
return;
}
gdbArgs << "-i";
gdbArgs << "mi";
gdbCommand.addArgs("-i mi");
if (!boolSetting(LoadGdbInit))
gdbArgs << "-n";
gdbCommand.addArg("-n");
showMessage("STARTING " + rp.debugger.executable + " " + gdbArgs.join(' '));
m_gdbProc.setCommand(CommandLine(FilePath::fromString(rp.debugger.executable),
QtcProcess::joinArgs(gdbArgs)));
showMessage("STARTING " + gdbCommand.toUserOutput());
m_gdbProc.setCommand(gdbCommand);
if (QFileInfo(rp.debugger.workingDirectory).isDir())
m_gdbProc.setWorkingDirectory(rp.debugger.workingDirectory);
m_gdbProc.setEnvironment(rp.debugger.environment);