<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - llvm-pdbdump analyze doesn't quite work for clang.pdb"
href="https://bugs.llvm.org/show_bug.cgi?id=32243">32243</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>llvm-pdbdump analyze doesn't quite work for clang.pdb
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>DebugInfo
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>nicolasweber@gmx.de
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Repro:
1. Download clang.pdb from
<a href="http://commondatastorage.googleapis.com/chromium-browser-symsrv/index.html?path=clang.pdb/EA4564EA6D47405AB6EE56969E08EE0F1/">http://commondatastorage.googleapis.com/chromium-browser-symsrv/index.html?path=clang.pdb/EA4564EA6D47405AB6EE56969E08EE0F1/</a>
(it's a cab archive, uncompress it). It was written by link.exe in a bootstrap
build of clang -- i.e. clang wrote the CodeView data that link.exe linked
together.
2. Run `llvm-pdbdump analyze clang.pdb`
Expected: Works.
Actual: "llvm-pdbdump: Native PDB Error: The Type record has an invalid hash
value. Type index is 0x24EB6"
If I add this debug printf:
Index: lib/DebugInfo/PDB/Native/TpiHashing.cpp
===================================================================
--- lib/DebugInfo/PDB/Native/TpiHashing.cpp (revision 297571)
+++ lib/DebugInfo/PDB/Native/TpiHashing.cpp (working copy)
@@ -32,8 +32,12 @@
Opts & static_cast<uint16_t>(ClassOptions::ForwardReference);
bool Scoped = Opts & static_cast<uint16_t>(ClassOptions::Scoped);
bool UniqueName = Opts & static_cast<uint16_t>(ClassOptions::HasUniqueName);
bool IsAnon = UniqueName && isAnonymous(Rec);
+fprintf(stderr, "opts %x %d %s\n", Opts, IsAnon, Rec.getName().str().c_str());
Then the last output before things fail is
opts 8 0 `anonymous namespace'::AArch64FastISel::Address::<unnamed-tag>
So that's an anonymous enum, but UniqueName isn't set -- and hence IsAnon is
false. With this change, things work fine:
Index: lib/DebugInfo/PDB/Native/TpiHashing.cpp
===================================================================
--- lib/DebugInfo/PDB/Native/TpiHashing.cpp (revision 297571)
+++ lib/DebugInfo/PDB/Native/TpiHashing.cpp (working copy)
@@ -32,7 +32,7 @@
Opts & static_cast<uint16_t>(ClassOptions::ForwardReference);
bool Scoped = Opts & static_cast<uint16_t>(ClassOptions::Scoped);
bool UniqueName = Opts & static_cast<uint16_t>(ClassOptions::HasUniqueName);
- bool IsAnon = UniqueName && isAnonymous(Rec);
+ bool IsAnon = isAnonymous(Rec);
if (!ForwardRef && !Scoped && !IsAnon)
return hashStringV1(Rec.getName());
@@ -79,18 +79,24 @@
}
However, I'm not sure if this is a bug in pdbdump, or if clang writes bad
codeview and the input is in fact bad. (dbghelp.dll seems to load the file fine
though, so I suppose even if there's also a clang bug here, llvm-pdbdump should
accept it too.)
I tried writing a test for this, but I didn't see where to put it -- looks like
this code doesn't have a lot of tests now.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>