From 164f6fa6c341ca792150d06aee3c2c8c8eabaa56 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Mon, 13 Jan 2025 15:48:24 +0100 Subject: [PATCH] Debugger: Transform a few fields of DebuggerRunParameters Transform debugInfoLocation, debugSourceLocation and qtSourceLocation. Task-number: QTCREATORBUG-29168 Change-Id: Ia8c93092d1e8ad937d9aa0ab4b4208609772e9be Reviewed-by: hjk --- src/plugins/debugger/debuggerdialogs.cpp | 2 +- src/plugins/debugger/debuggerengine.cpp | 16 ++++++++-------- src/plugins/debugger/debuggerengine.h | 13 ++++++++++--- src/plugins/debugger/debuggerruncontrol.cpp | 5 ----- src/plugins/debugger/debuggerruncontrol.h | 2 -- .../debugger/debuggersourcepathmappingwidget.cpp | 2 +- src/plugins/debugger/gdb/gdbengine.cpp | 4 ++-- 7 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/plugins/debugger/debuggerdialogs.cpp b/src/plugins/debugger/debuggerdialogs.cpp index cd696436f74..ebd11ab7e7e 100644 --- a/src/plugins/debugger/debuggerdialogs.cpp +++ b/src/plugins/debugger/debuggerdialogs.cpp @@ -415,7 +415,7 @@ void StartApplicationDialog::run(bool attachRemote) rp.setRemoteChannel(dev->sshParameters().host(), newParameters.serverPort); rp.setDisplayName(newParameters.displayName()); rp.setBreakOnMain(newParameters.breakAtMain); - debugger->setDebugInfoLocation(newParameters.debugInfoLocation); + rp.setDebugInfoLocation(newParameters.debugInfoLocation); rp.setInferior(newParameters.runnable); rp.setCommandsAfterConnect(newParameters.serverInitCommands); rp.setCommandsForReset(newParameters.serverResetCommands); diff --git a/src/plugins/debugger/debuggerengine.cpp b/src/plugins/debugger/debuggerengine.cpp index 319a3bc7aea..0a108217657 100644 --- a/src/plugins/debugger/debuggerengine.cpp +++ b/src/plugins/debugger/debuggerengine.cpp @@ -143,7 +143,7 @@ DebuggerRunParameters DebuggerRunParameters::fromRunControl(ProjectExplorer::Run params.m_version = DebuggerKitAspect::version(kit); if (QtSupport::QtVersion *qtVersion = QtSupport::QtKitAspect::qtVersion(kit)) - params.qtSourceLocation = qtVersion->sourcePath(); + params.m_qtSourceLocation = qtVersion->sourcePath(); if (auto aspect = runControl->aspectData()) { if (!aspect->useCppDebugger) @@ -243,13 +243,13 @@ Result DebuggerRunParameters::fixupParameters(ProjectExplorer::RunControl *runCo } if (settings().autoEnrichParameters()) { - if (debugInfoLocation.isEmpty()) - debugInfoLocation = m_sysRoot / "/usr/lib/debug"; - if (debugSourceLocation.isEmpty()) { + if (m_debugInfoLocation.isEmpty()) + m_debugInfoLocation = m_sysRoot / "/usr/lib/debug"; + if (m_debugSourceLocation.isEmpty()) { const QString base = m_sysRoot.toUrlishString() + "/usr/src/debug/"; - debugSourceLocation.append(base + "qt5base/src/corelib"); - debugSourceLocation.append(base + "qt5base/src/gui"); - debugSourceLocation.append(base + "qt5base/src/network"); + m_debugSourceLocation.append(base + "qt5base/src/corelib"); + m_debugSourceLocation.append(base + "qt5base/src/gui"); + m_debugSourceLocation.append(base + "qt5base/src/network"); } } @@ -2923,7 +2923,7 @@ QString DebuggerEngine::formatStartParameters() const if (!rp.qmlServer().host().isEmpty()) str << "QML server: " << rp.qmlServer().host() << ':' << rp.qmlServer().port() << '\n'; str << "Sysroot: " << rp.sysRoot() << '\n'; - str << "Debug Source Location: " << rp.debugSourceLocation.join(':') << '\n'; + str << "Debug Source Location: " << rp.debugSourceLocation().join(':') << '\n'; return rc; } diff --git a/src/plugins/debugger/debuggerengine.h b/src/plugins/debugger/debuggerengine.h index 803e233a3f8..f30ebf8aa3f 100644 --- a/src/plugins/debugger/debuggerengine.h +++ b/src/plugins/debugger/debuggerengine.h @@ -202,9 +202,13 @@ public: 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; + void setDebugInfoLocation(const Utils::FilePath &location) { m_debugInfoLocation = location; } + Utils::FilePath debugInfoLocation() const { return m_debugInfoLocation; } + + QStringList debugSourceLocation() const { return m_debugSourceLocation; } + + Utils::FilePath qtSourceLocation() const { return m_qtSourceLocation; } + ProjectExplorer::Abi toolChainAbi; Utils::FilePath projectSourceDirectory; @@ -308,6 +312,9 @@ private: Utils::FilePath m_overrideStartScript; // Used in attach to core and remote debugging QString m_startMessage; // First status message shown. + Utils::FilePath m_debugInfoLocation; // Gdb "set-debug-file-directory". + QStringList m_debugSourceLocation; // Gdb "directory" + Utils::FilePath m_qtSourceLocation; }; namespace Internal { diff --git a/src/plugins/debugger/debuggerruncontrol.cpp b/src/plugins/debugger/debuggerruncontrol.cpp index e2022196e5d..8b511912723 100644 --- a/src/plugins/debugger/debuggerruncontrol.cpp +++ b/src/plugins/debugger/debuggerruncontrol.cpp @@ -103,11 +103,6 @@ public: } // namespace Internal -void DebuggerRunTool::setDebugInfoLocation(const FilePath &debugInfoLocation) -{ - m_runParameters.debugInfoLocation = debugInfoLocation; -} - void DebuggerRunTool::setTestCase(int testCase) { m_runParameters.testCase = testCase; diff --git a/src/plugins/debugger/debuggerruncontrol.h b/src/plugins/debugger/debuggerruncontrol.h index b06c954e8f0..2a99e4a1b8c 100644 --- a/src/plugins/debugger/debuggerruncontrol.h +++ b/src/plugins/debugger/debuggerruncontrol.h @@ -34,8 +34,6 @@ public: void setUseDebugServer(Utils::ProcessHandle attachPid, bool essential, bool useMulti); - void setDebugInfoLocation(const Utils::FilePath &debugInfoLocation); - void setTestCase(int testCase); void kickoffTerminalProcess(); diff --git a/src/plugins/debugger/debuggersourcepathmappingwidget.cpp b/src/plugins/debugger/debuggersourcepathmappingwidget.cpp index 9d516dd585c..1d52a674240 100644 --- a/src/plugins/debugger/debuggersourcepathmappingwidget.cpp +++ b/src/plugins/debugger/debuggersourcepathmappingwidget.cpp @@ -419,7 +419,7 @@ void DebuggerSourcePathMappingWidget::slotEditTargetFieldChanged() SourcePathMap mergePlatformQtPath(const DebuggerRunParameters &sp, const SourcePathMap &in) { static const QString qglobal = "qtbase/src/corelib/global/qglobal.h"; - const FilePath sourceLocation = sp.qtSourceLocation; + const FilePath sourceLocation = sp.qtSourceLocation(); if (!(sourceLocation / qglobal).exists()) return in; diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index 2dde25713b6..2a92e4c93aa 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -3964,7 +3964,7 @@ void GdbEngine::handleGdbStarted() } // Spaces just will not work. - for (const QString &src : rp.debugSourceLocation) { + for (const QString &src : rp.debugSourceLocation()) { if (QDir(src).exists()) runCommand({"directory " + src}); else @@ -4214,7 +4214,7 @@ void GdbEngine::handleInferiorPrepared() void GdbEngine::handleDebugInfoLocation(const DebuggerResponse &response) { if (response.resultClass == ResultDone) { - const FilePath debugInfoLocation = runParameters().debugInfoLocation; + const FilePath debugInfoLocation = runParameters().debugInfoLocation(); if (!debugInfoLocation.isEmpty() && debugInfoLocation.exists()) { const QString curDebugInfoLocations = response.consoleStreamOutput.split('"').value(1); QString cmd = "set debug-file-directory " + debugInfoLocation.path();