Search code examples
c++windowsvisual-studio-debugging

pdb mismatched or not found - Debugging in windows


I am new to Windows programming environment. So would appreciate if you can help me with this:

I have got an application called Controller.exe that I am building on TeamCity build server. The build of the application generates exe file and pdb file.

When I run the Controller.exe on my deployment machine, it crashes and dump is generated.

In the application I have enabled dumping crash with the following:

unsigned long stackSize = 16384;
SetThreadStackGuarantee(&stackSize);
SetUnhandledExceptionFilter(WriteLargeMiniDump);

The function WriteLargeMiniDump() writes the dump successfully. I know this because when I run the Controller.exe on my development machine it generates dump and I can open it successfully and see the crash line in source code.

However, in the case of exe and pdb generated by TeamCity server, I can't debug the dump. When I open the dump file in visual studio 2015 and Try to Debug with Native Only it says pdb not loaded.

I googled around to check if pdb file is correct. So I downloaded Debugging Tools for windows which as symchk.exe.

When I run symchk.exe it gives the following errors:

SYMCHK: Controller.exe FAILED  - Controller.pdb mismatched or not found

SYMCHK: FAILED files = 1
SYMCHK: PASSED + IGNORED files = 0

Controller.pdb is in same directory where I copied the exe generated from TeamCity server.

Am I missing something here ?


Solution

  • I was able to fix this issue. The problem was that the original author of the project had checked-in pdb into the SVN repository, which TeamCity was building. Therefore, the exe generated didn't match the pdb. And as per MSDN documentation, we must use the pdb that is generated during the build of exe.

    Using the pdb generated during the build of exe, I was able to debug the dump file.

    An important link that helped me understand pdb files is : https://www.wintellect.com/pdb-files-what-every-developer-must-know