From adf1243ed9397f98b3c0b5352711de0d5c05c73a Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 11 Aug 2021 08:36:15 +0200 Subject: [PATCH] Debugger: Simplify some path uses in GdbEngine Change-Id: I5094fb5e71c664e6f6fc69648733c9307c3bc115 Reviewed-by: Christian Stenger Reviewed-by: hjk --- src/plugins/debugger/gdb/gdbengine.cpp | 11 ++++++----- src/plugins/debugger/gdb/gdbengine.h | 2 +- src/plugins/debugger/loadcoredialog.cpp | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index 88dfca2ed0b..271dcb45ebe 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -3979,8 +3979,8 @@ void GdbEngine::setupEngine() //if (terminal()->isUsable()) // runCommand({"set inferior-tty " + QString::fromUtf8(terminal()->slaveDevice())}); - const QFileInfo gdbBinaryFile = rp.debugger.command.executable().toFileInfo(); - const QString uninstalledData = gdbBinaryFile.absolutePath() + "/data-directory/python"; + const QString uninstalledData = + rp.debugger.command.executable().pathAppended("data-directory/python").path(); runCommand({"python sys.path.insert(1, '" + dumperSourcePath + "')"}); runCommand({"python sys.path.append('" + uninstalledData + "')"}); @@ -4430,7 +4430,7 @@ void GdbEngine::setupInferior() return; } - executable = FilePath::fromString(cinfo.foundExecutableName); + executable = cinfo.foundExecutableName; if (executable.isEmpty()) { AsynchronousMessageBox::warning(tr("Error Loading Symbols"), tr("No executable to load symbols from specified core.")); @@ -4469,7 +4469,7 @@ void GdbEngine::setupInferior() runCommand({"-exec-arguments " + args}); } - QString executable = runParameters().inferior.command.executable().toFileInfo().absoluteFilePath(); + QString executable = runParameters().inferior.command.executable().path(); runCommand({"-file-exec-and-symbols \"" + executable + '"', CB(handleFileExecAndSymbols)}); } @@ -5002,7 +5002,8 @@ CoreInfo CoreInfo::readExecutableNameFromCore(const Runnable &debugger, const QS if (pos2 != -1) { cinfo.isCore = true; cinfo.rawStringFromCore = output.mid(pos1, pos2 - pos1); - cinfo.foundExecutableName = findExecutableFromName(cinfo.rawStringFromCore, coreFile); + cinfo.foundExecutableName = + FilePath::fromString(findExecutableFromName(cinfo.rawStringFromCore, coreFile)); } } } diff --git a/src/plugins/debugger/gdb/gdbengine.h b/src/plugins/debugger/gdb/gdbengine.h index 451b208ccc0..b0e171b2223 100644 --- a/src/plugins/debugger/gdb/gdbengine.h +++ b/src/plugins/debugger/gdb/gdbengine.h @@ -57,7 +57,7 @@ class MemoryAgentCookie; struct CoreInfo { QString rawStringFromCore; - QString foundExecutableName; // empty if no corresponding exec could be found + Utils::FilePath foundExecutableName; // empty if no corresponding exec could be found bool isCore = false; static CoreInfo readExecutableNameFromCore(const ProjectExplorer::Runnable &debugger, diff --git a/src/plugins/debugger/loadcoredialog.cpp b/src/plugins/debugger/loadcoredialog.cpp index 594548f3df3..8ad011fae67 100644 --- a/src/plugins/debugger/loadcoredialog.cpp +++ b/src/plugins/debugger/loadcoredialog.cpp @@ -378,7 +378,7 @@ void AttachCoreDialog::coreFileChanged(const QString &core) Runnable debugger = DebuggerKitAspect::runnable(k); CoreInfo cinfo = CoreInfo::readExecutableNameFromCore(debugger, core); if (!cinfo.foundExecutableName.isEmpty()) - d->symbolFileName->setFilePath(FilePath::fromString(cinfo.foundExecutableName)); + d->symbolFileName->setFilePath(cinfo.foundExecutableName); else if (!d->symbolFileName->isValid() && !cinfo.rawStringFromCore.isEmpty()) d->symbolFileName->setFilePath(FilePath::fromString(cinfo.rawStringFromCore)); }