This article describes how to retrieve the indexed source files of a portable executable (PE) binary file from source control by using information that's stored in the PE binary file's pairing program database (PDB) file. Because the indexed source files have their hash values embedded in the PDB file, these hash values can be used to verify the authenticity of the source files during their retrieval.
Note In the following steps, "abc.dll" represents the PE file in question.
For example, the symchk /v abc.dll /s D:\symbol-path\dll /os command line returns the following:In the output, notice that the full symbol path is D:\symbol-path\dll\abc.pdb.
For example, the srctool -n D:\symbol-path\dll\abc.pdb command line returns the following:
Note In the following steps, "abc.dll" represents the PE file in question.
Step 1
Use symchk to allocate the pairing .pdb file from a symbol server location. Use the /os option to obtain the full symbol path in the symchk output message.For example, the symchk /v abc.dll /s D:\symbol-path\dll /os command line returns the following:
[SYMCHK] Searching for symbols to abc.dll in path D:\symbol-path\dll
DBGHELP: abc - private symbols & lines
D:\symbol-path\dll\abc.pdb
[SYMCHK] SymType: SymPDB
[SYMCHK] ModName: abc
[SYMCHK] ImageName: abc.dll
[SYMCHK] LoadedImage: abc.dll
[SYMCHK] PDB: "D:\symbol-path\dll\abc.pdb"
[SYMCHK] PDB7 Sig: {625880BA-C1D4-4673-BFA2-07F90AAD7EC4}
[SYMCHK] Age: 1
[SYMCHK] PDB Matched: TRUE
SYMCHK: FAILED files = 0
SYMCHK: PASSED + IGNORED files = 1
Step 2A
If the PE file in question is native code, use cvdump against the allocated .pdb file together with the -sf option to view individual source files and their hash values. The hash values may be MD5 or SHA256.Step 2B
If the PE file in question is managed code, use pdb2xml against the allocated .pdb file to view individual source files and their hash values. The hash values may be SHA1 or SHA256.Step 3
Use srctool against the allocated .pdb file together with the -n option to show the source control version information of individual indexed source files.For example, the srctool -n D:\symbol-path\dll\abc.pdb command line returns the following:
d:\publicint\sdk\inc\api_x.h <source control server URL> d:\publicint\sdk\inc\api_x.h#34
d:\abc_dll\abc.c <source control server URL> d:\abc_dll\abc.c#1