Is it possible to load mismatched symbols in Visual Studio?
Asked Answered
H

5

19

I've got a Windows minidump (C code) and a corresponding exe file. Unfortunately, I don't have the exact matching .pdb files, but I do have .pdbs that contain the exact same code just built at a different time. In Windbg, I can use:

.symopt+0x40

To tell it to load anything, even mismatched symbol files. This works great in this particular instance, and I'm able to get a proper call stack. I'm just curious as to whether or not Visual Studio has any such feature. We use pretty much every different version of VS here, so it doesn't matter which version it might be in. Thanks.

Heliostat answered 7/9, 2010 at 15:25 Comment(2)
This doens't really answer your question, but you'd do yourself a huge favor by standardizing on a consistent set of dev tools.Ebsen
We have a consistent set. It's just that we support old versions of our software and it was not deemed worth the risk to port the old versions of the software to the newer versions of Visual Studio.Heliostat
T
5

There is no override, but the poster to this question found a way to modify the PDB files to make them match the EXE.

Thanks to one of the comments on the first answer, I checked out a link to the pdfs of the book "Undocumented Windows 2000 Secrets: A Programmers Cookbook". And the author goes into great detail about the pdb file format. As I said before, I had already loaded the pdb into a hex editor and flipped some bits around appearing that I made the age/signature match, but it didn't work. Well, after using the utility from the W2k secrets book to "explode" the pdb into the included streams, I found out that they hide another reference to the age in stream 3!!!!!!! Once I flipped that one as well, it matched up in windbg.

Not sure if you want to go to this much trouble, but it looks like it can be done. If this is for production support then it could be worth your while.

Toandfro answered 18/10, 2010 at 19:48 Comment(1)
I ended up working around this problem, but want to accept an answer as I don't like my answer rate to be below 100% ;-) This one seems to have the most helpful information, so I'm accepting it.Heliostat
F
22

Try this utility:

ChkMatch utility can be used to check whether an executable and debug information file match. It can also be used to enforce matching between an executable and debug information file, if they are compatible.

For more information about debug information matching and related issues, see this article.

Supported debug information formats: DBG, PDB 2.0, PDB 7.0...

Filagree answered 23/9, 2010 at 2:45 Comment(3)
The whole command looks like chkmatch -m C:\Temp\myLib.dll C:\Temp\myLib.pdbDiatribe
All links in this answer are deadYama
You may find the utility here: web.archive.org/web/20210205095232/https://www.debuginfo.com/…Whiffler
T
5

There is no override, but the poster to this question found a way to modify the PDB files to make them match the EXE.

Thanks to one of the comments on the first answer, I checked out a link to the pdfs of the book "Undocumented Windows 2000 Secrets: A Programmers Cookbook". And the author goes into great detail about the pdb file format. As I said before, I had already loaded the pdb into a hex editor and flipped some bits around appearing that I made the age/signature match, but it didn't work. Well, after using the utility from the W2k secrets book to "explode" the pdb into the included streams, I found out that they hide another reference to the age in stream 3!!!!!!! Once I flipped that one as well, it matched up in windbg.

Not sure if you want to go to this much trouble, but it looks like it can be done. If this is for production support then it could be worth your while.

Toandfro answered 18/10, 2010 at 19:48 Comment(1)
I ended up working around this problem, but want to accept an answer as I don't like my answer rate to be below 100% ;-) This one seems to have the most helpful information, so I'm accepting it.Heliostat
E
3

Visual Studio and Windbg match pdbs by comparing the timestamps in the Executable header with timestamps store in the pdb file. You can view the timestamp by running dumpin /headers .

I haven't used chkmatch but modifying either the exe or pdb to match each other should work fine.

Be aware that this technique may not be enough to debug your binary. John Robbins in his book 'Debugging Windows' (which I can recommend) mentions that he's seen different build results from the identical source tree built at almost identical times.

Always build pdb symbols with your builds (including release builds) and archive them alongside the build products and include the .map file for good measure.

Enswathe answered 25/10, 2010 at 12:52 Comment(0)
I
0

According to this post its possible to use sos windbg commands as well in visual studio. But i am not sure if ".symopt" also falls into this category.

Inainability answered 8/9, 2010 at 8:43 Comment(0)
A
0

I'm told that in VS2019 (16.7 .. 16.8 ballpark) that they switched to a multi-threaded PDB file generator to speed that up.

A side effect is that sections of the file, being generated on different threads, may end up in a different order in the file.

Bottom line, it is even more important than before that you use the PDB that was built with the EXE and no other.

Amyloid answered 16/11, 2020 at 21:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.