QmlDebug: Allow different styles of command line arguments

We have tcp, local, and native by now. We have to expose that in a
clean way.

Change-Id: I0ce7be693aa7f47ebea7abe435a224a176b6c94b
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
This commit is contained in:
Ulf Hermann
2015-11-17 16:40:27 +01:00
parent e1dd3cf701
commit 2217eef3a3
9 changed files with 32 additions and 18 deletions

View File

@@ -60,18 +60,31 @@ static inline QString qmlDebugServices(QmlDebugServicesPreset preset)
} }
static inline QString qmlDebugCommandLineArguments(QmlDebugServicesPreset services, static inline QString qmlDebugCommandLineArguments(QmlDebugServicesPreset services,
quint16 port = 0) const QString &connectionMode, bool block)
{ {
if (services == NoQmlDebugServices) if (services == NoQmlDebugServices)
return QString(); return QString();
if (services == QmlNativeDebuggerServices) return QString::fromLatin1("-qmljsdebugger=%1%2,services:%3").arg(connectionMode)
return QString::fromLatin1("-qmljsdebugger=native,services:%1") .arg(QLatin1String(block ? ",block" : "")).arg(qmlDebugServices(services));
.arg(qmlDebugServices(services)); }
return QString::fromLatin1("-qmljsdebugger=port:%1,block,services:%2") static inline QString qmlDebugTcpArguments(QmlDebugServicesPreset services, quint16 port = 0,
.arg(port ? QString::number(port) : QStringLiteral("%qml_port%")) bool block = true)
.arg(qmlDebugServices(services)); {
return qmlDebugCommandLineArguments(services, port ? QString::fromLatin1("port:%1").arg(port) :
QStringLiteral("port:%qml_port%"), block);
}
static inline QString qmlDebugNativeArguments(QmlDebugServicesPreset services, bool block = true)
{
return qmlDebugCommandLineArguments(services, QLatin1String("native"), block);
}
static inline QString qmlDebugLocalArguments(QmlDebugServicesPreset services, const QString &socket,
bool block = true)
{
return qmlDebugCommandLineArguments(services, QLatin1String("file:") + socket, block);
} }
} // namespace QmlDebug } // namespace QmlDebug

View File

@@ -532,7 +532,9 @@ void DebuggerRunControlCreator::enrich(const RunConfiguration *runConfig, const
service = QmlDebug::QmlDebuggerServices; service = QmlDebug::QmlDebuggerServices;
} }
if (m_rp.startMode != AttachExternal) if (m_rp.startMode != AttachExternal)
QtcProcess::addArg(&m_rp.processArgs, QmlDebug::qmlDebugCommandLineArguments(service, m_rp.qmlServerPort)); QtcProcess::addArg(&m_rp.processArgs, wantCppDebugger && m_rp.nativeMixedEnabled ?
QmlDebug::qmlDebugNativeArguments(service, false) :
QmlDebug::qmlDebugTcpArguments(service, m_rp.qmlServerPort));
} }
} }

View File

@@ -82,7 +82,7 @@ QStringList IosRunner::extraArgs()
{ {
QStringList res = m_arguments; QStringList res = m_arguments;
if (m_qmlPort != 0) if (m_qmlPort != 0)
res << QmlDebug::qmlDebugCommandLineArguments(m_qmlDebugServices, m_qmlPort); res << QmlDebug::qmlDebugTcpArguments(m_qmlDebugServices, m_qmlPort);
return res; return res;
} }

View File

@@ -121,8 +121,8 @@ LocalQmlProfilerRunner::~LocalQmlProfilerRunner()
void LocalQmlProfilerRunner::start() void LocalQmlProfilerRunner::start()
{ {
QString arguments = QmlDebug::qmlDebugCommandLineArguments(QmlDebug::QmlProfilerServices, QString arguments = QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlProfilerServices,
m_configuration.port); m_configuration.port);
if (!m_configuration.executableArguments.isEmpty()) if (!m_configuration.executableArguments.isEmpty())
arguments += QLatin1Char(' ') + m_configuration.executableArguments; arguments += QLatin1Char(' ') + m_configuration.executableArguments;

View File

@@ -99,7 +99,7 @@ void QnxAnalyzeSupport::startExecution()
const QStringList args = QStringList() const QStringList args = QStringList()
<< Utils::QtcProcess::splitArgs(m_runControl->startParameters().debuggeeArgs) << Utils::QtcProcess::splitArgs(m_runControl->startParameters().debuggeeArgs)
<< QmlDebug::qmlDebugCommandLineArguments(QmlDebug::QmlProfilerServices, m_qmlPort); << QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlProfilerServices, m_qmlPort);
appRunner()->setEnvironment(environment()); appRunner()->setEnvironment(environment());
appRunner()->setWorkingDirectory(workingDirectory()); appRunner()->setWorkingDirectory(workingDirectory());

View File

@@ -106,7 +106,7 @@ void QnxDebugSupport::startExecution()
if (m_useQmlDebugger) if (m_useQmlDebugger)
m_runControl->startParameters().processArgs += m_runControl->startParameters().processArgs +=
QmlDebug::qmlDebugCommandLineArguments(QmlDebug::QmlDebuggerServices, m_qmlPort); QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlDebuggerServices, m_qmlPort);
QStringList arguments; QStringList arguments;
if (m_useCppDebugger) if (m_useCppDebugger)

View File

@@ -157,7 +157,7 @@ void RemoteLinuxAnalyzeSupport::startExecution()
this, &RemoteLinuxAnalyzeSupport::handleAppRunnerError); this, &RemoteLinuxAnalyzeSupport::handleAppRunnerError);
const QStringList args = arguments() const QStringList args = arguments()
<< QmlDebug::qmlDebugCommandLineArguments(QmlDebug::QmlProfilerServices, d->qmlPort); << QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlProfilerServices, d->qmlPort);
runner->setWorkingDirectory(workingDirectory()); runner->setWorkingDirectory(workingDirectory());
runner->setEnvironment(environment()); runner->setEnvironment(environment());

View File

@@ -102,7 +102,7 @@ DebuggerStartParameters LinuxDeviceDebugSupport::startParameters(const AbstractR
aspect->setUseMultiProcess(true); aspect->setUseMultiProcess(true);
QStringList args = runConfig->arguments(); QStringList args = runConfig->arguments();
if (aspect->useQmlDebugger()) if (aspect->useQmlDebugger())
args.prepend(QmlDebug::qmlDebugCommandLineArguments(QmlDebug::QmlDebuggerServices)); args.prepend(QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlDebuggerServices));
params.processArgs = Utils::QtcProcess::joinArgs(args, Utils::OsTypeLinux); params.processArgs = Utils::QtcProcess::joinArgs(args, Utils::OsTypeLinux);
params.executable = runConfig->localExecutableFilePath(); params.executable = runConfig->localExecutableFilePath();
@@ -166,8 +166,7 @@ void LinuxDeviceDebugSupport::startExecution()
QString command; QString command;
if (d->qmlDebugging) if (d->qmlDebugging)
args.prepend(QmlDebug::qmlDebugCommandLineArguments(QmlDebug::QmlDebuggerServices, args.prepend(QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlDebuggerServices, d->qmlPort));
d->qmlPort));
if (d->qmlDebugging && !d->cppDebugging) { if (d->qmlDebugging && !d->cppDebugging) {
command = remoteFilePath(); command = remoteFilePath();

View File

@@ -114,7 +114,7 @@ RunControl *WinRtDebugSupport::createDebugRunControl(WinRtRunConfiguration *runC
if (!getFreePort(qmlDebugPort, errorMessage)) if (!getFreePort(qmlDebugPort, errorMessage))
return 0; return 0;
runConfig->setArguments(runConfig->arguments() + QLatin1Char(' ') runConfig->setArguments(runConfig->arguments() + QLatin1Char(' ')
+ QmlDebug::qmlDebugCommandLineArguments(QmlDebug::QmlDebuggerServices, qmlDebugPort)); + QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlDebuggerServices, qmlDebugPort));
params.qmlServerAddress = QHostAddress::LocalHost; params.qmlServerAddress = QHostAddress::LocalHost;
params.qmlServerPort = qmlDebugPort; params.qmlServerPort = qmlDebugPort;
} }