diff options
author | Jarek Kobus <[email protected]> | 2025-03-12 13:40:55 +0100 |
---|---|---|
committer | Jarek Kobus <[email protected]> | 2025-03-14 15:43:52 +0000 |
commit | b679e77e27db54b0fcd57570370dce25b07e164d (patch) | |
tree | 72e1f506e4af5f1488f64f314e3f18c86e771d5a /src/plugins/qtapplicationmanager | |
parent | 0e00d403a089d9120d614b82724d32c5666b43d6 (diff) |
AppMan: Move configuration of debugger into construction phase
Change-Id: If61411290de2fe13e19eaa4ef3d51509f8a8f4e3
Reviewed-by: hjk <[email protected]>
Diffstat (limited to 'src/plugins/qtapplicationmanager')
-rw-r--r-- | src/plugins/qtapplicationmanager/appmanagerruncontrol.cpp | 98 |
1 files changed, 50 insertions, 48 deletions
diff --git a/src/plugins/qtapplicationmanager/appmanagerruncontrol.cpp b/src/plugins/qtapplicationmanager/appmanagerruncontrol.cpp index d5e4ded6c50..c2226906a3e 100644 --- a/src/plugins/qtapplicationmanager/appmanagerruncontrol.cpp +++ b/src/plugins/qtapplicationmanager/appmanagerruncontrol.cpp @@ -172,58 +172,60 @@ public: debugger->addStopDependency(debuggee); debuggee->addStopDependency(debugger); - QObject::connect(debuggee, &RunWorker::started, debugger, [debugger, runControl] { - BuildConfiguration *bc = runControl->buildConfiguration(); + BuildConfiguration *bc = runControl->buildConfiguration(); - const Internal::TargetInformation targetInformation(bc); - if (!targetInformation.isValid()) { - debugger->reportFailure(Tr::tr("Cannot debug: Invalid target information.")); - return; - } + 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; + } - FilePath symbolFile; - - if (targetInformation.manifest.isQmlRuntime()) { - symbolFile = getToolFilePath(Constants::APPMAN_LAUNCHER_QML, - runControl->kit(), - RunDeviceKitAspect::device(runControl->kit())); - } else if (targetInformation.manifest.isNativeRuntime()) { - symbolFile = Utils::findOrDefault(bc->buildSystem()->applicationTargets(), - [&](const BuildTargetInfo &ti) { - return ti.buildKey == targetInformation.manifest.code - || ti.projectFilePath.toUrlishString() == targetInformation.manifest.code; - }).targetFilePath; - } else { - debugger->reportFailure(Tr::tr("Cannot debug: Only QML and native applications are supported.")); - } - if (symbolFile.isEmpty()) { - debugger->reportFailure(Tr::tr("Cannot debug: Local executable is not set.")); - return; - } + FilePath symbolFile; + + if (targetInformation.manifest.isQmlRuntime()) { + symbolFile = getToolFilePath(Constants::APPMAN_LAUNCHER_QML, + runControl->kit(), + RunDeviceKitAspect::device(runControl->kit())); + } else if (targetInformation.manifest.isNativeRuntime()) { + symbolFile = Utils::findOrDefault(bc->buildSystem()->applicationTargets(), + [&](const BuildTargetInfo &ti) { + return ti.buildKey == targetInformation.manifest.code + || ti.projectFilePath.toUrlishString() == targetInformation.manifest.code; + }).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; + } + 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; + } - Debugger::DebuggerRunParameters &rp = debugger->runParameters(); - rp.setStartMode(Debugger::AttachToRemoteServer); - rp.setCloseMode(Debugger::KillAndExitMonitorAtClose); - - if (rp.isCppDebugging()) { - rp.setUseExtendedRemote(false); - rp.setUseContinueInsteadOfRun(true); - rp.setContinueAfterAttach(true); - rp.setSymbolFile(symbolFile); - - QtSupport::QtVersion *version = QtSupport::QtKitAspect::qtVersion(runControl->kit()); - if (version) { - rp.setSolibSearchPath(version->qtSoPaths()); - rp.addSearchDirectory(version->qmlPath()); - } - - const FilePath sysroot = SysRootKitAspect::sysRoot(runControl->kit()); - if (sysroot.isEmpty()) - rp.setSysRoot("/"); - else - rp.setSysRoot(sysroot); + Debugger::DebuggerRunParameters &rp = debugger->runParameters(); + rp.setStartMode(Debugger::AttachToRemoteServer); + rp.setCloseMode(Debugger::KillAndExitMonitorAtClose); + + if (rp.isCppDebugging()) { + rp.setUseExtendedRemote(false); + rp.setUseContinueInsteadOfRun(true); + rp.setContinueAfterAttach(true); + rp.setSymbolFile(symbolFile); + + QtSupport::QtVersion *version = QtSupport::QtKitAspect::qtVersion(runControl->kit()); + if (version) { + rp.setSolibSearchPath(version->qtSoPaths()); + rp.addSearchDirectory(version->qmlPath()); } - }); + + const FilePath sysroot = SysRootKitAspect::sysRoot(runControl->kit()); + if (sysroot.isEmpty()) + rp.setSysRoot("/"); + else + rp.setSysRoot(sysroot); + } return debugger; }); |