5

When I use Visual Studio 2010 to debug a crash dump file (native code), it attempts to load C/C++ source files from the original build folder (and it gives the message "The source file is different from when the module was built. Would you like the debugger to use it anyway?"). The message is correct; the file is not the correct version.

What I would like VS2010 to do is to check out the source file using source server. If the file does not currently exist in its original build location, VS2010 will correctly use source server and retrieve the appropriate revision of the file (from Subversion). In order to force it to check out the correct revision, I have to physically delete the file from the original build location.

As a side note, VS2005 works as desired (well ... as I desire, perhaps not as others desire). VS2005 will always check out the correct revision from source control regardless of whether a copy of the file exists in the original build folder.

I believe the question comes down to one of the following:

  • Is there some kind of setting available that will change VS2010's precedence for finding source files?
  • Alternatively, is it possible to make VS2010 offer a choice/option to check out the source file in question? (Currently the only option I see in this situation is to browse for it.)
  • Or is it possible to completely exclude a specific path (folder) from the search?
2
  • I don't have an answer to your question, but a point of curiosity for me so that I may learn something... are you checking in the resulting build object files into your source control too? Because I think VS needs the actual EXE, PDB and OBJ files to accurately provide stack and source pointers etc. when viewing a DMP. If not, and if you're just referencing a build folder, why not leave the source with each build?
    – mark
    Nov 5, 2012 at 13:16
  • The build is always done in the exact same folder, so it gets overwritten with the current build each time. We save all the symbols in our symbol server. That combined with the .dmp file that we create is all the debugger needs to locate the source file, show stack, globals, etc. And if I remove the current build files from that one folder, it works perfectly. But removing them is problematic if someone else is doing a build currently. My solution will probably be to install VS2005, which works as expected. Nov 5, 2012 at 13:38

3 Answers 3

2
+100

I have the same problem with VS2010 and made an attempt to figure it out. I monitored devenv.exe with procmon but didn't see anything out of the order with the files & registry keys it was accessing. Pretty much the same information you see in the error report when VS2010 can't find the source. My solution is to use VS2005 as it works fine. I did see some correspondence on MSDN about a similar (if not the same) bug and they claimed it would be fixed in the final release of 2012. I believe I have that final release of 2012 and it has the same problem.

0

Here's a maybe slightly complicated solution

1) Create a script that will download and replace the pdb file (a .bat, a python script, whatever)

2) Create a new External Tool within VS2010 (Tools -> External Tools -> Add)

3) Point the tool to your script and pass any project-specific stuff to it as arguments

4) Create a post-build or pre-build step in your project that will call your new External Tool (project properties -> Build Events -> whatever)

This is a lot of work, but at least it will fully integrate it into your building process.

Note: Sometimes I've noticed that my post-build steps won't run unless I've compiled at least on cpp file. I usually press F7 and build some source and then build fully, to make sure everything works as expected.

0

You can change the local source directory to a different name when you are debugging crash dump file.

Or you can change the build directory to a different path with your local directory.

1
  • Yes, that is a possibility. It doesn't work in my case, though. The directories involved are network shares that are used by the entire team. It would break a lot of things if we started renaming them. Nov 26, 2013 at 16:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.