[Lldb-commits] [lldb] Reland "[lldb] Initial plugin and test for SymbolLocatorSymStore" (PR #185658)
Stefan Gränitz via lldb-commits
lldb-commits at lists.llvm.org
Wed Mar 11 09:03:39 PDT 2026
================
@@ -71,6 +71,9 @@ SymbolVendorPECOFF::CreateInstance(const lldb::ModuleSP &module_sp,
// If the module specified a filespec, use that.
FileSpec fspec = module_sp->GetSymbolFileFileSpec();
+ // Otherwise, use the PDB path from CodeView.
+ if (!fspec)
+ fspec = obj_file->GetPDBPath().value_or(FileSpec());
----------------
weliveindetail wrote:
Oh interesting, thanks for the heads-up! I don't remember these failures had shown up on my side, but I also haven't run the other tests recently. The SymbolLocator just seemed like an isolated addition. I reproduced them locally now with the exception of `NativePDB/symtab.cpp`
The core issue is, that the old code path to NativePDB has actually been the fallback [here](https://github.com/llvm/llvm-project/blob/e4c83b7b119c86070845b17c5070147ba84230de/lldb/source/Symbol/SymbolVendor.cpp#L53), because none of the SymbolVendors matched. In this case we were setting the symbol file to the binary itself for the [traversal of SymbolFile plugins](https://github.com/llvm/llvm-project/blob/f27fbca37c4a66d4e237bae1256d775ca7471cb9/lldb/source/Symbol/SymbolFile.cpp#L70).
SymbolVendorPECOFF didn't match, because we never checked it's PDB path and so [the SymbolLocators didn't get a chance](https://github.com/llvm/llvm-project/blob/069d77c58181e8e9dde30b97434bcbd97e6ff40e/lldb/source/Plugins/SymbolVendor/PECOFF/SymbolVendorPECOFF.cpp#L91) at all. Now, that the SymbolLocators do get a chance, SymbolVendorPECOFF matches and provides the path of the PDB file to SymbolFile(Native)PDB instead of the EXE!
Most of the tests I checked failed in the `LLDB_USE_NATIVE_PDB_READER=0` scenario, because they were still assuming `m_objfile_sp` is the debugged module. This changed now and I fixed it. They should all work now. This is basically, a follow-up from your effort in https://github.com/llvm/llvm-project/commit/cc72171322a982b3d39a2688c45372ee7b5f8b67
`NativePDB/find-pdb-next-to-exe.test` is different: It simply failed because it was testing for a log output that isn't emitted anymore. Since `m_objfile_sp` is the PDB file now, we don't call `loadMatchingPDBFile()` anymore. This function is doing most of the SymbolVendor work again. It looks like this is the workaround that made the `m_objfile_sp` misconception work for SymbolFileNativePDB in the first place. I hope we can live without this check? I wonder what code-path would still exercise it now?
Finally, I think we can live without `findMatchingPDBFilePath()` as well, because it is effectively split into:
* The path-style guessing logic, which moved to `ObjectFilePECOFF::GetPDBPath()` as you suggested in the original review.
* The traversal of `target.debug-file-search-paths`, which should now be [covered in SymbolLocatorDefault](https://github.com/llvm/llvm-project/blob/d00ed836e77759414afd40c02eeca5651657438f/lldb/source/Plugins/SymbolLocator/Default/SymbolLocatorDefault.cpp#L195).
What do you think?
https://github.com/llvm/llvm-project/pull/185658
More information about the lldb-commits
mailing list