Dump not only type records but symbol records.

llvm-svn: 287723
This commit is contained in:
Rui Ueyama 2016-11-22 23:51:34 +00:00
parent eaf0ada683
commit 24625fd9b2
2 changed files with 23 additions and 4 deletions

View File

@ -13,7 +13,9 @@
#include "Error.h"
#include "SymbolTable.h"
#include "Symbols.h"
#include "llvm/DebugInfo/CodeView/SymbolDumper.h"
#include "llvm/DebugInfo/CodeView/TypeDumper.h"
#include "llvm/DebugInfo/MSF/ByteStream.h"
#include "llvm/DebugInfo/MSF/MSFBuilder.h"
#include "llvm/DebugInfo/MSF/MSFCommon.h"
#include "llvm/DebugInfo/PDB/Raw/DbiStream.h"
@ -63,13 +65,27 @@ static void dumpCodeView(SymbolTable *Symtab) {
ScopedPrinter W(outs());
for (ObjectFile *File : Symtab->ObjectFiles) {
SectionChunk *C = findByName(File->getDebugChunks(), ".debug$T");
if (!C)
SectionChunk *DebugT = findByName(File->getDebugChunks(), ".debug$T");
if (!DebugT)
continue;
CVTypeDumper TypeDumper(&W, false);
if (auto EC = TypeDumper.dump(C->getContents()))
if (auto EC = TypeDumper.dump(DebugT->getContents()))
fatal(EC, "CVTypeDumper::dump failed");
SectionChunk *DebugS = findByName(File->getDebugChunks(), ".debug$S");
if (!DebugS)
continue;
msf::ByteStream Stream(DebugS->getContents());
CVSymbolArray Symbols;
msf::StreamReader Reader(Stream);
if (auto EC = Reader.readArray(Symbols, Reader.getLength()))
fatal(EC, "StreamReader.readArray<CVSymbolArray> failed");
CVSymbolDumper SymbolDumper(W, TypeDumper, nullptr, false);
if (auto EC = SymbolDumper.dump(Symbols))
fatal(EC, "CVSymbolDumper::dump failed");
}
}

View File

@ -7,7 +7,10 @@
# CHECK-NEXT: Kind: 0x0
# CHECK-NEXT: Length: 2
# CHECK-NEXT: }
# CHECK-NEXT: UnknownSym {
# CHECK-NEXT: Kind: 0x0
# CHECK-NEXT: Length: 6
# CHECK-NEXT: }
--- !COFF
header: