Commit 890e7546 authored by David Schulz's avatar David Schulz

Debugger: Merge prepareCommand

Change-Id: Idd316a88ae39d563c99d3b4081f88fc41e604499
Reviewed-by: default avatarhjk <hjk@qt.io>
parent 88897f3a
......@@ -65,6 +65,7 @@
#include <utils/macroexpander.h>
#include <utils/processhandle.h>
#include <utils/qtcassert.h>
#include <utils/qtcprocess.h>
#include <utils/savedaction.h>
#include <QDebug>
......@@ -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);
......
......@@ -338,6 +338,8 @@ public:
QString expand(const QString &string) const;
QString nativeStartupCommands() const;
bool prepareCommand();
signals:
void stateChanged(Debugger::DebuggerState state);
/*
......
......@@ -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);
......
......@@ -418,7 +418,6 @@ protected:
DebuggerCommand m_lastDebuggableCommand;
protected:
bool prepareCommand();
void interruptLocalInferior(qint64 pid);
protected:
......
......@@ -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.
......
......@@ -163,7 +163,6 @@ private:
void stubError(const QString &msg);
void stubExited();
void stubStarted();
bool prepareCommand();
Utils::ConsoleProcess m_stubProc;
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment