Loading llvm/include/llvm/DebugInfo/DWARF/DWARFDebugMacro.h +4 −1 Original line number Diff line number Diff line Loading @@ -39,7 +39,10 @@ class DWARFDebugMacro { }; }; using MacroList = SmallVector<Entry, 4>; struct MacroList { SmallVector<Entry, 4> Macros; uint64_t Offset; }; /// A list of all the macro entries in the debug_macinfo section. std::vector<MacroList> MacroLists; Loading llvm/lib/DebugInfo/DWARF/DWARFDebugMacro.cpp +6 −4 Original line number Diff line number Diff line Loading @@ -18,7 +18,8 @@ using namespace dwarf; void DWARFDebugMacro::dump(raw_ostream &OS) const { unsigned IndLevel = 0; for (const auto &Macros : MacroLists) { for (const Entry &E : Macros) { OS << format("0x%08" PRIx64 ":\n", Macros.Offset); for (const Entry &E : Macros.Macros) { // There should not be DW_MACINFO_end_file when IndLevel is Zero. However, // this check handles the case of corrupted ".debug_macinfo" section. if (IndLevel > 0) Loading Loading @@ -51,7 +52,6 @@ void DWARFDebugMacro::dump(raw_ostream &OS) const { } OS << "\n"; } OS << "\n"; } } Loading @@ -62,15 +62,17 @@ void DWARFDebugMacro::parse(DataExtractor data) { if (!M) { MacroLists.emplace_back(); M = &MacroLists.back(); M->Offset = Offset; } // A macro list entry consists of: M->emplace_back(); Entry &E = M->back(); M->Macros.emplace_back(); Entry &E = M->Macros.back(); // 1. Macinfo type E.Type = data.getULEB128(&Offset); if (E.Type == 0) { // Reached end of a ".debug_macinfo" section contribution. M = nullptr; continue; } Loading llvm/test/DebugInfo/X86/debug-macinfo-split-dwarf.ll +1 −0 Original line number Diff line number Diff line Loading @@ -8,6 +8,7 @@ ; CHECK: DW_AT_macro_info (0x00000000) ;CHECK-LABEL:.debug_macinfo.dwo contents: ;CHECK-NEXT: 0x00000000: ;CHECK-NEXT: DW_MACINFO_start_file - lineno: 0 filenum: 1 ;CHECK-NEXT: DW_MACINFO_start_file - lineno: 1 filenum: 2 ;CHECK-NEXT: DW_MACINFO_define - lineno: 1 macro: define_1 12 Loading llvm/test/DebugInfo/X86/debug-macro.ll +4 −2 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ ; CHECK-NOT: DW_AT_macro_info ; CHECK-LABEL: .debug_macinfo contents: ; CHECK-NEXT: 0x00000000: ; CHECK-NEXT: DW_MACINFO_define - lineno: 0 macro: NameCMD ValueCMD ; CHECK-NEXT: DW_MACINFO_start_file - lineno: 0 filenum: 1 ; CHECK-NEXT: DW_MACINFO_start_file - lineno: 9 filenum: 2 Loading @@ -24,8 +25,9 @@ ; CHECK-NEXT: DW_MACINFO_end_file ; CHECK-NEXT: DW_MACINFO_undef - lineno: 10 macro: NameUndef2 ; CHECK-NEXT: DW_MACINFO_end_file ; CHECK: DW_MACINFO_start_file - lineno: 0 filenum: 1 ; CHECK-EMPTY: ; CHECK-NEXT: 0x00000045: ; CHECK-NEXT: DW_MACINFO_start_file - lineno: 0 filenum: 1 ; CHECK-NEXT: DW_MACINFO_end_file ; CHECK-LABEL: .debug_line contents: Loading Loading
llvm/include/llvm/DebugInfo/DWARF/DWARFDebugMacro.h +4 −1 Original line number Diff line number Diff line Loading @@ -39,7 +39,10 @@ class DWARFDebugMacro { }; }; using MacroList = SmallVector<Entry, 4>; struct MacroList { SmallVector<Entry, 4> Macros; uint64_t Offset; }; /// A list of all the macro entries in the debug_macinfo section. std::vector<MacroList> MacroLists; Loading
llvm/lib/DebugInfo/DWARF/DWARFDebugMacro.cpp +6 −4 Original line number Diff line number Diff line Loading @@ -18,7 +18,8 @@ using namespace dwarf; void DWARFDebugMacro::dump(raw_ostream &OS) const { unsigned IndLevel = 0; for (const auto &Macros : MacroLists) { for (const Entry &E : Macros) { OS << format("0x%08" PRIx64 ":\n", Macros.Offset); for (const Entry &E : Macros.Macros) { // There should not be DW_MACINFO_end_file when IndLevel is Zero. However, // this check handles the case of corrupted ".debug_macinfo" section. if (IndLevel > 0) Loading Loading @@ -51,7 +52,6 @@ void DWARFDebugMacro::dump(raw_ostream &OS) const { } OS << "\n"; } OS << "\n"; } } Loading @@ -62,15 +62,17 @@ void DWARFDebugMacro::parse(DataExtractor data) { if (!M) { MacroLists.emplace_back(); M = &MacroLists.back(); M->Offset = Offset; } // A macro list entry consists of: M->emplace_back(); Entry &E = M->back(); M->Macros.emplace_back(); Entry &E = M->Macros.back(); // 1. Macinfo type E.Type = data.getULEB128(&Offset); if (E.Type == 0) { // Reached end of a ".debug_macinfo" section contribution. M = nullptr; continue; } Loading
llvm/test/DebugInfo/X86/debug-macinfo-split-dwarf.ll +1 −0 Original line number Diff line number Diff line Loading @@ -8,6 +8,7 @@ ; CHECK: DW_AT_macro_info (0x00000000) ;CHECK-LABEL:.debug_macinfo.dwo contents: ;CHECK-NEXT: 0x00000000: ;CHECK-NEXT: DW_MACINFO_start_file - lineno: 0 filenum: 1 ;CHECK-NEXT: DW_MACINFO_start_file - lineno: 1 filenum: 2 ;CHECK-NEXT: DW_MACINFO_define - lineno: 1 macro: define_1 12 Loading
llvm/test/DebugInfo/X86/debug-macro.ll +4 −2 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ ; CHECK-NOT: DW_AT_macro_info ; CHECK-LABEL: .debug_macinfo contents: ; CHECK-NEXT: 0x00000000: ; CHECK-NEXT: DW_MACINFO_define - lineno: 0 macro: NameCMD ValueCMD ; CHECK-NEXT: DW_MACINFO_start_file - lineno: 0 filenum: 1 ; CHECK-NEXT: DW_MACINFO_start_file - lineno: 9 filenum: 2 Loading @@ -24,8 +25,9 @@ ; CHECK-NEXT: DW_MACINFO_end_file ; CHECK-NEXT: DW_MACINFO_undef - lineno: 10 macro: NameUndef2 ; CHECK-NEXT: DW_MACINFO_end_file ; CHECK: DW_MACINFO_start_file - lineno: 0 filenum: 1 ; CHECK-EMPTY: ; CHECK-NEXT: 0x00000045: ; CHECK-NEXT: DW_MACINFO_start_file - lineno: 0 filenum: 1 ; CHECK-NEXT: DW_MACINFO_end_file ; CHECK-LABEL: .debug_line contents: Loading