[Lldb-commits] [lldb] [lldb][NativePDB] Name global variables like Clang and DWARF do (PR #230563)
via lldb-commits
lldb-commits at lists.llvm.org
Wed Oct 14 07:58:08 PDT 2026
================
@@ -2224,11 +2236,16 @@ void SymbolFileNativePDB::FindGlobalVariables(
CacheGlobalBaseNames();
+ // A leading "::" requests a variable from the global namespace.
+ llvm::StringRef lookup_name = name.GetStringRef();
+ bool is_rooted = lookup_name.consume_front("::");
----------------
Nerixyz wrote:
This doesn't seem to match what DWARF does.
For
```cpp
int myGlobal = 42;
namespace foo {
char inNs = 3;
}
int main() { return 1; }
```
i get
```
(lldb) target var myGlobal
(int) myGlobal = 42
(lldb) target var ::myGlobal
(int) ::myGlobal = 42
(lldb) target var foo::inNs
(char) foo::inNs = '\x03'
(lldb) target var ::inNs
(char) ::inNs = '\x03'
(lldb) target var ::foo::inNs
error: can't find global variable '::foo::inNs'
```
https://github.com/llvm/llvm-project/pull/230563
More information about the lldb-commits
mailing list