aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm/tools/llvm-pdbutil/PrettyCompilandDumper.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm/tools/llvm-pdbutil/PrettyCompilandDumper.cpp')
-rw-r--r--contrib/llvm/tools/llvm-pdbutil/PrettyCompilandDumper.cpp95
1 files changed, 53 insertions, 42 deletions
diff --git a/contrib/llvm/tools/llvm-pdbutil/PrettyCompilandDumper.cpp b/contrib/llvm/tools/llvm-pdbutil/PrettyCompilandDumper.cpp
index 65e8badbc99a..0d99c9b1245c 100644
--- a/contrib/llvm/tools/llvm-pdbutil/PrettyCompilandDumper.cpp
+++ b/contrib/llvm/tools/llvm-pdbutil/PrettyCompilandDumper.cpp
@@ -55,62 +55,73 @@ void CompilandDumper::start(const PDBSymbolCompiland &Symbol,
if (opts & Flags::Lines) {
const IPDBSession &Session = Symbol.getSession();
- auto Files = Session.getSourceFilesForCompiland(Symbol);
- Printer.Indent();
- while (auto File = Files->getNext()) {
- Printer.NewLine();
- WithColor(Printer, PDB_ColorItem::Path).get() << File->getFileName();
-
- auto Lines = Session.findLineNumbers(Symbol, *File);
+ if (auto Files = Session.getSourceFilesForCompiland(Symbol)) {
Printer.Indent();
- while (auto Line = Lines->getNext()) {
+ while (auto File = Files->getNext()) {
Printer.NewLine();
- uint32_t LineStart = Line->getLineNumber();
- uint32_t LineEnd = Line->getLineNumberEnd();
-
- Printer << "Line ";
- PDB_ColorItem StatementColor = Line->isStatement()
- ? PDB_ColorItem::Keyword
- : PDB_ColorItem::LiteralValue;
- WithColor(Printer, StatementColor).get() << LineStart;
- if (LineStart != LineEnd)
- WithColor(Printer, StatementColor).get() << " - " << LineEnd;
-
- uint32_t ColumnStart = Line->getColumnNumber();
- uint32_t ColumnEnd = Line->getColumnNumberEnd();
- if (ColumnStart != 0 || ColumnEnd != 0) {
- Printer << ", Column: ";
- WithColor(Printer, StatementColor).get() << ColumnStart;
- if (ColumnEnd != ColumnStart)
- WithColor(Printer, StatementColor).get() << " - " << ColumnEnd;
+ WithColor(Printer, PDB_ColorItem::Path).get() << File->getFileName();
+ if (File->getChecksumType() != PDB_Checksum::None) {
+ auto ChecksumType = File->getChecksumType();
+ auto ChecksumHexString = toHex(File->getChecksum());
+ WithColor(Printer, PDB_ColorItem::Comment).get()
+ << " (" << ChecksumType << ": " << ChecksumHexString << ")";
}
- Printer << ", Address: ";
- if (Line->getLength() > 0) {
- uint64_t AddrStart = Line->getVirtualAddress();
- uint64_t AddrEnd = AddrStart + Line->getLength() - 1;
- WithColor(Printer, PDB_ColorItem::Address).get()
+ auto Lines = Session.findLineNumbers(Symbol, *File);
+ if (!Lines)
+ continue;
+
+ Printer.Indent();
+ while (auto Line = Lines->getNext()) {
+ Printer.NewLine();
+ uint32_t LineStart = Line->getLineNumber();
+ uint32_t LineEnd = Line->getLineNumberEnd();
+
+ Printer << "Line ";
+ PDB_ColorItem StatementColor = Line->isStatement()
+ ? PDB_ColorItem::Keyword
+ : PDB_ColorItem::LiteralValue;
+ WithColor(Printer, StatementColor).get() << LineStart;
+ if (LineStart != LineEnd)
+ WithColor(Printer, StatementColor).get() << " - " << LineEnd;
+
+ uint32_t ColumnStart = Line->getColumnNumber();
+ uint32_t ColumnEnd = Line->getColumnNumberEnd();
+ if (ColumnStart != 0 || ColumnEnd != 0) {
+ Printer << ", Column: ";
+ WithColor(Printer, StatementColor).get() << ColumnStart;
+ if (ColumnEnd != ColumnStart)
+ WithColor(Printer, StatementColor).get() << " - " << ColumnEnd;
+ }
+
+ Printer << ", Address: ";
+ if (Line->getLength() > 0) {
+ uint64_t AddrStart = Line->getVirtualAddress();
+ uint64_t AddrEnd = AddrStart + Line->getLength() - 1;
+ WithColor(Printer, PDB_ColorItem::Address).get()
<< "[" << format_hex(AddrStart, 10) << " - "
<< format_hex(AddrEnd, 10) << "]";
- Printer << " (" << Line->getLength() << " bytes)";
- } else {
- uint64_t AddrStart = Line->getVirtualAddress();
- WithColor(Printer, PDB_ColorItem::Address).get()
+ Printer << " (" << Line->getLength() << " bytes)";
+ } else {
+ uint64_t AddrStart = Line->getVirtualAddress();
+ WithColor(Printer, PDB_ColorItem::Address).get()
<< "[" << format_hex(AddrStart, 10) << "] ";
- Printer << "(0 bytes)";
+ Printer << "(0 bytes)";
+ }
}
+ Printer.Unindent();
}
Printer.Unindent();
}
- Printer.Unindent();
}
if (opts & Flags::Children) {
- auto ChildrenEnum = Symbol.findAllChildren();
- Printer.Indent();
- while (auto Child = ChildrenEnum->getNext())
- Child->dump(*this);
- Printer.Unindent();
+ if (auto ChildrenEnum = Symbol.findAllChildren()) {
+ Printer.Indent();
+ while (auto Child = ChildrenEnum->getNext())
+ Child->dump(*this);
+ Printer.Unindent();
+ }
}
}