[PATCH] D80945: [DebugInfo] Fix a fatal error originating from split-macro support
Sourabh Singh Tomar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 1 12:26:06 PDT 2020
SouraVX updated this revision to Diff 267697.
SouraVX added a comment.
Added corrected test case.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D80945/new/
https://reviews.llvm.org/D80945
Files:
llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
llvm/test/DebugInfo/X86/debug-macro-dwo.ll
Index: llvm/test/DebugInfo/X86/debug-macro-dwo.ll
===================================================================
--- llvm/test/DebugInfo/X86/debug-macro-dwo.ll
+++ llvm/test/DebugInfo/X86/debug-macro-dwo.ll
@@ -9,7 +9,7 @@
; CHECK-LABEL: .debug_macro.dwo contents:
; CHECK-NEXT: 0x00000000:
-; CHECK-NEXT: macro header: version = 0x0005, flags = 0x02
+; CHECK-NEXT: macro header: version = 0x0005, flags = 0x00
; CHECK-NEXT: DW_MACRO_start_file - lineno: 0 filenum: 0
; CHECK-NEXT: DW_MACRO_start_file - lineno: 1 filenum: 1
; CHECK-NEXT: DW_MACRO_define_strx - lineno: 1 macro: FOO 5
Index: llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
===================================================================
--- llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -2894,18 +2894,25 @@
#define HANDLE_MACRO_FLAG(ID, NAME) MACRO_FLAG_##NAME = ID,
#include "llvm/BinaryFormat/Dwarf.def"
};
+ // Flags `0` in macro section header implies DWARF32.
uint8_t Flags = 0;
Asm->OutStreamer->AddComment("Macro information version");
Asm->emitInt16(5);
- // We are setting Offset and line offset flags unconditionally here,
- // since we're only supporting DWARF32 and line offset should be mostly
- // present.
+ // We are setting DWARF32 and line offset flags unconditionally here
+ // for non-split case, since we're only supporting DWARF32 and line
+ // offset should be mostly present.
// FIXME: Add support for DWARF64.
- Flags |= MACRO_FLAG_DEBUG_LINE_OFFSET;
- Asm->OutStreamer->AddComment("Flags: 32 bit, debug_line_offset present");
- Asm->emitInt8(Flags);
- Asm->OutStreamer->AddComment("debug_line_offset");
- Asm->OutStreamer->emitSymbolValue(CU.getLineTableStartSym(), /*Size=*/4);
+ if (!DD.useSplitDwarf()) {
+ Flags |= MACRO_FLAG_DEBUG_LINE_OFFSET;
+ Asm->OutStreamer->AddComment("Flags: 32 bit, debug_line_offset present");
+ Asm->emitInt8(Flags);
+ Asm->OutStreamer->AddComment("debug_line_offset");
+ Asm->OutStreamer->emitSymbolValue(CU.getLineTableStartSym(), /*Size=*/4);
+ } else {
+ // FIXME: Add support for debug_ling_offset in .debug_macro.dwo.
+ Asm->OutStreamer->AddComment("Flags: 32 bit");
+ Asm->emitInt8(Flags);
+ }
}
void DwarfDebug::handleMacroNodes(DIMacroNodeArray Nodes, DwarfCompileUnit &U) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80945.267697.patch
Type: text/x-patch
Size: 2335 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200601/0d82eeb6/attachment.bin>
More information about the llvm-commits
mailing list