[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 11:34:43 PST 2022


zequanwu added inline comments.


================
Comment at: lldb/test/Shell/SymbolFile/DWARF/x86/debug_loc.s:16
+# CHECK-LABEL: image lookup -v -a 0 -R
+# CHECK: Variable: {{.*}}, name = "x0", type = "int", location = DW_OP_reg5 RDI, decl = , valid ranges =
+# CHECK: Variable: {{.*}}, name = "x1", type = "int", location = <empty>, decl = , valid ranges =
----------------
labath wrote:
> I don't think that the information itself is out of place here, but I think it can get confusing when one sees it like this, next to the `location` field. So, if we had an output like `location = RDI, valid ranges = [0, 20)`, I think one would/could read it as "the variable is in RDI from PC=0 to PC=20", but what it _really_ is telling you is "the variable (or its value -- I'm not sure) exists between PC=0 and PC=20, *and* for the exact PC that you are querying (0 in this case), it's value happens to be in RDI".
> 
> We could try to come up with a way to make this less confusing, but maybe we could just sidestep this problem and just print this information in the `image dump symfile` output.
I think this confusion can be solved by adding an argument for `--show-variable-ranges`. When only `--show-variable-ranges` is given, dump only the range that covers the querying address. When it comes with `all` argument, dump all valid ranges.


================
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
----------------
`image dump symfile` already prints valid ranges for variables along with where the value is at each range.


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