While you should always have your PDB files in symbol servers, there are times when you’re doing private (aka local) builds and moving those builds around hither and yon in a test environment where you can accidentally forget to copy over a binary’s PDB file. That leads to the common question: short of starting a debugger, how can I check that a PDB file matches a particular binary?
Obviously you can always take an educated guess if a PDB file matches a binary from the timestamp. That will work in most cases, but to completely check, you’ll need to rely on SYMCHK.EXE, a command line tool that comes with the Debugging Tools for Windows (AKA WinDBG). The trick is to tell SYMCHK.EXE to use the PDB file directory as your symbol server. In the following example, I’m running the SYMCHK.EXE command from the same directory where my binary, RinjPlay.exe is located.
symchk RinjPlay.exe /s .
If the PDB matches the binary, you’ll see the following output.
SYMCHK: FAILED files = 0
SYMCHK: PASSED + IGNORED files = 1
If the PDB does not match, your output will look like the following.
SYMCHK: RinjPlay.exe FAILED – RinjPlay.pdb mismatched or not found
SYMCHK: FAILED files = 1
SYMCHK: PASSED + IGNORED files = 0
As with any SYMCHK.EXE command, you can pass /v to get detailed output about your binary and PDB file matching.
Cloud management is difficult to do manually, especially if you work with multiple cloud…
Azure’s scalable infrastructure is often cited as one of the primary reasons why it's the…
https://www.youtube.com/watch?v=wDzCN0d8SeA Watch our "Unlocking the Power of AI in your Software Development Life Cycle (SDLC)"…
FinOps is a strategic approach to managing cloud costs. It combines financial management best practices…
Using Kubernetes with Azure combines the power of Kubernetes container orchestration and the cloud capabilities…
In the intricate landscape of modern business, compliance is both a cornerstone of operational integrity…
View Comments
Interesting Finds: June 28, 2011
Wow really good info there. Thanks :)
Hi John,
I've written an assembly and .pdb inspector that extracts the GUIDS (among many other things), that allows you to visually compare the PDB GUID to see if it matches. Hopefully, I'll have it "polished enough" for posting on my blog and probably on CodePlex in the next month or two. If you're interested, I'll ping you back and give you the URL.
Let me know.
Hi John,
Thanks for your posts about debugging! I think they are really helpful.
Wanted to share another method of how to detect PDB file mismatch. It is possible to do with 'dumpbin.exe' utility that comes with Visual Studio. The trick is simple: use /PDBPATH option (http://msdn.microsoft.com/en-us/library/44wx0fef.aspx) with dumpbin utility in the same folder where binary and PDB reside. The result will be like this:
>> dumpbin /PDBPATH:VERBOSE wargame.exe
Microsoft (R) COFF/PE Dumper Version 8.00.50727.762
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file wargame.exe
File Type: EXECUTABLE IMAGE
PDB file 'C:UsersAndrewDevelopmentEclipseWorkspacewg2kdistwargame.pdb' checked. (PDB age mismatch)
p.s.
I have also found another utility that can do the trick:
http://www.debuginfo.com/tools/chkmatch.html
Best Regards,
Andrei