This is an archive of the discontinued LLVM Phabricator instance.

pdbdump: print out symbol names referred by publics stream.
ClosedPublic

Authored by ruiu on May 20 2016, 11:20 AM.

Details

Summary

DBI stream contains a stream number of the symbol record stream.
Symbol record streams is an array of length-type-value members.
Each member represents one symbol.

Publics stream contains offsets to the symbol record stream.
This patch is to print out all symbols that are referenced by
the publics stream.

Note that even with this patch, llvm-pdbdump cannot dump all the
information in a publics stream since it contains more information
than symbol names. I'll improve it in followup patches.

Diff Detail

Repository
rL LLVM

Event Timeline

ruiu updated this revision to Diff 57959.May 20 2016, 11:20 AM
ruiu retitled this revision from to pdbdump: print out symbol names referred by publics stream..
ruiu updated this object.
ruiu added a reviewer: zturner.
ruiu added a subscriber: llvm-commits.
zturner edited edge metadata.May 20 2016, 11:29 AM

I would hold off on this for now. We have code to do all of this in DebugInfo/CodeView, but it is not completely reusable outside of llvm-readobj. We have a lot of information about the different kinds of symbol records and how to parse them in DebugInfo/CodeView. (see SymbolRecord.h). This is what I'm working on fixing right now, making it reusable so that we can dump full symbol details from llvm-pdbdump. If you want to dump 1 or 2 symbols as a proof of concept for now (like you're doing in this patch), that's fine, but I wouldn't add any more because it would be duplicated effort and we will have to remove it once we standardize on using the ones in DebugInfo/CodeView.

ruiu added a comment.May 20 2016, 12:48 PM

I'm not going to add more than these symbol types as they are the only two types that exist in "empty.pdb". My focus is to read the hash table in the publics stream, but since the hash table refers to the symbols, I needed to read it.

zturner accepted this revision.May 20 2016, 12:49 PM
zturner edited edge metadata.
This revision is now accepted and ready to land.May 20 2016, 12:49 PM
This revision was automatically updated to reflect the committed changes.
majnemer added inline comments.
lib/DebugInfo/PDB/Raw/SymbolStream.cpp
57 ↗(On Diff #57959)

Why not make this const char * ? Then you could use the implicit constructor to make a StringRef.

Also, variable names should be capitalized.

rnk added a subscriber: rnk.May 20 2016, 4:12 PM
rnk added inline comments.
llvm/trunk/lib/DebugInfo/PDB/Raw/SymbolStream.cpp
38

In the future, please don't use these kind of flexible array members, they are how you get buffer overruns when the strings are not null terminated. Look at how we are deserializing codeview types instead.

I was going to comment on that, but this code will go away once I finish
the work on the symbol visitor and start using libcodeview from here.