getsentry / pdb

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

Initial cut at using scroll+scroll_derive #18

Closed luser closed 6 years ago

luser commented 6 years ago

Hey! I got motivated to try out scroll so I started taking a crack at fixing https://github.com/willglynn/pdb/issues/10.

This patch only changes over the code in src/msf/mod.rs, so it's mostly a wash since that code does a lot of reading individual u32s, but it does make reading the PDB header nicer. If you like how this looks I can go through and convert the rest of the crate's I/O to use scroll.

One thought: since we're going to wind up with a bunch of structs that define the on-disk PDB format, should those go in their own module?

cc @m4b

luser commented 6 years ago

I don’t know anything at all about semantic contents but otherwise looks good to me!

Thanks for taking a look!

Also, I assume (like PE) the disk values are always little endian, right ?

I'm not sure this is actually documented anywhere, but the code Microsoft has released for reading PDB files just reads structs directly from the file, so it must be little-endian by default.

willglynn commented 6 years ago

@luser Awesome! I will look through the code later tonight.

Also, I assume (like PE) the disk values are always little endian, right ?

I'm not sure this is actually documented anywhere, but the code Microsoft has released for reading PDB files just reads structs directly from the file, so it must be little-endian by default.

Right. As far as I know, the upstream code is the only documentation, and that code doesn't have any endian-switching. pdb::ParseBuffer is 100% LE, so I'm happy to continue baking that assumption into this code.

willglynn commented 6 years ago

Merged. Thanks!

luser commented 6 years ago

You're welcome! It should be straightforward to convert other parts of the library now: just define structs the the on-disk format that derive Pread, and use ParseBuffer::read on them.