diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index 09755f68e6d..59d6d50a5b7 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -469,10 +469,10 @@ void GdbEngine::handleAsyncOutput(const QStringView asyncClass, const GdbMi &res Module module; module.startAddress = 0; module.endAddress = 0; - module.hostPath = result["host-name"].data(); + module.hostPath = Utils::FilePath::fromString(result["host-name"].data()); const QString target = result["target-name"].data(); module.modulePath = runParameters().inferior.command.executable().withNewPath(target); - module.moduleName = QFileInfo(module.hostPath).baseName(); + module.moduleName = module.hostPath.baseName(); modulesHandler()->updateModule(module); } else if (asyncClass == u"library-unloaded") { // Archer has 'id="/usr/lib/libdrm.so.2", @@ -3926,6 +3926,7 @@ void GdbEngine::handleGdbStarted() module.startAddress = 0; module.endAddress = 0; module.modulePath = rp.inferior.command.executable(); + module.hostPath = rp.symbolFile; module.moduleName = ""; modulesHandler()->updateModule(module); diff --git a/src/plugins/debugger/moduleshandler.cpp b/src/plugins/debugger/moduleshandler.cpp index 5d0d6d6a8b7..9072d02463d 100644 --- a/src/plugins/debugger/moduleshandler.cpp +++ b/src/plugins/debugger/moduleshandler.cpp @@ -273,9 +273,16 @@ void ModulesHandler::removeModule(const FilePath &modulePath) m_model->destroyItem(item); } +static FilePath pickPath(const FilePath &hostPath, const FilePath &modulePath) +{ + if (!hostPath.isEmpty() && hostPath.exists()) + return hostPath; + return modulePath; // Checking if this exists can be slow, delay it for as long as possible +} + void ModulesHandler::updateModule(const Module &module) { - const FilePath path = module.modulePath; + const FilePath path = pickPath(module.hostPath, module.modulePath); if (path.isEmpty()) return; diff --git a/src/plugins/debugger/moduleshandler.h b/src/plugins/debugger/moduleshandler.h index 03434edab28..97ab677b359 100644 --- a/src/plugins/debugger/moduleshandler.h +++ b/src/plugins/debugger/moduleshandler.h @@ -71,7 +71,7 @@ public: }; QString moduleName; Utils::FilePath modulePath; - QString hostPath; + Utils::FilePath hostPath; SymbolReadState symbolsRead = UnknownReadState; quint64 startAddress = 0; quint64 endAddress = 0;