[lld] r287723 - Dump not only type records but symbol records.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 22 15:51:35 PST 2016


Author: ruiu
Date: Tue Nov 22 17:51:34 2016
New Revision: 287723

URL: http://llvm.org/viewvc/llvm-project?rev=287723&view=rev
Log:
Dump not only type records but symbol records.

Modified:
    lld/trunk/COFF/PDB.cpp
    lld/trunk/test/COFF/dumppdb.test

Modified: lld/trunk/COFF/PDB.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/PDB.cpp?rev=287723&r1=287722&r2=287723&view=diff
==============================================================================
--- lld/trunk/COFF/PDB.cpp (original)
+++ lld/trunk/COFF/PDB.cpp Tue Nov 22 17:51:34 2016
@@ -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 *Sy
   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");
   }
 }
 

Modified: lld/trunk/test/COFF/dumppdb.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/dumppdb.test?rev=287723&r1=287722&r2=287723&view=diff
==============================================================================
--- lld/trunk/test/COFF/dumppdb.test (original)
+++ lld/trunk/test/COFF/dumppdb.test Tue Nov 22 17:51:34 2016
@@ -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:




More information about the llvm-commits mailing list