Skip to content

Conversation

Sahnvour
Copy link
Contributor

Base work to address #721.

This is still very much WIP, but provides a framework to go on implementing PDB parsing.
It's currently able to load the corresponding .pdb file and its internal content streams. Only the necessary components were implemented (ie. many [header] fields are ignored if not directly relevant), and we still need to figure out how to get from an address to a source line information record. Yet I tried to keep in mind that we may want to provide a PDB library for other usecases that error traces, so it should be relatively easy to extend.
As such, the code is still full of debug output, and probably not zig-idiomatic. I was advised on IRC to make a PR for review.

Resources:
https://llvm.org/docs/PDB/index.html
https://docs.microsoft.com/fr-fr/windows/desktop/Debug/pe-format
LLVM source code (especially lld and pdbutil)

Sahnvour added 2 commits June 16, 2018 23:47
Currently does:
- read COFF executable file
- locate and load corresponding .pdb file
- expose .pdb content as streams (PDB format)
@andrewrk
Copy link
Member

Thank you very much @Sahnvour for starting this effort. Perhaps we can work together on this now. I'll play with the code tomorrow or Monday and see if I can contribute.

@Sahnvour
Copy link
Contributor Author

To get you started, I stopped at Pdb.getSourceLine which is reading the DBI stream. I think we can get useful information on the modules there, to locate their respective data and find source information in it somehow. If you look at the output of pdbutil dump prog.exe, the Lines section lists lines information by module, but I did not investigate this in detail.

@andrewrk andrewrk added the work in progress This pull request is not ready for review yet. label Aug 20, 2018
@andrewrk andrewrk added this to the 0.3.0 milestone Aug 25, 2018
@andrewrk
Copy link
Member

This is merged into the Sahnvour-windows-coff-issue721 branch which I'm actively working on.

@andrewrk andrewrk closed this Aug 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
work in progress This pull request is not ready for review yet.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants