From cac29ae03812a3e1c81c3eba4e9b57173d367604 Mon Sep 17 00:00:00 2001 From: Zachary Turner Date: Tue, 24 May 2016 17:30:25 +0000 Subject: Dump symbol record details in llvm-pdbdump This makes use of the newly introduced `CVSymbolVisitor` to dump details of each type of symbol record in the symbol streams. Future patches will bring this visitor based dumping to the publics stream, as well as creating a `SymbolDumpDelegate` to print more information about relocations etc. Differential Revision: http://reviews.llvm.org/D20545 Reviewed By: ruiu llvm-svn: 270585 --- llvm/lib/DebugInfo/CodeView/SymbolDumper.cpp | 8 ++++---- llvm/lib/DebugInfo/CodeView/TypeDumper.cpp | 15 +++++++++++---- 2 files changed, 15 insertions(+), 8 deletions(-) (limited to 'llvm/lib/DebugInfo/CodeView') diff --git a/llvm/lib/DebugInfo/CodeView/SymbolDumper.cpp b/llvm/lib/DebugInfo/CodeView/SymbolDumper.cpp index ab69240f2e5..d41d7d64ae1 100644 --- a/llvm/lib/DebugInfo/CodeView/SymbolDumper.cpp +++ b/llvm/lib/DebugInfo/CodeView/SymbolDumper.cpp @@ -599,9 +599,9 @@ void CVSymbolDumperImpl::visitProcSym(SymbolKind Kind, ProcSym &Proc) { void CVSymbolDumperImpl::visitScopeEndSym(SymbolKind Kind, ScopeEndSym &ScopeEnd) { if (Kind == SymbolKind::S_END) - W.startLine() << "BlockEnd\n"; + DictScope S(W, "BlockEnd"); else if (Kind == SymbolKind::S_PROC_ID_END) - W.startLine() << "ProcEnd\n"; + DictScope S(W, "ProcEnd"); else if (Kind == SymbolKind::S_INLINESITE_END) DictScope S(W, "InlineSiteEnd"); @@ -648,8 +648,8 @@ void CVSymbolDumperImpl::visitUDTSym(SymbolKind Kind, UDTSym &UDT) { void CVSymbolDumperImpl::visitUnknownSymbol(SymbolKind Kind, ArrayRef Data) { DictScope S(W, "UnknownSym"); - W.printHex("Kind", unsigned(Kind)); - W.printHex("Size", Data.size()); + W.printEnum("Kind", Kind, makeArrayRef(SymbolTypeNames)); + W.printNumber("Length", Data.size()); } bool CVSymbolDumper::dump(const SymbolIterator::Record &Record) { diff --git a/llvm/lib/DebugInfo/CodeView/TypeDumper.cpp b/llvm/lib/DebugInfo/CodeView/TypeDumper.cpp index 50a7e6c841b..72e0e44ce26 100644 --- a/llvm/lib/DebugInfo/CodeView/TypeDumper.cpp +++ b/llvm/lib/DebugInfo/CodeView/TypeDumper.cpp @@ -656,19 +656,26 @@ void CVTypeDumper::printTypeIndex(StringRef FieldName, TypeIndex TI) { if (!TI.isNoType()) TypeName = getTypeName(TI); if (!TypeName.empty()) - W.printHex(FieldName, TypeName, TI.getIndex()); + W->printHex(FieldName, TypeName, TI.getIndex()); else - W.printHex(FieldName, TI.getIndex()); + W->printHex(FieldName, TI.getIndex()); } bool CVTypeDumper::dump(const TypeIterator::Record &Record) { - CVTypeDumperImpl Dumper(*this, W, PrintRecordBytes); + assert(W && "printer should not be null"); + CVTypeDumperImpl Dumper(*this, *W, PrintRecordBytes); Dumper.visitTypeRecord(Record); return !Dumper.hadError(); } bool CVTypeDumper::dump(ArrayRef Data) { - CVTypeDumperImpl Dumper(*this, W, PrintRecordBytes); + assert(W && "printer should not be null"); + CVTypeDumperImpl Dumper(*this, *W, PrintRecordBytes); Dumper.visitTypeStream(Data); return !Dumper.hadError(); } + +void CVTypeDumper::setPrinter(ScopedPrinter *P) { + static ScopedPrinter NullP(llvm::nulls()); + W = P ? P : &NullP; +} -- cgit v1.2.3