getsentry / pdb

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

Handle empty TPI and IPI streams #60

Closed jan-auer closed 4 years ago

jan-auer commented 4 years ago

The ID stream may be completely empty if there are no ids in a PDB. Parsing the header fails in this case with an UnexpectedEof error, which is not clean. Instead, we can return an Option that explicitly indicates that there is no ID information available.

jan-auer commented 4 years ago

Alternatively, we could also create an empty object.

jan-auer commented 4 years ago

@willglynn I've pushed up an alternate implementation where IdInformation is not optional. Instead, it internally handles an empty stream. While implementing, I noticed that the shifted count was not rounded up properly. However, returning 0 as max_index for such streams seems like a bit of a hack.

jan-auer commented 4 years ago

Going with the second option now, as it seems a bit more ergonomic.