[Lldb-commits] [PATCH] D94064: lldb: Add support for printing variables with DW_AT_ranges on DW_TAG_subprograms
Pavel Labath via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Sun Jan 24 12:07:19 PST 2021
labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.
In D94064#2516883 <https://reviews.llvm.org/D94064#2516883>, @dblaikie wrote:
> Ah, thanks - think I figured out a representative test & understand better.
> I ended up with this:
>
> __attribute__((nodebug)) volatile int i;
> int main() {
> int var = 3;
> i = 1;
> var = 5;
> i = 2;
> }
>
> By using volatile writes, I was able to get the 'var' variable live range to start at the start of the function (so that `image lookup -v -s main` would render the "var" variable since it's now live at the very start of the function (rather than only after the push instruction)). And use nodebug to reduce the DWARF since the 'i' isn't interesting.
>
> Indeed without the fix you suggested to use "lowest address" rather than zero, this test above would/was failing (running the image lookup command would not show the "var" variable).
>
> Also, I figured out how to run the API tests, and that showed a bunch more failures when using ranges-everywhere (actually a more aggressive version of ranges-everywhere - using it no matter the DWARF version and even when it wouldn't reduce the address pool size (eg: using ranges on a subprogram even when low_pc is an address already in the pool (such as for the start of a CU range))) - and with the change to use the lowest address of the ranges, all those failures now go away.
>
> So *fingers crossed* this is ready.
/me too
================
Comment at: lldb/test/Shell/SymbolFile/DWARF/subprogram_ranges.test:22
+# initialization/no prologue instructions, so the location of "var" is valid
+# at the start of the function, so 'image lookup -v -s main' will include it.
+#
----------------
btw, the way I've dealt with this in the past is to introduce an additional label in the assembly (`look_me_up:`), and then give that to the image lookup command.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D94064/new/
https://reviews.llvm.org/D94064
More information about the lldb-commits
mailing list