What causes symbols not to be loaded from the PDB file?

  • Step 1: I create myProgram.exe and create myProgram.pdb along with it.
  • Step 2: I intentionally cause a crash in myProgram.exe.
  • Step 3: I am asked if I want to use Visual Studio as a debugger, and I do.
  • Step 4: Visual Studio loads symbols from myProgram.pdb.
  • Step 5: I check the call stack to identify the (known) location where the failure occurred.
  • Step 6: I didn't frown or look puzzled because that's the way it should be.

However, if I rename myProgram.exe and myProgram.pdb to SomethingElse.exe and SomethingElse.pdb and repeat these steps, the results are mixed from step 4 onward. As far as I can tell, on my build machine, VS will always load symbols successfully from the renamed PDB file. However, on my remote target machine, VS will never load symbols - it always tells me that the PDB file does not match the executable. Why not? Is there an unclear rule that I am breaking? I use Visual Studio 2005 everywhere if it matters.

+3


source to share


2 answers


A simple subtle rule to be violated here is that the PDB filename appears to be encoded in the EXE file and not from the EXE filename. So, for example, if you create "Copy myProgram.exe" and "Copy myProgram.pdb" by simple copy and paste in Windows Explorer, the symbols may appear to be loaded despite the name change. But this will only work as long as the original "myProgram.pdb" file is present - if you delete "myProgram.pdb" and only have "Copy myProgram.pdb" the symbols may be compatible, but Visual Studio won't even try loading them.



In a quick and dirty test on a remote machine in my office, all that changed was the file name, not the file version, whereas on the actual remote machine, the file name and version were different, so they never seem to work.

+2


source


Visual Studio 2013 Update 5 creates corrupted [1] PDBs for me if my staging directory is a subdirectory of the output directory. My difference is to fix the problem

-    <IntDir>$(OutDir)/$(TargetName)/</IntDir>
+    <IntDir>$(OutDir)</IntDir>

      



[1] Checked inconsistency with windbg !itoldyouso

0


source







All Articles