Index: include/llvm/DebugInfo/DIContext.h =================================================================== --- include/llvm/DebugInfo/DIContext.h +++ include/llvm/DebugInfo/DIContext.h @@ -146,6 +146,15 @@ DIDT_TUIndex, }; +/// DIDumpOptions - container for dump options that control which debug information will be dumped +struct DIDumpOptions { + DIDumpType DumpType; + bool DumpEH; + bool SummarizeTypes; + + DIDumpOptions() : DumpType(DIDT_All), DumpEH(false), SummarizeTypes(false) {} +}; + class DIContext { public: enum DIContextKind { @@ -158,8 +167,7 @@ DIContextKind getKind() const { return Kind; } - virtual void dump(raw_ostream &OS, DIDumpType DumpType = DIDT_All, - bool DumpEH = false, bool SummarizeTypes = false) = 0; + virtual void dump(raw_ostream &OS, DIDumpOptions DumpOpts) = 0; virtual bool verify(raw_ostream &OS, DIDumpType DumpType = DIDT_All) { // No verifier? Just say things went well. Index: include/llvm/DebugInfo/DWARF/DWARFContext.h =================================================================== --- include/llvm/DebugInfo/DWARF/DWARFContext.h +++ include/llvm/DebugInfo/DWARF/DWARFContext.h @@ -105,8 +105,7 @@ return DICtx->getKind() == CK_DWARF; } - void dump(raw_ostream &OS, DIDumpType DumpType = DIDT_All, - bool DumpEH = false, bool SummarizeTypes = false) override; + void dump(raw_ostream &OS, DIDumpOptions DumpOpts) override; bool verify(raw_ostream &OS, DIDumpType DumpType = DIDT_All) override; Index: include/llvm/DebugInfo/PDB/PDBContext.h =================================================================== --- include/llvm/DebugInfo/PDB/PDBContext.h +++ include/llvm/DebugInfo/PDB/PDBContext.h @@ -41,8 +41,7 @@ return DICtx->getKind() == CK_PDB; } - void dump(raw_ostream &OS, DIDumpType DumpType = DIDT_All, - bool DumpEH = false, bool SummarizeTypes = false) override; + void dump(raw_ostream &OS, DIDumpOptions DIDumpOpts) override; DILineInfo getLineInfoForAddress( uint64_t Address, Index: lib/DebugInfo/DWARF/DWARFContext.cpp =================================================================== --- lib/DebugInfo/DWARF/DWARFContext.cpp +++ lib/DebugInfo/DWARF/DWARFContext.cpp @@ -84,8 +84,12 @@ Accel.dump(OS); } -void DWARFContext::dump(raw_ostream &OS, DIDumpType DumpType, bool DumpEH, - bool SummarizeTypes) { +void DWARFContext::dump(raw_ostream &OS, DIDumpOptions DumpOpts){ + + DIDumpType DumpType = DumpOpts.DumpType; + bool DumpEH = DumpOpts.DumpEH; + bool SummarizeTypes = DumpOpts.SummarizeTypes; + if (DumpType == DIDT_All || DumpType == DIDT_Abbrev) { OS << ".debug_abbrev contents:\n"; getDebugAbbrev()->dump(OS); Index: lib/DebugInfo/PDB/PDBContext.cpp =================================================================== --- lib/DebugInfo/PDB/PDBContext.cpp +++ lib/DebugInfo/PDB/PDBContext.cpp @@ -29,8 +29,7 @@ Session->setLoadAddress(ImageBase.get()); } -void PDBContext::dump(raw_ostream &OS, DIDumpType DumpType, bool DumpEH, - bool SummarizeTypes) {} +void PDBContext::dump(raw_ostream &OS, DIDumpOptions DumpOpts){} DILineInfo PDBContext::getLineInfoForAddress(uint64_t Address, DILineInfoSpecifier Specifier) { Index: tools/llvm-dwarfdump/llvm-dwarfdump.cpp =================================================================== --- tools/llvm-dwarfdump/llvm-dwarfdump.cpp +++ tools/llvm-dwarfdump/llvm-dwarfdump.cpp @@ -95,8 +95,12 @@ outs() << Filename.str() << ":\tfile format " << Obj.getFileFormatName() << "\n\n"; - // Dump the complete DWARF structure. - DICtx->dump(outs(), DumpType, false, SummarizeTypes); + + // Dump the DWARF structure. DumpOpts controls the information to be dumped. + DIDumpOptions DumpOpts; + DumpOpts.DumpType = DumpType; + DumpOpts.SummarizeTypes = SummarizeTypes; + DICtx->dump(outs(), DumpOpts); } static void DumpInput(StringRef Filename) { Index: tools/llvm-objdump/MachODump.cpp =================================================================== --- tools/llvm-objdump/MachODump.cpp +++ tools/llvm-objdump/MachODump.cpp @@ -1270,8 +1270,11 @@ if (DwarfDumpType != DIDT_Null) { std::unique_ptr DICtx(new DWARFContextInMemory(*MachOOF)); - // Dump the complete DWARF structure. - DICtx->dump(outs(), DwarfDumpType, true /* DumpEH */); + // Dump the DWARF structure. DumpOpts controls the information to be dumped. + DIDumpOptions DumpOpts; + DumpOpts.DumpType = DwarfDumpType; + DumpOpts.DumpEH = true; + DICtx->dump(outs(), DumpOpts); } } Index: tools/llvm-objdump/llvm-objdump.cpp =================================================================== --- tools/llvm-objdump/llvm-objdump.cpp +++ tools/llvm-objdump/llvm-objdump.cpp @@ -2063,8 +2063,11 @@ printFaultMaps(o); if (DwarfDumpType != DIDT_Null) { std::unique_ptr DICtx(new DWARFContextInMemory(*o)); - // Dump the complete DWARF structure. - DICtx->dump(outs(), DwarfDumpType, true /* DumpEH */); + // Dump the DWARF structure. DumpOpts controls the information to be dumped. + DIDumpOptions DumpOpts; + DumpOpts.DumpType = DwarfDumpType; + DumpOpts.DumpEH = true; + DICtx->dump(outs(), DumpOpts); } }