[Lldb-commits] [PATCH] D119963: [LLDB] Dump valid ranges of variables
Zequan Wu via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Thu Feb 17 13:04:00 PST 2022
zequanwu added a comment.
> It is a little awkward to put it in "image lookup -va" however, and odder to have it be part of the printing of an Address. It seems more like something you should ask a function?
When you look up a function, using `image lookup -n main`, it
================
Comment at: lldb/test/Shell/SymbolFile/DWARF/x86/debug_loc.s:28-29
# CHECK: Variable{{.*}}, name = "x0", {{.*}}, scope = parameter, location =
# CHECK-NEXT: [0x0000000000000000, 0x0000000000000001): DW_OP_reg5 RDI
# CHECK-NEXT: [0x0000000000000001, 0x0000000000000006): DW_OP_reg0 RAX
# CHECK: Variable{{.*}}, name = "x1", {{.*}}, scope = parameter
----------------
labath wrote:
> zequanwu wrote:
> > `image dump symfile` already prints valid ranges for variables along with where the value is at each range.
> Are you sure it does?
>
> I was under the impression that there are two distinct range concepts being combined here. One is the range list member of the Variable object (as given by `GetScopeRange` -- that's the one you're printing now), and the other is the list of ranges hidden in the DWARFExpression object, which come from the debug_loc(lists) section (that's the one we've been printing so far). And that the root cause of the confusion is the very existence of these two concepts.
>
> If I got it wrong, then do let me know, cause it would make things a lot simpler if there is only one validity concept to think about.
Dwarf plugin is supposed to construct the `m_scope_range` member of an Variable, but it doesn't. `scope_ranges` is empty at https://github.com/llvm/llvm-project/blob/main/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp#L3468.
`image dump symfile` dumps the dwarf location list in `m_location` in `Variable`.
The dwarf location list has more information than `m_scope_range` as it contains info about where the value is during each range. (e.g. which register the variable lives in).
So, I think we need to use similar logic to construct `m_scope_range` when creating `Variable` in dwarf plugin like this https://github.com/llvm/llvm-project/blob/main/lldb/source/Expression/DWARFExpression.cpp#L145.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D119963/new/
https://reviews.llvm.org/D119963
More information about the lldb-commits
mailing list