pdb icon indicating copy to clipboard operation
pdb copied to clipboard

Document how primitive types are found

Open nkaretnikov opened this issue 4 years ago • 1 comments

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 avatar Jan 12 '21 03:01 nkaretnikov

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

nkaretnikov avatar Jan 12 '21 03:01 nkaretnikov