From 7d5126b431f6e5338861ceecf255f3fbe718f8f4 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Mon, 13 Jan 2025 15:23:42 +0100 Subject: [PATCH] Debugger: Transform a few fields of DebuggerRunParameters Transform overrideStartScript and startMessage. Task-number: QTCREATORBUG-29168 Change-Id: Ib29a200aac0007aec0683066f841b8f5692471d6 Reviewed-by: hjk --- src/plugins/debugger/debuggerengine.h | 11 +++++++++-- src/plugins/debugger/debuggerplugin.cpp | 10 +++++----- src/plugins/debugger/debuggerruncontrol.cpp | 10 ---------- src/plugins/debugger/debuggerruncontrol.h | 2 -- src/plugins/debugger/gdb/gdbengine.cpp | 2 +- src/plugins/debugger/loadcoredialog.cpp | 2 +- 6 files changed, 16 insertions(+), 21 deletions(-) diff --git a/src/plugins/debugger/debuggerengine.h b/src/plugins/debugger/debuggerengine.h index 15b7d893f80..803e233a3f8 100644 --- a/src/plugins/debugger/debuggerengine.h +++ b/src/plugins/debugger/debuggerengine.h @@ -196,8 +196,12 @@ public: Utils::ProcessRunData debugger() const { return m_debugger; }; - Utils::FilePath overrideStartScript; // Used in attach to core and remote debugging - QString startMessage; // First status message shown. + void setOverrideStartScript(const Utils::FilePath &script) { m_overrideStartScript = script; } + Utils::FilePath overrideStartScript() const { return m_overrideStartScript; } + + void setStartMessage(const QString &msg) { m_startMessage = msg; } + // FIXME: Add a startMessage() getter and use it. + Utils::FilePath debugInfoLocation; // Gdb "set-debug-file-directory". QStringList debugSourceLocation; // Gdb "directory" Utils::FilePath qtSourceLocation; @@ -301,6 +305,9 @@ private: bool m_runAsRoot = false; Utils::ProcessRunData m_debugger; + Utils::FilePath m_overrideStartScript; // Used in attach to core and remote debugging + + QString m_startMessage; // First status message shown. }; namespace Internal { diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 7b78da0b7fa..79948cf99c6 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -1402,22 +1402,22 @@ bool DebuggerPluginPrivate::parseArgument(QStringList::const_iterator &it, rp.setCloseMode(DetachAtClose); rp.setAttachPid(pid); rp.setDisplayName(Tr::tr("Process %1").arg(pid)); - debugger->setStartMessage(Tr::tr("Attaching to local process %1.").arg(pid)); + rp.setStartMessage(Tr::tr("Attaching to local process %1.").arg(pid)); } else if (startMode == AttachToRemoteServer) { rp.setStartMode(AttachToRemoteServer); rp.setRemoteChannel(remoteChannel); rp.setDisplayName(Tr::tr("Remote: \"%1\"").arg(remoteChannel)); - debugger->setStartMessage(Tr::tr("Attaching to remote server %1.").arg(remoteChannel)); + rp.setStartMessage(Tr::tr("Attaching to remote server %1.").arg(remoteChannel)); } else if (startMode == AttachToCore) { rp.setStartMode(AttachToCore); rp.setCloseMode(DetachAtClose); rp.setCoreFilePath(coreFile); rp.setDisplayName(Tr::tr("Core file \"%1\"").arg(coreFile.toUserOutput())); - debugger->setStartMessage(Tr::tr("Attaching to core file %1.").arg(coreFile.toUserOutput())); + rp.setStartMessage(Tr::tr("Attaching to core file %1.").arg(coreFile.toUserOutput())); } else { rp.setStartMode(StartExternal); rp.setDisplayName(Tr::tr("Executable file \"%1\"").arg(executable.toUserOutput())); - debugger->setStartMessage(Tr::tr("Debugging file %1.").arg(executable.toUserOutput())); + rp.setStartMessage(Tr::tr("Debugging file %1.").arg(executable.toUserOutput())); } rp.setUseTerminal(useTerminal); @@ -1444,7 +1444,7 @@ bool DebuggerPluginPrivate::parseArgument(QStringList::const_iterator &it, debugger->setCrashParameter(it->section(':', 0, 0)); rp.setAttachPid(pid); rp.setDisplayName(Tr::tr("Crashed process %1").arg(pid)); - debugger->setStartMessage(Tr::tr("Attaching to crashed process %1").arg(pid)); + rp.setStartMessage(Tr::tr("Attaching to crashed process %1").arg(pid)); if (pid < 1) { *errorMessage = Tr::tr("The parameter \"%1\" of option \"%2\" " "does not match the pattern :.").arg(*it, option); diff --git a/src/plugins/debugger/debuggerruncontrol.cpp b/src/plugins/debugger/debuggerruncontrol.cpp index ddcc37d4e05..e2022196e5d 100644 --- a/src/plugins/debugger/debuggerruncontrol.cpp +++ b/src/plugins/debugger/debuggerruncontrol.cpp @@ -113,21 +113,11 @@ void DebuggerRunTool::setTestCase(int testCase) m_runParameters.testCase = testCase; } -void DebuggerRunTool::setOverrideStartScript(const FilePath &script) -{ - m_runParameters.overrideStartScript = script; -} - void DebuggerRunTool::setAbi(const Abi &abi) { m_runParameters.toolChainAbi = abi; } -void DebuggerRunTool::setStartMessage(const QString &msg) -{ - m_runParameters.startMessage = msg; -} - void DebuggerRunTool::addQmlServerInferiorCommandLineArgumentIfNeeded() { d->addQmlServerInferiorCommandLineArgumentIfNeeded = true; diff --git a/src/plugins/debugger/debuggerruncontrol.h b/src/plugins/debugger/debuggerruncontrol.h index b60a32ff894..b06c954e8f0 100644 --- a/src/plugins/debugger/debuggerruncontrol.h +++ b/src/plugins/debugger/debuggerruncontrol.h @@ -30,7 +30,6 @@ public: void start() override; void stop() override; - void setStartMessage(const QString &msg); void setCrashParameter(const QString &event); void setUseDebugServer(Utils::ProcessHandle attachPid, bool essential, bool useMulti); @@ -38,7 +37,6 @@ public: void setDebugInfoLocation(const Utils::FilePath &debugInfoLocation); void setTestCase(int testCase); - void setOverrideStartScript(const Utils::FilePath &script); void kickoffTerminalProcess(); void interruptTerminal(); diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index 846b8c50120..2dde25713b6 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -4077,7 +4077,7 @@ void GdbEngine::handleGdbStartFailed() void GdbEngine::loadInitScript() { - const FilePath script = runParameters().overrideStartScript; + const FilePath script = runParameters().overrideStartScript(); if (!script.isEmpty()) { if (script.isReadableFile()) { runCommand({"source " + script.path()}); diff --git a/src/plugins/debugger/loadcoredialog.cpp b/src/plugins/debugger/loadcoredialog.cpp index 2d73d2f0f03..7ee9a098001 100644 --- a/src/plugins/debugger/loadcoredialog.cpp +++ b/src/plugins/debugger/loadcoredialog.cpp @@ -355,7 +355,7 @@ void runAttachToCoreDialog() rp.setCoreFilePath(dlg.coreFileCopy()); rp.setStartMode(AttachToCore); rp.setCloseMode(DetachAtClose); - debugger->setOverrideStartScript(dlg.overrideStartScript()); + rp.setOverrideStartScript(dlg.overrideStartScript()); const FilePath sysRoot = dlg.sysRoot(); if (!sysRoot.isEmpty()) rp.setSysRoot(sysRoot);