diff options
| author | Rui Ueyama <ruiu@google.com> | 2016-11-22 23:51:34 +0000 |
|---|---|---|
| committer | Rui Ueyama <ruiu@google.com> | 2016-11-22 23:51:34 +0000 |
| commit | 24625fd9b27220531a4a40fa700d5423e372f0cf (patch) | |
| tree | 287b5446b7088871fc1bdcde15cf29b74bdc1329 | |
| parent | eaf0ada683f43d0f889af4ec7bf651b701f73873 (diff) | |
| download | bcm5719-llvm-24625fd9b27220531a4a40fa700d5423e372f0cf.tar.gz bcm5719-llvm-24625fd9b27220531a4a40fa700d5423e372f0cf.zip | |
Dump not only type records but symbol records.
llvm-svn: 287723
| -rw-r--r-- | lld/COFF/PDB.cpp | 22 | ||||
| -rw-r--r-- | lld/test/COFF/dumppdb.test | 5 |
2 files changed, 23 insertions, 4 deletions
diff --git a/lld/COFF/PDB.cpp b/lld/COFF/PDB.cpp index 97b7f691dd7..81eea32f689 100644 --- a/lld/COFF/PDB.cpp +++ b/lld/COFF/PDB.cpp @@ -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"); } } diff --git a/lld/test/COFF/dumppdb.test b/lld/test/COFF/dumppdb.test index fbf977ccff2..2bb2c8cab41 100644 --- a/lld/test/COFF/dumppdb.test +++ b/lld/test/COFF/dumppdb.test @@ -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: |

