[Lldb-commits] [lldb] [lldb] Lookup static const members in FindGlobalVariables (PR #111859)
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Fri Oct 11 01:02:28 PDT 2024
https://github.com/labath commented:
I think this is a very interesting patch and, at some point, I wanted to do something similar as well. At the same time, I am somewhat worried about the performance impact of the extra lookups.
I think we may want to implement this in a slightly different matter: find the unique definition DIE for the given type (we use that concept when parsing types) and then search for child inside that -- instead of searching through all (possibly one per CU) definitions of that type.
However, before we go down that path, I want to note that something like what you want is already possible using the python API:
```
(lldb) target var Vars::static_constexpr
error: can't find global variable 'Vars::static_constexpr'
(lldb) script lldb.target.FindFirstType("Vars").GetStaticFieldWithName("static_constexpr").GetConstantValue(lldb.target)
(const int) static_constexpr = 2
```
It would still be nice if the "target variable" command worked as well, but:
- I'm a little less concerned about that given that it works for dwarf v5 (clang default)
- you should be using the python API (instead of expression evaluation) in the data formatter anyway, as it's faster and more reliable
https://github.com/llvm/llvm-project/pull/111859
More information about the lldb-commits
mailing list