[Lldb-commits] [PATCH] D77698: [DWARF] Assign the correct scope to constant variables

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Apr 7 23:22:27 PDT 2020


labath added a reviewer: aprantl.
labath added a comment.

> I also need to craft a testcase. Ideas on how to do this are appreciated

You could check in the assembly generated by clang for this test case and then run `llvm-mc && lldb-test symbols` over it. Currently I get something like `Variable{0x7fffffff0000007f}, name = "b", type = {7fffffff00000044} 0x0000564FADF7F9F0 (int), scope = ??? (2)` when running that. After this patch that should presumably say `scope = local`. That won't actually check that the "frame variable" command succeeds, but maybe that's enough for this patch?

Using llvm ir instead of assembly might work too .. the relevant ir (`call void @llvm.dbg.value(metadata i32 3, metadata !16, metadata !DIExpression()), !dbg !18`) generates `DW_AT_const_value` even without any further optimizations, and it looks like it could be reasonably expected to keep doing that in the future. Adding @aprantl for IR insights.



================
Comment at: lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp:1028-1032
+      // Even if this is a function level static, we don't add it. We
+      // could theoretically add these if we wanted to by
+      // introspecting into the DW_AT_location and seeing if the
+      // location describes a hard coded address, but we don't want
+      // the performance penalty of that right now.
----------------
This comment does not make sense in the new setting.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77698/new/

https://reviews.llvm.org/D77698





More information about the lldb-commits mailing list