1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00

[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

llvm-svn: 304446
This commit is contained in:
Adrian Prantl 2017-06-01 18:18:23 +00:00
parent bd55e94810
commit 2a294c6191
8 changed files with 31 additions and 13 deletions

View File

@ -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.

View File

@ -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;

View File

@ -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,

View File

@ -84,8 +84,12 @@ static void dumpAccelSection(raw_ostream &OS, StringRef Name,
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);

View File

@ -29,8 +29,7 @@ PDBContext::PDBContext(const COFFObjectFile &Object,
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) {

View File

@ -95,8 +95,12 @@ static void DumpObjectFile(ObjectFile &Obj, Twine Filename) {
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) {

View File

@ -1271,7 +1271,10 @@ static void ProcessMachO(StringRef Name, MachOObjectFile *MachOOF,
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);
}
}

View File

@ -2064,7 +2064,10 @@ static void DumpObject(ObjectFile *o, const Archive *a = nullptr) {
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);
}
}