This is an archive of the discontinued LLVM Phabricator instance.

Fix a few small issues in llvm-pdbutil
ClosedPublic

Authored by lemo on Nov 1 2018, 3:09 PM.

Details

Summary

Running "llvm-pdbutil dump -all" on linux (using the native PDB reader), over a few PDBs pulled from the Microsoft public symbol store uncovered a few issues:

  • stripped PDBs might not have the strings stream (/names)
  • stripped PDBs might not have the "module info" stream

Diff Detail

Event Timeline

lemo created this revision.Nov 1 2018, 3:09 PM

Out of curiosity, is this a PDB you generated yourself by compiling something and running pdbstrip on it?

test/tools/llvm-pdbdump/stripped.test
4–5

Can you print the rest of this section? For example, I think there's actually a field here that says it's stripped.

7–8

This section might be interesting to print too. If for no other reason than to server as a reference of what streams are "normal" to expect in a stripped PDB.

tools/llvm-pdbutil/InputFile.cpp
182–183

This assert doesn't seem necessary, as it's essentially checking for an out of memory condition.

lemo updated this revision to Diff 172269.Nov 1 2018, 4:44 PM

Incorporating CR feedback

lemo marked 3 inline comments as done.Nov 1 2018, 4:45 PM

Thanks Zach for your assistance with this!

test/tools/llvm-pdbdump/stripped.test
7–8

I agree. There's a slight downside though - the test becomes very sensitive to the output, including formatting details.

zturner added inline comments.Nov 1 2018, 5:00 PM
test/tools/llvm-pdbdump/stripped.test
7–8

FileCheck is pretty helpful when it comes to this kind of thing. You can regex out anything by putting {{.*}} (so stream sizes, for example), and also you can leave off anything at the end of a line. So for example, for Stream 3 (just picking a random one), you could write your line as:

; CHECK:   Stream 3 ({{.*}} bytes): [DBI Stream]
; CHECK:   Stream 4

Note the absence of the NEXT (because we're skipping blocks, and we're regex'ing out the stream sizes. So all of the sensitive stuff goes away.

However.... I don't think we should check in this particular PDB (or any other PDB that we didn't generate ourselves). Microsoft has tools that will strip PDBs, although I forget what it's called off the top of my head. Can we generate a private PDB using cl.exe, strip it using their tool, verify that it has the same properties as this PDB, and then use that one instead?

lemo updated this revision to Diff 172395.Nov 2 2018, 10:36 AM
lemo marked an inline comment as done.

Using a new, smaller test pdb (Stripped.pdb)

zturner accepted this revision.Nov 2 2018, 10:54 AM

LGTM! Thanks

This revision is now accepted and ready to land.Nov 2 2018, 10:54 AM
This revision was automatically updated to reflect the committed changes.