forked from qt-creator/qt-creator
AppMan: Inline AppManInferiorRunner
Change-Id: I3e67d39de10f88b6b98fbf8ea0856bd0562de687 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -92,24 +92,18 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// AppManInferiorRunner
|
||||
|
||||
class AppManInferiorRunner : public SimpleTargetRunner
|
||||
static RunWorker *createInferiorRunner(RunControl *runControl, QmlDebugServicesPreset qmlServices)
|
||||
{
|
||||
public:
|
||||
AppManInferiorRunner(RunControl *runControl, QmlDebugServicesPreset qmlServices)
|
||||
: SimpleTargetRunner(runControl)
|
||||
{
|
||||
setId(AppManager::Constants::DEBUG_LAUNCHER_ID);
|
||||
setEssential(true);
|
||||
auto worker = new SimpleTargetRunner(runControl);
|
||||
worker->setId(AppManager::Constants::DEBUG_LAUNCHER_ID);
|
||||
worker->setEssential(true);
|
||||
|
||||
if (usesPerfChannel()) {
|
||||
suppressDefaultStdOutHandling();
|
||||
runControl->setProperty("PerfProcess", QVariant::fromValue(process()));
|
||||
if (worker->usesPerfChannel()) {
|
||||
worker->suppressDefaultStdOutHandling();
|
||||
runControl->setProperty("PerfProcess", QVariant::fromValue(worker->process()));
|
||||
}
|
||||
|
||||
setStartModifier([this, runControl, qmlServices] {
|
||||
worker->setStartModifier([worker, runControl, qmlServices] {
|
||||
FilePath controller = runControl->aspectData<AppManagerControllerAspect>()->filePath;
|
||||
QString appId = runControl->aspectData<AppManagerIdAspect>()->value;
|
||||
QString instanceId = runControl->aspectData<AppManagerInstanceIdAspect>()->value;
|
||||
@@ -126,19 +120,19 @@ public:
|
||||
|
||||
cmd.addArg("debug-application");
|
||||
|
||||
if (usesDebugChannel() || usesQmlChannel()) {
|
||||
if (worker->usesDebugChannel() || worker->usesQmlChannel()) {
|
||||
QStringList debugArgs;
|
||||
debugArgs.append(envVars.join(' '));
|
||||
if (usesDebugChannel())
|
||||
debugArgs.append(QString("gdbserver :%1").arg(debugChannel().port()));
|
||||
if (usesQmlChannel()) {
|
||||
if (worker->usesDebugChannel())
|
||||
debugArgs.append(QString("gdbserver :%1").arg(worker->debugChannel().port()));
|
||||
if (worker->usesQmlChannel()) {
|
||||
const QString qmlArgs = qmlDebugCommandLineArguments(qmlServices,
|
||||
QString("port:%1").arg(qmlChannel().port()), true);
|
||||
QString("port:%1").arg(worker->qmlChannel().port()), true);
|
||||
debugArgs.append(QString("%program% %1 %arguments%") .arg(qmlArgs));
|
||||
}
|
||||
cmd.addArg(debugArgs.join(' '));
|
||||
}
|
||||
if (usesPerfChannel()) {
|
||||
if (worker->usesPerfChannel()) {
|
||||
const Store perfArgs = runControl->settingsData(PerfProfiler::Constants::PerfSettingsId);
|
||||
const QString recordArgs = perfArgs[PerfProfiler::Constants::PerfRecordArgsId].toString();
|
||||
cmd.addArg(QString("perf record %1 -o - --").arg(recordArgs));
|
||||
@@ -154,17 +148,16 @@ public:
|
||||
|
||||
// Always use the default environment to start the appman-controller in
|
||||
// The env variables from the EnvironmentAspect are set through the controller
|
||||
setEnvironment({});
|
||||
worker->setEnvironment({});
|
||||
// Prevent the write channel to be closed, otherwise the appman-controller will exit
|
||||
setProcessMode(ProcessMode::Writer);
|
||||
setCommandLine(cmd);
|
||||
worker->setProcessMode(ProcessMode::Writer);
|
||||
worker->setCommandLine(cmd);
|
||||
|
||||
appendMessage(Tr::tr("Starting Application Manager debugging..."), NormalMessageFormat);
|
||||
appendMessage(Tr::tr("Using: %1.").arg(cmd.toUserOutput()), NormalMessageFormat);
|
||||
worker->appendMessage(Tr::tr("Starting Application Manager debugging..."), NormalMessageFormat);
|
||||
worker->appendMessage(Tr::tr("Using: %1.").arg(cmd.toUserOutput()), NormalMessageFormat);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
return worker;
|
||||
}
|
||||
|
||||
// AppManagerDebugSupport
|
||||
|
||||
@@ -181,7 +174,7 @@ public:
|
||||
if (isQmlDebugging())
|
||||
runControl->requestQmlChannel();
|
||||
|
||||
auto debuggee = new AppManInferiorRunner(runControl, QmlDebuggerServices);
|
||||
auto debuggee = createInferiorRunner(runControl, QmlDebuggerServices);
|
||||
|
||||
addStartDependency(debuggee);
|
||||
addStopDependency(debuggee);
|
||||
@@ -260,7 +253,7 @@ public:
|
||||
|
||||
runControl->requestQmlChannel();
|
||||
QmlDebugServicesPreset services = servicesForRunMode(runControl->runMode());
|
||||
auto runner = new AppManInferiorRunner(runControl, services);
|
||||
auto runner = createInferiorRunner(runControl, services);
|
||||
addStartDependency(runner);
|
||||
addStopDependency(runner);
|
||||
|
||||
@@ -284,7 +277,7 @@ public:
|
||||
setId("AppManagerPerfProfilerSupport");
|
||||
|
||||
runControl->requestPerfChannel();
|
||||
auto profilee = new AppManInferiorRunner(runControl, NoQmlDebugServices);
|
||||
auto profilee = createInferiorRunner(runControl, NoQmlDebugServices);
|
||||
addStartDependency(profilee);
|
||||
addStopDependency(profilee);
|
||||
}
|
||||
|
Reference in New Issue
Block a user