getsentry / pdb

A parser for Microsoft PDB (Program Database) debugging information
https://docs.rs/pdb/
Apache License 2.0
385 stars 69 forks source link

Expose line number information #19

Closed jrmuizel closed 5 years ago

jrmuizel commented 6 years ago

This would be nice to have.

jrmuizel commented 6 years ago

Do you know roughly what needs to be done to expose this?

willglynn commented 6 years ago

Oops.

willglynn commented 6 years ago

I don't know as much as I'd like. What I do know:

The DBI stream contains a list of modules (~object files) present in the executable described by the PDB. Each module record in the DBI stream contains pointers to other data, most of which resides in a separate module-specific stream.

Each module has section contribution information, which lets you build a map of which modules go with which RVAs. I imagine this is the first step in turning an address into a line number: figure out which module(s) are involved.

The module's stream contains module-level symbols, line number information, and frame pointer optimization data at a minimum. There's two types of line data – legacy or C11 line numbers, and new or C13 line numbers. Both are optional, I would fully expect a need to decode both, but I don't know how either work.

That's about all I know about line numbers off the top of my head.

jrmuizel commented 6 years ago

I've started on this here: https://github.com/jrmuizel/pdb/tree/line-info