diff --git a/src/plugins/debugger/debuggerruncontrol.cpp b/src/plugins/debugger/debuggerruncontrol.cpp index 5cbc8e9f523..3634d132cac 100644 --- a/src/plugins/debugger/debuggerruncontrol.cpp +++ b/src/plugins/debugger/debuggerruncontrol.cpp @@ -303,6 +303,23 @@ ExecutableItem DebuggerRunToolPrivate::fixupParamsRecipe() return false; } + Utils::globalMacroExpander()->registerFileVariables( + "DebuggedExecutable", Tr::tr("Debugged executable"), + [this] { return m_runParameters.inferior().command.executable(); }); + + q->runControl()->setDisplayName(m_runParameters.displayName()); + + if (auto interpreterAspect = q->runControl()->aspectData()) { + if (auto mainScriptAspect = q->runControl()->aspectData()) { + const FilePath mainScript = mainScriptAspect->filePath; + const FilePath interpreter = interpreterAspect->filePath; + if (!interpreter.isEmpty() && mainScript.endsWith(".py")) { + m_runParameters.setMainScript(mainScript); + m_runParameters.setInterpreter(interpreter); + } + } + } + return true; }); } @@ -506,24 +523,6 @@ static int newRunId() void DebuggerRunTool::continueAfterDebugServerStart() { - Utils::globalMacroExpander()->registerFileVariables( - "DebuggedExecutable", Tr::tr("Debugged executable"), - [this] { return d->m_runParameters.inferior().command.executable(); } - ); - - runControl()->setDisplayName(d->m_runParameters.displayName()); - - if (auto interpreterAspect = runControl()->aspectData()) { - if (auto mainScriptAspect = runControl()->aspectData()) { - const FilePath mainScript = mainScriptAspect->filePath; - const FilePath interpreter = interpreterAspect->filePath; - if (!interpreter.isEmpty() && mainScript.endsWith(".py")) { - d->m_runParameters.setMainScript(mainScript); - d->m_runParameters.setInterpreter(interpreter); - } - } - } - const auto engines = createEngines(runControl(), runParameters()); if (!engines) { reportFailure(engines.error());