mirror of
https://github.com/RPCS3/llvm.git
synced 2025-02-25 13:20:57 +00: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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304446 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
7dc680c89a
commit
ad988ad98b
@ -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.
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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);
|
||||
|
@ -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) {
|
||||
|
@ -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) {
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user