summaryrefslogtreecommitdiffstats
path: root/llvm/tools
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/tools')
-rw-r--r--llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp10
-rw-r--r--llvm/tools/llvm-pdbutil/MinimalSymbolDumper.cpp28
-rw-r--r--llvm/tools/llvm-pdbutil/MinimalSymbolDumper.h7
3 files changed, 38 insertions, 7 deletions
diff --git a/llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp b/llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp
index 99dd358fbf9..73e4a14a854 100644
--- a/llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp
+++ b/llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp
@@ -837,6 +837,7 @@ Error DumpOutputStyle::dumpModuleSyms() {
ExitOnError Err("Unexpected error processing symbols: ");
+ auto &Ids = Err(initializeTypes(StreamIPI));
auto &Types = Err(initializeTypes(StreamTPI));
iterateModules(
@@ -852,7 +853,8 @@ Error DumpOutputStyle::dumpModuleSyms() {
SymbolVisitorCallbackPipeline Pipeline;
SymbolDeserializer Deserializer(nullptr, CodeViewContainer::Pdb);
- MinimalSymbolDumper Dumper(P, opts::dump::DumpSymRecordBytes, Types);
+ MinimalSymbolDumper Dumper(P, opts::dump::DumpSymRecordBytes, Ids,
+ Types);
Pipeline.addCallbackToPipeline(Deserializer);
Pipeline.addCallbackToPipeline(Dumper);
@@ -936,9 +938,13 @@ Error DumpOutputStyle::dumpSymbolsFromGSI(const GSIHashTable &Table,
auto ExpectedTypes = initializeTypes(StreamTPI);
if (!ExpectedTypes)
return ExpectedTypes.takeError();
+ auto ExpectedIds = initializeTypes(StreamIPI);
+ if (!ExpectedIds)
+ return ExpectedIds.takeError();
SymbolVisitorCallbackPipeline Pipeline;
SymbolDeserializer Deserializer(nullptr, CodeViewContainer::Pdb);
- MinimalSymbolDumper Dumper(P, opts::dump::DumpSymRecordBytes, *ExpectedTypes);
+ MinimalSymbolDumper Dumper(P, opts::dump::DumpSymRecordBytes, *ExpectedIds,
+ *ExpectedTypes);
Pipeline.addCallbackToPipeline(Deserializer);
Pipeline.addCallbackToPipeline(Dumper);
diff --git a/llvm/tools/llvm-pdbutil/MinimalSymbolDumper.cpp b/llvm/tools/llvm-pdbutil/MinimalSymbolDumper.cpp
index fd186bc5a88..cc592b724df 100644
--- a/llvm/tools/llvm-pdbutil/MinimalSymbolDumper.cpp
+++ b/llvm/tools/llvm-pdbutil/MinimalSymbolDumper.cpp
@@ -389,10 +389,12 @@ Error MinimalSymbolDumper::visitSymbolEnd(CVSymbol &Record) {
return Error::success();
}
-std::string MinimalSymbolDumper::typeIndex(TypeIndex TI) const {
+std::string MinimalSymbolDumper::typeOrIdIndex(codeview::TypeIndex TI,
+ bool IsType) const {
if (TI.isSimple())
return formatv("{0}", TI).str();
- StringRef Name = Types.getTypeName(TI);
+ auto &Container = IsType ? Types : Ids;
+ StringRef Name = Container.getTypeName(TI);
if (Name.size() > 32) {
Name = Name.take_front(32);
return formatv("{0} ({1}...)", TI, Name);
@@ -400,6 +402,14 @@ std::string MinimalSymbolDumper::typeIndex(TypeIndex TI) const {
return formatv("{0} ({1})", TI, Name);
}
+std::string MinimalSymbolDumper::idIndex(codeview::TypeIndex TI) const {
+ return typeOrIdIndex(TI, false);
+}
+
+std::string MinimalSymbolDumper::typeIndex(TypeIndex TI) const {
+ return typeOrIdIndex(TI, true);
+}
+
Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, BlockSym &Block) {
P.format(" `{0}`", Block.Name);
AutoIndent Indent(P, 7);
@@ -727,9 +737,19 @@ Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, ProcSym &Proc) {
Proc.Parent, Proc.End,
formatSegmentOffset(Proc.Segment, Proc.CodeOffset),
Proc.CodeSize);
- // FIXME: It seems FunctionType is sometimes an id and sometimes a type.
+ bool IsType = true;
+ switch (Proc.getKind()) {
+ case SymbolRecordKind::GlobalProcIdSym:
+ case SymbolRecordKind::ProcIdSym:
+ case SymbolRecordKind::DPCProcIdSym:
+ IsType = false;
+ break;
+ default:
+ break;
+ }
P.formatLine("type = `{0}`, debug start = {1}, debug end = {2}, flags = {3}",
- typeIndex(Proc.FunctionType), Proc.DbgStart, Proc.DbgEnd,
+ typeOrIdIndex(Proc.FunctionType, IsType), Proc.DbgStart,
+ Proc.DbgEnd,
formatProcSymFlags(P.getIndentLevel() + 9, Proc.Flags));
return Error::success();
}
diff --git a/llvm/tools/llvm-pdbutil/MinimalSymbolDumper.h b/llvm/tools/llvm-pdbutil/MinimalSymbolDumper.h
index 5e30959ea9c..a140af74b69 100644
--- a/llvm/tools/llvm-pdbutil/MinimalSymbolDumper.h
+++ b/llvm/tools/llvm-pdbutil/MinimalSymbolDumper.h
@@ -23,8 +23,9 @@ class LinePrinter;
class MinimalSymbolDumper : public codeview::SymbolVisitorCallbacks {
public:
MinimalSymbolDumper(LinePrinter &P, bool RecordBytes,
+ codeview::LazyRandomTypeCollection &Ids,
codeview::LazyRandomTypeCollection &Types)
- : P(P), Types(Types) {}
+ : P(P), Ids(Ids), Types(Types) {}
Error visitSymbolBegin(codeview::CVSymbol &Record) override;
Error visitSymbolBegin(codeview::CVSymbol &Record, uint32_t Offset) override;
@@ -37,9 +38,13 @@ public:
#include "llvm/DebugInfo/CodeView/CodeViewSymbols.def"
private:
+ std::string typeOrIdIndex(codeview::TypeIndex TI, bool IsType) const;
+
std::string typeIndex(codeview::TypeIndex TI) const;
+ std::string idIndex(codeview::TypeIndex TI) const;
LinePrinter &P;
+ codeview::LazyRandomTypeCollection &Ids;
codeview::LazyRandomTypeCollection &Types;
};
} // namespace pdb
OpenPOWER on IntegriCloud