[Lldb-commits] [lldb] [lldb] Add caching and _NT_SYMBOL_PATH parsing in SymbolLocatorSymStore (PR #191782)
Stefan Gränitz via lldb-commits
lldb-commits at lists.llvm.org
Fri Apr 17 09:04:49 PDT 2026
================
@@ -103,6 +112,79 @@ SymbolLocator *SymbolLocatorSymStore::CreateInstance() {
namespace {
+SymbolLocatorSymStore::LookupEntry MakeLookupEntry(llvm::StringRef source) {
+ SymbolLocatorSymStore::LookupEntry entry;
+ entry.source = source.str();
+ entry.cache = std::nullopt;
+ return entry;
+}
+
+SymbolLocatorSymStore::LookupEntry MakeLookupEntry(llvm::StringRef source,
+ llvm::StringRef cache) {
+ SymbolLocatorSymStore::LookupEntry entry;
+ entry.source = source.str();
+ entry.cache = cache.str();
+ return entry;
+}
+
+std::vector<SymbolLocatorSymStore::LookupEntry> GetGlobalLookupOrder() {
+ std::vector<SymbolLocatorSymStore::LookupEntry> result;
+
+ const char *sym_path = std::getenv("_NT_SYMBOL_PATH");
+ for (auto entry : SymbolLocatorSymStore::ParseEnvSymbolPaths(sym_path))
+ result.push_back(std::move(entry));
+
+ const char *alt_path = std::getenv("_NT_ALT_SYMBOL_PATH");
+ for (auto entry : SymbolLocatorSymStore::ParseEnvSymbolPaths(alt_path))
+ result.push_back(std::move(entry));
----------------
weliveindetail wrote:
On my machine WinDbg checks `_NT_SYMBOL_PATH` first and `_NT_ALT_SYMBOL_PATH` second. I'd vote to keep this behavior in LLDB as it is intuitive.
This is what I did with version 10.0.20348.1 vom Visual Studio 2022:
```
S:\pdb_test> set _NT_ALT_SYMBOL_PATH=C:\alt
S:\pdb_test> set _NT_SYMBOL_PATH=C:\sym
S:\pdb_test> cl /O2 /Zi /MD pdb_test.c /link /DEBUG /OUT:pdb_test_x64.exe /PDB:pdb_test_x64.pdb
S:\pdb_test> cp pdb_test_x64.exe C:\sym\
S:\pdb_test> mv pdb_test_x64.exe C:\alt\
S:\pdb_test> windbg pdb_test_x64.exe
Symbol search path is: C:\sym;C:\alt
...
0:000> !sym noisy
noisy mode - symbol prompts on
0:000> .reload /f
Reloading current modules
DBGHELP: pdb_test_x64 - private symbols & lines
c:\sym\pdb_test_x64.pdb
```
Here the log I get for a system lib from the same session. Looking at the last path, the documentation drift is my least concern haha 🤷♂️
```
DBGHELP: c:\sym\vcruntime140.amd64.pdb - file not found
DBGHELP: c:\sym\dll\vcruntime140.amd64.pdb - file not found
DBGHELP: c:\sym\symbols\dll\vcruntime140.amd64.pdb - file not found
DBGHELP: c:\alt\vcruntime140.amd64.pdb - file not found
DBGHELP: c:\alt\dll\vcruntime140.amd64.pdb - file not found
DBGHELP: c:\alt\symbols\dll\vcruntime140.amd64.pdb - file not found
DBGHELP: C:\WINDOWS\SYSTEM32\vcruntime140.amd64.pdb - file not found
DBGHELP: D:\a\_work\1\s\binaries\amd64ret\bin\amd64\\vcruntime140.amd64.pdb - file not found
DBGHELP: VCRUNTIME140 - export symbols
```
https://github.com/llvm/llvm-project/pull/191782
More information about the lldb-commits
mailing list