Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for reading public symbol stream #82

Open
luser opened this issue Mar 18, 2020 · 0 comments
Open

Add support for reading public symbol stream #82

luser opened this issue Mar 18, 2020 · 0 comments

Comments

@luser
Copy link
Contributor

luser commented Mar 18, 2020

The public symbol stream contains both a sorted list of all public symbols (which can be used to quickly locate a symbol given a section index and address by binary searching) as well as a hash table for looking up symbols by mangled names. These both seem like extremely useful operations and it would be great to support them. The index of this stream is in DBIHeader::ps_symbols_stream.

The Microsoft C++ code for this stream (+ the global symbol stream) is a nightmare:
https://github.com/microsoft/microsoft-pdb/blob/082c5290e5aff028ae84e43affa8be717aa7af73/PDB/dbi/gsi.h
https://github.com/microsoft/microsoft-pdb/blob/082c5290e5aff028ae84e43affa8be717aa7af73/PDB/dbi/gsi.cpp

The implementation of PSGSI1::NearestSym is interesting. That's what implements the binary search to look up a symbol by section index and address.

But LLVM has an implementation that's a lot more readable:
https://github.com/llvm-mirror/llvm/blob/a27c90973c8a1d338f36b8148b687ab078de48aa/include/llvm/DebugInfo/PDB/Native/RawTypes.h
https://github.com/llvm-mirror/llvm/blob/6b547686c5410b7528212e898fe30fc7ee7a70a3/include/llvm/DebugInfo/PDB/Native/PublicsStream.h
https://github.com/llvm-mirror/llvm/blob/6b547686c5410b7528212e898fe30fc7ee7a70a3/lib/DebugInfo/PDB/Native/PublicsStream.cpp
https://github.com/llvm-mirror/llvm/blob/6b547686c5410b7528212e898fe30fc7ee7a70a3/include/llvm/DebugInfo/PDB/Native/GlobalsStream.h
https://github.com/llvm-mirror/llvm/blob/6b547686c5410b7528212e898fe30fc7ee7a70a3/lib/DebugInfo/PDB/Native/GlobalsStream.cpp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants