OSDN Git Service

[pdbutil] Print the checksum hex string when using the '-lines' option
authorAaron Smith <aaron.smith@microsoft.com>
Tue, 10 Apr 2018 14:47:12 +0000 (14:47 +0000)
committerAaron Smith <aaron.smith@microsoft.com>
Tue, 10 Apr 2018 14:47:12 +0000 (14:47 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329707 91177308-0d34-0410-b5e6-96231b3b80d8

test/tools/llvm-pdbdump/checksum-string.test [new file with mode: 0644]
tools/llvm-pdbutil/PrettyCompilandDumper.cpp

diff --git a/test/tools/llvm-pdbdump/checksum-string.test b/test/tools/llvm-pdbdump/checksum-string.test
new file mode 100644 (file)
index 0000000..c3ecc26
--- /dev/null
@@ -0,0 +1,5 @@
+; RUN: llvm-pdbutil pretty -lines %p/Inputs/PrettyFuncDumperTest.pdb > %t
+
+; CHECK: ---COMPILANDS---
+; CHECK: {{.*}}\PrettyFuncDumperTest.obj
+; CHECK: {{.*}}\prettyfuncdumpertest.cpp (MD5: E36B273C4D7B3D70C996387C95A6C4F7)
index b19b098..0d99c9b 100644 (file)
@@ -60,6 +60,12 @@ void CompilandDumper::start(const PDBSymbolCompiland &Symbol,
       while (auto File = Files->getNext()) {
         Printer.NewLine();
         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 << ")";
+        }
 
         auto Lines = Session.findLineNumbers(Symbol, *File);
         if (!Lines)