From 4b5aeb9a74c3e2bbdaafbdf7b11f356b90027f1e Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 27 Sep 2021 11:11:18 +0200 Subject: [PATCH] Debugger: Use FilePath for debugInfoLocation Change-Id: Id538ab4ddd1d634d0dc73a00fe42d3fd35341bea Reviewed-by: Christian Stenger --- src/plugins/debugger/debuggerdialogs.cpp | 10 +++++----- src/plugins/debugger/debuggerengine.h | 2 +- src/plugins/debugger/debuggerruncontrol.cpp | 9 ++++----- src/plugins/debugger/debuggerruncontrol.h | 2 +- src/plugins/debugger/gdb/gdbengine.cpp | 6 +++--- 5 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/plugins/debugger/debuggerdialogs.cpp b/src/plugins/debugger/debuggerdialogs.cpp index 69c1ee48cd7..1493b5c6864 100644 --- a/src/plugins/debugger/debuggerdialogs.cpp +++ b/src/plugins/debugger/debuggerdialogs.cpp @@ -130,7 +130,7 @@ public: FilePath sysRoot; QString serverInitCommands; QString serverResetCommands; - QString debugInfoLocation; + FilePath debugInfoLocation; }; bool StartApplicationParameters::equals(const StartApplicationParameters &rhs) const @@ -181,7 +181,7 @@ void StartApplicationParameters::toSettings(QSettings *settings) const settings->setValue("LastExternalUseTargetExtended", useTargetExtendedRemote); settings->setValue("LastServerInitCommands", serverInitCommands); settings->setValue("LastServerResetCommands", serverResetCommands); - settings->setValue("LastDebugInfoLocation", debugInfoLocation); + settings->setValue("LastDebugInfoLocation", debugInfoLocation.toVariant()); settings->setValue("LastSysRoot", sysRoot.toVariant()); } @@ -198,7 +198,7 @@ void StartApplicationParameters::fromSettings(const QSettings *settings) useTargetExtendedRemote = settings->value("LastExternalUseTargetExtended").toBool(); serverInitCommands = settings->value("LastServerInitCommands").toString(); serverResetCommands = settings->value("LastServerResetCommands").toString(); - debugInfoLocation = settings->value("LastDebugInfoLocation").toString(); + debugInfoLocation = FilePath::fromVariant(settings->value("LastDebugInfoLocation")); sysRoot = FilePath::fromVariant(settings->value("LastSysRoot")); } @@ -487,7 +487,7 @@ StartApplicationParameters StartApplicationDialog::parameters() const result.serverInitCommands = d->serverInitCommandsTextEdit->toPlainText(); result.serverResetCommands = d->serverResetCommandsTextEdit->toPlainText(); result.kitId = d->kitChooser->currentKitId(); - result.debugInfoLocation = d->debuginfoPathChooser->filePath().toString(); + result.debugInfoLocation = d->debuginfoPathChooser->filePath(); result.runnable.command.setArguments(d->arguments->text()); result.runnable.workingDirectory = d->workingDirectory->filePath(); result.breakAtMain = d->breakAtMainCheckBox->isChecked(); @@ -505,7 +505,7 @@ void StartApplicationDialog::setParameters(const StartApplicationParameters &p) d->sysRootPathChooser->setFilePath(p.sysRoot); d->serverInitCommandsTextEdit->setPlainText(p.serverInitCommands); d->serverResetCommandsTextEdit->setPlainText(p.serverResetCommands); - d->debuginfoPathChooser->setPath(p.debugInfoLocation); + d->debuginfoPathChooser->setFilePath(p.debugInfoLocation); d->arguments->setText(p.runnable.command.arguments()); d->workingDirectory->setFilePath(p.runnable.workingDirectory); d->breakAtMainCheckBox->setChecked(p.breakAtMain); diff --git a/src/plugins/debugger/debuggerengine.h b/src/plugins/debugger/debuggerengine.h index 59b0c26c059..68d66fba500 100644 --- a/src/plugins/debugger/debuggerengine.h +++ b/src/plugins/debugger/debuggerengine.h @@ -174,7 +174,7 @@ public: ProjectExplorer::Runnable debugger; QString overrideStartScript; // Used in attach to core and remote debugging QString startMessage; // First status message shown. - QString debugInfoLocation; // Gdb "set-debug-file-directory". + Utils::FilePath debugInfoLocation; // Gdb "set-debug-file-directory". QStringList debugSourceLocation; // Gdb "directory" QString qtPackageSourceLocation; bool isSnapshot = false; // Set if created internally. diff --git a/src/plugins/debugger/debuggerruncontrol.cpp b/src/plugins/debugger/debuggerruncontrol.cpp index a36f6053ecd..0b23be17c21 100644 --- a/src/plugins/debugger/debuggerruncontrol.cpp +++ b/src/plugins/debugger/debuggerruncontrol.cpp @@ -339,8 +339,7 @@ void DebuggerRunTool::setCommandsForReset(const QString &commands) { m_runParameters.commandsForReset = commands; } - -void DebuggerRunTool::setDebugInfoLocation(const QString &debugInfoLocation) + void DebuggerRunTool::setDebugInfoLocation(const FilePath &debugInfoLocation) { m_runParameters.debugInfoLocation = debugInfoLocation; } @@ -776,11 +775,11 @@ bool DebuggerRunTool::fixupParameters() } if (!debuggerSettings()->autoEnrichParameters.value()) { - const QString sysroot = rp.sysRoot.toString(); + const FilePath sysroot = rp.sysRoot; if (rp.debugInfoLocation.isEmpty()) - rp.debugInfoLocation = sysroot + "/usr/lib/debug"; + rp.debugInfoLocation = sysroot / "/usr/lib/debug"; if (rp.debugSourceLocation.isEmpty()) { - QString base = sysroot + "/usr/src/debug/"; + QString base = sysroot.toString() + "/usr/src/debug/"; rp.debugSourceLocation.append(base + "qt5base/src/corelib"); rp.debugSourceLocation.append(base + "qt5base/src/gui"); rp.debugSourceLocation.append(base + "qt5base/src/network"); diff --git a/src/plugins/debugger/debuggerruncontrol.h b/src/plugins/debugger/debuggerruncontrol.h index eb04d9a7b07..11abe9874f0 100644 --- a/src/plugins/debugger/debuggerruncontrol.h +++ b/src/plugins/debugger/debuggerruncontrol.h @@ -114,7 +114,7 @@ public: void setCommandsForReset(const QString &commands); void setServerStartScript(const Utils::FilePath &serverStartScript); - void setDebugInfoLocation(const QString &debugInfoLocation); + void setDebugInfoLocation(const Utils::FilePath &debugInfoLocation); void setQmlServer(const QUrl &qmlServer); QUrl qmlServer() const; // Used in GammaRay integration. diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index 4b51fd31942..e09c1cce661 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -4149,10 +4149,10 @@ void GdbEngine::handleInferiorPrepared() void GdbEngine::handleDebugInfoLocation(const DebuggerResponse &response) { if (response.resultClass == ResultDone) { - const QString debugInfoLocation = runParameters().debugInfoLocation; - if (!debugInfoLocation.isEmpty() && QFile::exists(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; + QString cmd = "set debug-file-directory " + debugInfoLocation.toString(); if (!curDebugInfoLocations.isEmpty()) cmd += HostOsInfo::pathListSeparator() + curDebugInfoLocations; runCommand({cmd});