none
Change path to source while debugging?

    Question

  • Hi,

    I have several versions of my program on my PC. Something like this:

    C:\Program\Current\Source
    C:\Program\Current\exe
    C:\Program\Previous\Source
    C:\Program\Previous\exe

    Previous version fails on a test machine and test guys send me minidump file. I can open Program.mdmp in Visual Studio, I can specify path to executable: Properties -> Debugging -> Command Arguments -> modpath=C:\Program\Previous\exe (there should be a better way!). The problem is - it always shows me source code from C:\Program\Current\Source! I understand the path is hardcoded in pdb files. Is there a way I could tell it to load sources from C:\Program\Previous\Source ?

    Please do not suggest I should rename Previous to Current.... 

    Visual Studio 2008, Native C++

    Thanks!
    Friday, August 15, 2008 8:35 AM

Answers

  • Look under Solution properties (not project properties). There should be a Debug Source Files tab. Remove all the paths (or add the correct paths) to the Directories containing source code.
    Friday, September 04, 2009 8:32 PM
    Moderator

All replies

  •  

    Hi,

    The binary execution file contains the path of pdb file specific to it, and in the pdb file, source code paths are included. From the context, it seems that the debugger tries to load the pdb file of previous version, would you please check whether the pdb file of current version resides in the same directory of your execution file?

    Thanks!


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Tuesday, August 19, 2008 9:33 AM
  • Debugger loads correct pdb file. I can see its name in Symbol File column of Modules window. 
    Also I can control where to look for pdb: Symbol Settings - Symbol file (.pdb) locations.
    And it will refuse to load symbols belonging to a different version of the program. This is fine.

    My problem: path to source seems to be hard-coded in pdb, but the source has moved since!
    I moved it to Previous, and have modified source in Current, so Current no longer matches the executable I am debugging.
    Now I am trying to debug Previous version, and I load correct (Previous) executable, can point the debugger to correct (Previous) pdb location but I cannot tell it to load source from Previous - it keeps showing Current source!
    Tuesday, August 19, 2008 3:02 PM
  • Found your post because I have the same issue.  I build on local drives because it's substantially faster than building on a network drive, but the results are too large to keep all build versions locally so when I'm done with each build I move it to a network drive.  But, like you, when I get a minidump and try to debug on the network drive, the PDB source pointers are all fully qualified paths to my local drive so the "actual" source that corresponds with the exe isn't loaded.  I don't have a good solution, I'm just posting in "support of" your problem.  My only option is to copy a 1/2 GB build tree locally every time I get a minidump when all I really need is the PDB to either be relative paths or some tool or option to allow me to re-path it...
    Mark
    Tuesday, September 16, 2008 1:32 PM
  • Tools + Options, Debugging, General, Enable source server support checkbox.  Press F1 and follow the links to find out how to setup a source server.
    Hans Passant.
    Wednesday, September 17, 2008 1:15 AM
    Moderator
  •  This is an annoying issue too, and unfortunately we don't use SourceSafe or Peforce.
    Friday, November 07, 2008 1:54 PM
  • Look under Solution properties (not project properties). There should be a Debug Source Files tab. Remove all the paths (or add the correct paths) to the Directories containing source code.
    Friday, September 04, 2009 8:32 PM
    Moderator