summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2017-06-30 21:35:00 +0000
committerZachary Turner <zturner@google.com>2017-06-30 21:35:00 +0000
commitaf8c75a8c0dd3b86e67c28089ab61aea565c5f95 (patch)
tree77b0ae71a4cc9221df4a9de8e567110e40a8dd9d /llvm/lib/DebugInfo
parent45a7462094fc204487b71de767fd87eb28a056e6 (diff)
downloadbcm5719-llvm-af8c75a8c0dd3b86e67c28089ab61aea565c5f95.tar.gz
bcm5719-llvm-af8c75a8c0dd3b86e67c28089ab61aea565c5f95.zip
[llvm-pdbutil] Output the symbol offset when dumping.
Type records have a unique type index, but symbol records do not. Instead, symbol records refer to other symbol records by referencing their offset in the symbol stream. In a sense this is the analogue of the TypeIndex, but we are not printing it in the dumper. Printing it not only gives us more useful information when manually investigating the contents of a PDB, but also allows us to write better tests by enabling us to verify that fields that reference other symbol records do so correctly. Differential Revision: https://reviews.llvm.org/D34906 llvm-svn: 306890
Diffstat (limited to 'llvm/lib/DebugInfo')
-rw-r--r--llvm/lib/DebugInfo/CodeView/CVSymbolVisitor.cpp28
1 files changed, 24 insertions, 4 deletions
diff --git a/llvm/lib/DebugInfo/CodeView/CVSymbolVisitor.cpp b/llvm/lib/DebugInfo/CodeView/CVSymbolVisitor.cpp
index d058f486497..e0c7ef58c30 100644
--- a/llvm/lib/DebugInfo/CodeView/CVSymbolVisitor.cpp
+++ b/llvm/lib/DebugInfo/CodeView/CVSymbolVisitor.cpp
@@ -29,10 +29,8 @@ static Error visitKnownRecord(CVSymbol &Record,
return Error::success();
}
-Error CVSymbolVisitor::visitSymbolRecord(CVSymbol &Record) {
- if (auto EC = Callbacks.visitSymbolBegin(Record))
- return EC;
-
+static Error finishVisitation(CVSymbol &Record,
+ SymbolVisitorCallbacks &Callbacks) {
switch (Record.Type) {
default:
if (auto EC = Callbacks.visitUnknownSymbol(Record))
@@ -55,6 +53,18 @@ Error CVSymbolVisitor::visitSymbolRecord(CVSymbol &Record) {
return Error::success();
}
+Error CVSymbolVisitor::visitSymbolRecord(CVSymbol &Record) {
+ if (auto EC = Callbacks.visitSymbolBegin(Record))
+ return EC;
+ return finishVisitation(Record, Callbacks);
+}
+
+Error CVSymbolVisitor::visitSymbolRecord(CVSymbol &Record, uint32_t Offset) {
+ if (auto EC = Callbacks.visitSymbolBegin(Record, Offset))
+ return EC;
+ return finishVisitation(Record, Callbacks);
+}
+
Error CVSymbolVisitor::visitSymbolStream(const CVSymbolArray &Symbols) {
for (auto I : Symbols) {
if (auto EC = visitSymbolRecord(I))
@@ -62,3 +72,13 @@ Error CVSymbolVisitor::visitSymbolStream(const CVSymbolArray &Symbols) {
}
return Error::success();
}
+
+Error CVSymbolVisitor::visitSymbolStream(const CVSymbolArray &Symbols,
+ uint32_t InitialOffset) {
+ for (auto I : Symbols) {
+ if (auto EC = visitSymbolRecord(I, InitialOffset))
+ return EC;
+ InitialOffset += I.length();
+ }
+ return Error::success();
+}
OpenPOWER on IntegriCloud