[llvm] r304446 - [DWARF] Introduce Dump Options
Adrian Prantl via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 1 11:18:23 PDT 2017
Author: adrian
Date: Thu Jun 1 13:18:23 2017
New Revision: 304446
URL: http://llvm.org/viewvc/llvm-project?rev=304446&view=rev
Log:
[DWARF] Introduce Dump Options
This commit introduces a structure that holds all the flags that
control the pretty printing of dwarf output.
Patch by Spyridoula Gravani!
Differential Revision: https://reviews.llvm.org/D33749
Modified:
llvm/trunk/include/llvm/DebugInfo/DIContext.h
llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFContext.h
llvm/trunk/include/llvm/DebugInfo/PDB/PDBContext.h
llvm/trunk/lib/DebugInfo/DWARF/DWARFContext.cpp
llvm/trunk/lib/DebugInfo/PDB/PDBContext.cpp
llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
llvm/trunk/tools/llvm-objdump/MachODump.cpp
llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp
Modified: llvm/trunk/include/llvm/DebugInfo/DIContext.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/DIContext.h?rev=304446&r1=304445&r2=304446&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/DIContext.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/DIContext.h Thu Jun 1 13:18:23 2017
@@ -146,6 +146,14 @@ enum DIDumpType {
DIDT_TUIndex,
};
+/// Container for dump options that control which debug information will be
+/// dumped.
+struct DIDumpOptions {
+ DIDumpType DumpType = DIDT_All;
+ bool DumpEH = false;
+ bool SummarizeTypes = false;
+};
+
class DIContext {
public:
enum DIContextKind {
@@ -158,8 +166,7 @@ public:
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.
Modified: llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFContext.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFContext.h?rev=304446&r1=304445&r2=304446&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFContext.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFContext.h Thu Jun 1 13:18:23 2017
@@ -105,8 +105,7 @@ public:
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;
Modified: llvm/trunk/include/llvm/DebugInfo/PDB/PDBContext.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/PDBContext.h?rev=304446&r1=304445&r2=304446&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/PDB/PDBContext.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/PDB/PDBContext.h Thu Jun 1 13:18:23 2017
@@ -41,8 +41,7 @@ namespace pdb {
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,
Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFContext.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFContext.cpp?rev=304446&r1=304445&r2=304446&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARF/DWARFContext.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARF/DWARFContext.cpp Thu Jun 1 13:18:23 2017
@@ -84,8 +84,12 @@ static void dumpAccelSection(raw_ostream
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);
Modified: llvm/trunk/lib/DebugInfo/PDB/PDBContext.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/PDBContext.cpp?rev=304446&r1=304445&r2=304446&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/PDBContext.cpp (original)
+++ llvm/trunk/lib/DebugInfo/PDB/PDBContext.cpp Thu Jun 1 13:18:23 2017
@@ -29,8 +29,7 @@ PDBContext::PDBContext(const COFFObjectF
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) {
Modified: llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp?rev=304446&r1=304445&r2=304446&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp (original)
+++ llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp Thu Jun 1 13:18:23 2017
@@ -95,8 +95,12 @@ static void DumpObjectFile(ObjectFile &O
outs() << Filename.str() << ":\tfile format " << Obj.getFileFormatName()
<< "\n\n";
+
// Dump the complete DWARF structure.
- DICtx->dump(outs(), DumpType, false, SummarizeTypes);
+ DIDumpOptions DumpOpts;
+ DumpOpts.DumpType = DumpType;
+ DumpOpts.SummarizeTypes = SummarizeTypes;
+ DICtx->dump(outs(), DumpOpts);
}
static void DumpInput(StringRef Filename) {
Modified: llvm/trunk/tools/llvm-objdump/MachODump.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objdump/MachODump.cpp?rev=304446&r1=304445&r2=304446&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objdump/MachODump.cpp (original)
+++ llvm/trunk/tools/llvm-objdump/MachODump.cpp Thu Jun 1 13:18:23 2017
@@ -1271,7 +1271,10 @@ static void ProcessMachO(StringRef Name,
if (DwarfDumpType != DIDT_Null) {
std::unique_ptr<DIContext> DICtx(new DWARFContextInMemory(*MachOOF));
// Dump the complete DWARF structure.
- DICtx->dump(outs(), DwarfDumpType, true /* DumpEH */);
+ DIDumpOptions DumpOpts;
+ DumpOpts.DumpType = DwarfDumpType;
+ DumpOpts.DumpEH = true;
+ DICtx->dump(outs(), DumpOpts);
}
}
Modified: llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp?rev=304446&r1=304445&r2=304446&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp (original)
+++ llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp Thu Jun 1 13:18:23 2017
@@ -2064,7 +2064,10 @@ static void DumpObject(ObjectFile *o, co
if (DwarfDumpType != DIDT_Null) {
std::unique_ptr<DIContext> DICtx(new DWARFContextInMemory(*o));
// Dump the complete DWARF structure.
- DICtx->dump(outs(), DwarfDumpType, true /* DumpEH */);
+ DIDumpOptions DumpOpts;
+ DumpOpts.DumpType = DwarfDumpType;
+ DumpOpts.DumpEH = true;
+ DICtx->dump(outs(), DumpOpts);
}
}
More information about the llvm-commits
mailing list