};
};
- 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;
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)
}
OS << "\n";
}
- OS << "\n";
}
}
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;
}
; 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
; 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
; 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: