[llvm] 0a72515 - [DebugInfo] Fix v4 macinfo for dwo files.
Sourabh Singh Tomar via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 23 23:21:25 PST 2019
Author: Sourabh Singh Tomar
Date: 2019-12-24T12:50:34+05:30
New Revision: 0a72515d33bb1931ca8ad4022f743a33a203ea33
URL: https://github.com/llvm/llvm-project/commit/0a72515d33bb1931ca8ad4022f743a33a203ea33
DIFF: https://github.com/llvm/llvm-project/commit/0a72515d33bb1931ca8ad4022f743a33a203ea33.diff
LOG: [DebugInfo] Fix v4 macinfo for dwo files.
Dwo files must contain have DW_AT_macro_info attribute, when macro information is emitted. Adjusted the test case
for the same.
Added:
Modified:
llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
llvm/test/DebugInfo/X86/debug-macinfo-split-dwarf.ll
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index 624e1a513ec6..b91f613f1ceb 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -1193,10 +1193,15 @@ void DwarfDebug::finalizeModuleInfo() {
auto *CUNode = cast<DICompileUnit>(P.first);
// If compile Unit has macros, emit "DW_AT_macro_info" attribute.
- if (CUNode->getMacros() && !useSplitDwarf())
- U.addSectionLabel(U.getUnitDie(), dwarf::DW_AT_macro_info,
- U.getMacroLabelBegin(),
- TLOF.getDwarfMacinfoSection()->getBeginSymbol());
+ if (CUNode->getMacros())
+ if (useSplitDwarf())
+ TheCU.addLabelDelta(TheCU.getUnitDie(), dwarf::DW_AT_macro_info,
+ U.getMacroLabelBegin(),
+ TLOF.getDwarfMacinfoDWOSection()->getBeginSymbol());
+ else
+ U.addSectionLabel(U.getUnitDie(), dwarf::DW_AT_macro_info,
+ U.getMacroLabelBegin(),
+ TLOF.getDwarfMacinfoSection()->getBeginSymbol());
}
// Emit all frontend-produced Skeleton CUs, i.e., Clang modules.
diff --git a/llvm/test/DebugInfo/X86/debug-macinfo-split-dwarf.ll b/llvm/test/DebugInfo/X86/debug-macinfo-split-dwarf.ll
index 07a53225ace7..43255f2c4cef 100644
--- a/llvm/test/DebugInfo/X86/debug-macinfo-split-dwarf.ll
+++ b/llvm/test/DebugInfo/X86/debug-macinfo-split-dwarf.ll
@@ -1,5 +1,10 @@
; RUN: %llc_dwarf -O0 -split-dwarf-file=foo.dwo -filetype=obj < %s | llvm-dwarfdump -v - | FileCheck %s
+; CHECK-LABEL:.debug_info.dwo contents:
+; CHECK: DW_AT_GNU_dwo_name [DW_FORM_GNU_str_index] (indexed (00000006) string = "foo.dwo")
+; CHECK-NEXT: DW_AT_GNU_dwo_id [DW_FORM_data8] (0xe0f109905cbe1fe4)
+; CHECK-NEXT: DW_AT_macro_info [DW_FORM_data4] (0x00000000)
+
;CHECK-LABEL:.debug_macinfo.dwo contents:
;CHECK-NEXT: DW_MACINFO_start_file - lineno: 0 filenum: 1
;CHECK-NEXT: DW_MACINFO_start_file - lineno: 1 filenum: 2
More information about the llvm-commits
mailing list