diff options
author | Jarek Kobus <[email protected]> | 2025-04-16 18:20:49 +0200 |
---|---|---|
committer | Jarek Kobus <[email protected]> | 2025-04-17 09:31:43 +0000 |
commit | be69da2066ea6eccaff2c3f10fc66795915af931 (patch) | |
tree | 6aba855e99b7b6a1aaed6867ad3d6e667dfc1860 /src/plugins/qtapplicationmanager | |
parent | 4a974cb655f02714806711448ef118c09f615b0c (diff) |
Debugger: Introduce createDebuggerWorker and reuse it
Task-number: QTCREATORBUG-29168
Change-Id: I101fdc1589d36ff996eef12308cf4165143b04af
Reviewed-by: hjk <[email protected]>
Diffstat (limited to 'src/plugins/qtapplicationmanager')
-rw-r--r-- | src/plugins/qtapplicationmanager/appmanagerruncontrol.cpp | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/src/plugins/qtapplicationmanager/appmanagerruncontrol.cpp b/src/plugins/qtapplicationmanager/appmanagerruncontrol.cpp index 1be757b9bf0..01b3a413c6c 100644 --- a/src/plugins/qtapplicationmanager/appmanagerruncontrol.cpp +++ b/src/plugins/qtapplicationmanager/appmanagerruncontrol.cpp @@ -152,22 +152,15 @@ class AppManagerDebugWorkerFactory final : public RunWorkerFactory public: AppManagerDebugWorkerFactory() { - setProducer([](RunControl *runControl) { - DebuggerRunTool *debugger = new DebuggerRunTool(runControl); - debugger->setId("ApplicationManagerPlugin.Debug.Support"); - - auto debuggee = createInferiorRunner(runControl, QmlDebuggerServices); - debugger->addStartDependency(debuggee); - debugger->addStopDependency(debuggee); - debuggee->addStopDependency(debugger); - + setProducer([](RunControl *runControl) -> RunWorker * { BuildConfiguration *bc = runControl->buildConfiguration(); const Internal::TargetInformation targetInformation(bc); if (!targetInformation.isValid()) { // TODO: reportFailure won't work from RunWorker's c'tor. - debugger->reportFailure(Tr::tr("Cannot debug: Invalid target information.")); - return debugger; + runControl->postMessage(Tr::tr("Cannot debug: Invalid target information."), + ErrorMessageFormat); + return nullptr; } FilePath symbolFile; @@ -184,16 +177,20 @@ public: }).targetFilePath; } else { // TODO: reportFailure won't work from RunWorker's c'tor. - debugger->reportFailure(Tr::tr("Cannot debug: Only QML and native applications are supported.")); - return debugger; + runControl->postMessage(Tr::tr("Cannot debug: Only QML and native applications are supported."), + ErrorMessageFormat); + return nullptr; } if (symbolFile.isEmpty()) { // TODO: reportFailure won't work from RunWorker's c'tor. - debugger->reportFailure(Tr::tr("Cannot debug: Local executable is not set.")); - return debugger; + runControl->postMessage(Tr::tr("Cannot debug: Local executable is not set."), + ErrorMessageFormat); + return nullptr; } - Debugger::DebuggerRunParameters &rp = debugger->runParameters(); + auto debuggee = createInferiorRunner(runControl, QmlDebuggerServices); + + DebuggerRunParameters rp = DebuggerRunParameters::fromRunControl(runControl); rp.setupPortsGatherer(runControl); rp.setStartMode(Debugger::AttachToRemoteServer); rp.setCloseMode(Debugger::KillAndExitMonitorAtClose); @@ -217,6 +214,11 @@ public: rp.setSysRoot(sysroot); } + auto debugger = createDebuggerWorker(runControl, rp); + debugger->addStartDependency(debuggee); + debugger->addStopDependency(debuggee); + debuggee->addStopDependency(debugger); + return debugger; }); addSupportedRunMode(ProjectExplorer::Constants::DEBUG_RUN_MODE); |