[Lldb-commits] [lldb] [lldb] Fix initial search path for PDB in PE/COFF (PR #190970)
Stefan Gränitz via lldb-commits
lldb-commits at lists.llvm.org
Wed Apr 8 06:16:33 PDT 2026
https://github.com/weliveindetail created https://github.com/llvm/llvm-project/pull/190970
Injecting an initial search path is more complicated than expected. `FileSpec` expects a file name and internally calls `SetFile()`, which splits the input into `filename` and `parent_path`. The original implementation added the parent path which is incorrect.
There is no obvious way to construct a `FileSpec` from a directory. Appending `/.` doesn't work either, because `remove_dots()` will strip the `.` component during normalization. The best way I found is copying the obj's spec and remove the file name.
>From eab95edb24547bfa2b387440e852758f3a89aa2d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Gr=C3=A4nitz?= <stefan.graenitz at gmail.com>
Date: Wed, 8 Apr 2026 14:50:24 +0200
Subject: [PATCH] [lldb] Fix initial search path for PDB in PE/COFF
---
.../Plugins/SymbolVendor/PECOFF/SymbolVendorPECOFF.cpp | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/lldb/source/Plugins/SymbolVendor/PECOFF/SymbolVendorPECOFF.cpp b/lldb/source/Plugins/SymbolVendor/PECOFF/SymbolVendorPECOFF.cpp
index 87436da443d916..fb7e3bfa4ff873 100644
--- a/lldb/source/Plugins/SymbolVendor/PECOFF/SymbolVendorPECOFF.cpp
+++ b/lldb/source/Plugins/SymbolVendor/PECOFF/SymbolVendorPECOFF.cpp
@@ -79,8 +79,11 @@ SymbolVendorPECOFF::CreateInstance(const lldb::ModuleSP &module_sp,
if (!fspec) {
if (auto pdb_spec = obj_file->GetPDBPath()) {
fspec = *pdb_spec;
- if (ConstString dir = obj_file->GetFileSpec().GetDirectory())
- search_paths.Insert(0, FileSpec(dir));
+ if (obj_file->GetFileSpec().GetDirectory()) {
+ FileSpec dir_spec = obj_file->GetFileSpec();
+ dir_spec.ClearFilename();
+ search_paths.Insert(0, dir_spec);
+ }
}
}
// Otherwise, try gnu_debuglink, if one exists.
More information about the lldb-commits
mailing list