[PATCH] D141679: [CodeGen][Dwarf] Generate global variable DIEs after all subprogram (and their abstract origin) DIEs
Juan Manuel Martinez CaamaƱo via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 13 05:18:13 PST 2023
jmmartinez created this revision.
Herald added subscribers: kosarev, mattd, gchakrabarti, asavonic, kerbowa, hiraditya, jvesely, nemanjai.
Herald added a project: All.
jmmartinez requested review of this revision.
Herald added subscribers: llvm-commits, jholewinski.
Herald added a project: LLVM.
In the case of static local variables, the associated `DW_TAG_variable`
child should be added in subprogram's `DW_AT_abstract_origin` in case
one exists.
To highlight the difference, compile and debug the following example with:
$ clang -g test.c -o a.out
$ gdb -ex "break g" -ex "run" -ex "print x" --args a.out
int __attribute__((always_inline)) g(int n) {
static int x[10];
int y = 1;
return x[n] + y;
}
int f(int n) { return g(n); }
int main(int argc, char *argv[]) {
return f(argc);
}
If the DIE for `x` is inserted as a child of the the DIE (with the tag `DW_TAG_subprogram`) associated to `g`,
then, when iterating over the inlined instructions of `g` we won't be
able to refer to `x`.
Annoyingly, this patch changes the order in which the dwarf info is
generated (which breaks way too many tests).
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D141679
Files:
llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
llvm/test/DebugInfo/AMDGPU/variable-locations.ll
llvm/test/DebugInfo/BPF/extern-void.ll
llvm/test/DebugInfo/Generic/cross-cu-linkonce-distinct.ll
llvm/test/DebugInfo/Generic/debug-names-linkage-name.ll
llvm/test/DebugInfo/Generic/namespace.ll
llvm/test/DebugInfo/NVPTX/debug-addr-class.ll
llvm/test/DebugInfo/PowerPC/strict-dwarf.ll
llvm/test/DebugInfo/X86/2011-09-26-GlobalVarContext.ll
llvm/test/DebugInfo/X86/DW_AT_calling-convention.ll
llvm/test/DebugInfo/X86/align_cpp11.ll
llvm/test/DebugInfo/X86/align_objc.ll
llvm/test/DebugInfo/X86/arange-and-stub.ll
llvm/test/DebugInfo/X86/containing-type-extension-rust.ll
llvm/test/DebugInfo/X86/debug-info-access.ll
llvm/test/DebugInfo/X86/debug-info-static-member.ll
llvm/test/DebugInfo/X86/dwarf-aranges.ll
llvm/test/DebugInfo/X86/dwarf-linkage-names.ll
llvm/test/DebugInfo/X86/dwarfdump-DIImportedEntity_elements.ll
llvm/test/DebugInfo/X86/generate-odr-hash.ll
llvm/test/DebugInfo/X86/gnu-public-names.ll
llvm/test/DebugInfo/X86/linkage-name.ll
llvm/test/DebugInfo/X86/namelist1.ll
llvm/test/DebugInfo/X86/prototyped.ll
llvm/test/DebugInfo/X86/ref_addr_relocation.ll
llvm/test/DebugInfo/X86/static-local-var.ll
llvm/test/DebugInfo/X86/string-offsets-multiple-cus.ll
llvm/test/DebugInfo/X86/string-offsets-table.ll
llvm/test/DebugInfo/X86/subprogram-across-cus.ll
llvm/test/DebugInfo/X86/template.ll
llvm/test/DebugInfo/X86/tls.ll
llvm/test/DebugInfo/X86/tu-to-non-tu.ll
llvm/test/DebugInfo/X86/vla-global.ll
llvm/test/DebugInfo/attr-btf_tag.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141679.488964.patch
Type: text/x-patch
Size: 72613 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230113/c4685be9/attachment.bin>
More information about the llvm-commits
mailing list