diff --git a/src/plugins/debugger/debuggerengine.cpp b/src/plugins/debugger/debuggerengine.cpp index 58f2ae00540..1436c45d07c 100644 --- a/src/plugins/debugger/debuggerengine.cpp +++ b/src/plugins/debugger/debuggerengine.cpp @@ -65,6 +65,7 @@ #include #include #include +#include #include #include @@ -1360,6 +1361,30 @@ QString DebuggerEngine::nativeStartupCommands() const runParameters().additionalStartupCommands}).join('\n')); } +bool DebuggerEngine::prepareCommand() +{ + if (HostOsInfo::isWindowsHost()) { + DebuggerRunParameters &rp = runParameters(); + QtcProcess::SplitError perr; + rp.inferior.commandLineArguments = + QtcProcess::prepareArgs(rp.inferior.commandLineArguments, &perr, + HostOsInfo::hostOs(), nullptr, + &rp.inferior.workingDirectory).toWindowsArgs(); + if (perr != QtcProcess::SplitOk) { + // perr == BadQuoting is never returned on Windows + // FIXME? QTCREATORBUG-2809 + showMessage("ADAPTER START FAILED"); + const QString title = tr("Adapter start failed"); + const QString msg = tr("Debugging complex command lines " + "is currently not supported on Windows."); + ICore::showWarningWithOptions(title, msg); + notifyEngineSetupFailed(); + return false; + } + } + return true; +} + void DebuggerEngine::updateBreakpointMarker(const Breakpoint &bp) { d->m_disassemblerAgent.updateBreakpointMarker(bp); diff --git a/src/plugins/debugger/debuggerengine.h b/src/plugins/debugger/debuggerengine.h index f25740b3170..88ab9dc2d27 100644 --- a/src/plugins/debugger/debuggerengine.h +++ b/src/plugins/debugger/debuggerengine.h @@ -338,6 +338,8 @@ public: QString expand(const QString &string) const; QString nativeStartupCommands() const; + bool prepareCommand(); + signals: void stateChanged(Debugger::DebuggerState state); /* diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index db71ce6ecc1..9bbbda7dd36 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -4300,26 +4300,6 @@ void GdbEngine::requestDebugInformation(const DebugInfoTask &task) QProcess::startDetached(task.command); } -bool GdbEngine::prepareCommand() -{ - if (HostOsInfo::isWindowsHost()) { - DebuggerRunParameters &rp = runParameters(); - QtcProcess::SplitError perr; - rp.inferior.commandLineArguments = - QtcProcess::prepareArgs(rp.inferior.commandLineArguments, &perr, - HostOsInfo::hostOs(), nullptr, - &rp.inferior.workingDirectory).toWindowsArgs(); - if (perr != QtcProcess::SplitOk) { - // perr == BadQuoting is never returned on Windows - // FIXME? QTCREATORBUG-2809 - handleAdapterStartFailed(QCoreApplication::translate("DebuggerEngine", // Same message in CdbEngine - "Debugging complex command lines is currently not supported on Windows."), Id()); - return false; - } - } - return true; -} - QString GdbEngine::msgGdbStopFailed(const QString &why) { return tr("The gdb process could not be stopped:\n%1").arg(why); diff --git a/src/plugins/debugger/gdb/gdbengine.h b/src/plugins/debugger/gdb/gdbengine.h index 169bef5aba2..45b99ec398d 100644 --- a/src/plugins/debugger/gdb/gdbengine.h +++ b/src/plugins/debugger/gdb/gdbengine.h @@ -418,7 +418,6 @@ protected: DebuggerCommand m_lastDebuggableCommand; protected: - bool prepareCommand(); void interruptLocalInferior(qint64 pid); protected: diff --git a/src/plugins/debugger/lldb/lldbengine.cpp b/src/plugins/debugger/lldb/lldbengine.cpp index c94a31d5a92..24bad856adc 100644 --- a/src/plugins/debugger/lldb/lldbengine.cpp +++ b/src/plugins/debugger/lldb/lldbengine.cpp @@ -176,25 +176,6 @@ void LldbEngine::abortDebugger() } } -// FIXME: Merge with GdbEngine/QtcProcess -bool LldbEngine::prepareCommand() -{ - if (HostOsInfo::isWindowsHost()) { - DebuggerRunParameters &rp = runParameters(); - QtcProcess::SplitError perr; - rp.inferior.commandLineArguments - = QtcProcess::prepareArgs(rp.inferior.commandLineArguments, &perr, HostOsInfo::hostOs(), - nullptr, &rp.inferior.workingDirectory).toWindowsArgs(); - if (perr != QtcProcess::SplitOk) { - // perr == BadQuoting is never returned on Windows - // FIXME? QTCREATORBUG-2809 - notifyEngineSetupFailed(); - return false; - } - } - return true; -} - void LldbEngine::setupEngine() { // FIXME: We can't handle terminals yet. @@ -226,10 +207,8 @@ void LldbEngine::setupEngine() // m_stubProc.stop(); // m_stubProc.blockSignals(false); - if (!prepareCommand()) { - notifyEngineSetupFailed(); + if (!prepareCommand()) return; - } m_stubProc.setWorkingDirectory(runParameters().inferior.workingDirectory); // Set environment + dumper preload. diff --git a/src/plugins/debugger/lldb/lldbengine.h b/src/plugins/debugger/lldb/lldbengine.h index eb653b48a5b..2b5d7b0b619 100644 --- a/src/plugins/debugger/lldb/lldbengine.h +++ b/src/plugins/debugger/lldb/lldbengine.h @@ -163,7 +163,6 @@ private: void stubError(const QString &msg); void stubExited(); void stubStarted(); - bool prepareCommand(); Utils::ConsoleProcess m_stubProc; };