summaryrefslogtreecommitdiff
path: root/tools/llvm-pdbutil
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2017-08-09 04:23:59 +0000
committerZachary Turner <zturner@google.com>2017-08-09 04:23:59 +0000
commited601f1b51b783546ea05758cf76f21254d38e27 (patch)
treea877c6b9eb8e006e166fd17c0f6aced6da3591cd /tools/llvm-pdbutil
parent3be08b1e5e1d5f97c68347bef921e7fb07620926 (diff)
[PDB] Fix an issue writing the publics stream.
In the refactor to merge the publics and globals stream, a bug was introduced that wrote the wrong value for one of the fields of the PublicsStreamHeader. This caused debugging in WinDbg to break. We had no way of dumping any of these fields, so in addition to fixing the bug I've added dumping support for them along with a test that verifies the correct value is written. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310439 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-pdbutil')
-rw-r--r--tools/llvm-pdbutil/DumpOutputStyle.cpp55
1 files changed, 37 insertions, 18 deletions
diff --git a/tools/llvm-pdbutil/DumpOutputStyle.cpp b/tools/llvm-pdbutil/DumpOutputStyle.cpp
index 73e4a14a854..bc0bb0830d9 100644
--- a/tools/llvm-pdbutil/DumpOutputStyle.cpp
+++ b/tools/llvm-pdbutil/DumpOutputStyle.cpp
@@ -896,6 +896,13 @@ Error DumpOutputStyle::dumpPublics() {
auto &Publics = Err(File.getPDBPublicsStream());
const GSIHashTable &PublicsTable = Publics.getPublicsTable();
+ if (opts::dump::DumpPublicExtras) {
+ P.printLine("Publics Header");
+ AutoIndent Indent(P);
+ P.formatLine("sym hash = {0}, thunk table addr = {1}", Publics.getSymHash(),
+ formatSegmentOffset(Publics.getThunkTableSection(),
+ Publics.getThunkTableOffset()));
+ }
Err(dumpSymbolsFromGSI(PublicsTable, opts::dump::DumpPublicExtras));
// Skip the rest if we aren't dumping extras.
@@ -941,30 +948,42 @@ Error DumpOutputStyle::dumpSymbolsFromGSI(const GSIHashTable &Table,
auto ExpectedIds = initializeTypes(StreamIPI);
if (!ExpectedIds)
return ExpectedIds.takeError();
- SymbolVisitorCallbackPipeline Pipeline;
- SymbolDeserializer Deserializer(nullptr, CodeViewContainer::Pdb);
- MinimalSymbolDumper Dumper(P, opts::dump::DumpSymRecordBytes, *ExpectedIds,
- *ExpectedTypes);
-
- Pipeline.addCallbackToPipeline(Deserializer);
- Pipeline.addCallbackToPipeline(Dumper);
- CVSymbolVisitor Visitor(Pipeline);
-
- BinaryStreamRef SymStream =
- ExpectedSyms->getSymbolArray().getUnderlyingStream();
- for (uint32_t PubSymOff : Table) {
- Expected<CVSymbol> Sym = readSymbolFromStream(SymStream, PubSymOff);
- if (!Sym)
- return Sym.takeError();
- if (auto E = Visitor.visitSymbolRecord(*Sym, PubSymOff))
- return E;
+
+ if (HashExtras) {
+ P.printLine("GSI Header");
+ AutoIndent Indent(P);
+ P.formatLine("sig = {0:X}, hdr = {1:X}, hr size = {2}, num buckets = {3}",
+ Table.getVerSignature(), Table.getVerHeader(),
+ Table.getHashRecordSize(), Table.getNumBuckets());
+ }
+
+ {
+ P.printLine("Records");
+ SymbolVisitorCallbackPipeline Pipeline;
+ SymbolDeserializer Deserializer(nullptr, CodeViewContainer::Pdb);
+ MinimalSymbolDumper Dumper(P, opts::dump::DumpSymRecordBytes, *ExpectedIds,
+ *ExpectedTypes);
+
+ Pipeline.addCallbackToPipeline(Deserializer);
+ Pipeline.addCallbackToPipeline(Dumper);
+ CVSymbolVisitor Visitor(Pipeline);
+
+ BinaryStreamRef SymStream =
+ ExpectedSyms->getSymbolArray().getUnderlyingStream();
+ for (uint32_t PubSymOff : Table) {
+ Expected<CVSymbol> Sym = readSymbolFromStream(SymStream, PubSymOff);
+ if (!Sym)
+ return Sym.takeError();
+ if (auto E = Visitor.visitSymbolRecord(*Sym, PubSymOff))
+ return E;
+ }
}
// Return early if we aren't dumping public hash table and address map info.
if (!HashExtras)
return Error::success();
- P.formatLine("Hash Records");
+ P.formatLine("Hash Entries");
{
AutoIndent Indent2(P);
for (const PSHashRecord &HR : Table.HashRecords)