Reading the PDB header in c++
I'm trying to read the header of a PDB file in order to know if it matches my 开发者_运维问答EXE file.
Is there a nice way to read the signature of the PDB file (maybe using dbgHelp)? I need to obtain the fields of the header in the PDB file that indicate in which build the PDB was created. thanks :)I don't believe either the Debug Help API nor the Debug Interface Access SDK provide access to any information that would solve your problem. About the only way to detect the build information using either of those would be to check the path of object files included during link time.
The PDB file does contain information about the options passed on the command line for both compiling object files and linking (libs, dll's, exe's) which is probably what you are looking for. Unfortunately I know of no documented way to access it. It may be buried deep in one of the tables available in the PDB file but I was unable to find any references for accessing it.
That said, if having the information you requested is an absolute necessity and you're willing to deal with some frustration have a look at the PDB Parser by Sven Boris Schreiber. It contains a lot of useful information although it may not support newer PDB versions
you can use the Pdb Inspector tool to view GUID and other basic details of you PDBs. This tool uses the Debug Interface Access (DIA)
精彩评论