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

Document how primitive types are found #99

Open nkaretnikov opened 3 years ago

nkaretnikov commented 3 years ago

Took me a bit to figure this out, so this might be useful for others.

Please consider mentioning something like this in the docstring of the find method of the TPI stream:

Note: if the type index is less than the minimum_index of the TPI stream (usually 0x1000), the type is determined by matching the type index against a predefined mapping of primitive types. For example, 0x0022 corresponds to a 32-bit unsigned value.

https://github.com/Microsoft/microsoft-pdb/blob/082c5290e5aff028ae84e43affa8be717aa7af73/include/cvinfo.h#L328

This is an implementation detail, but it might save someone time when debugging. Before figuring it out, I suspected a parsing error in my code or an issue with the library, then an error in the internal code.

Note that I'm not using the type finder for the reasons mentioned in this comment, so others are less likely to bump into this. But I still think it might be a good thing to document.

nkaretnikov commented 3 years ago

In general, llvm-pdbutil dump --all <PDB> is a good tool for debugging issues like this.