Pre-setting locations for looking for source files in Visual C++ 6.0
Asked Answered
H

3

2

Due to the legacy nature of some of our code, we're still using Microsoft Visual 6.0 (SP6). When I attach to a running process to debug it for the first time, it has no knowledge of where the source files are located when I break into the process. It therefore asks me to navigate to the appropriate directory in my source tree, given a source file name. It remembers these directories, so I don't have to enter the same directory twice, but it's still painful.

Is there a way of pre-configuring VC6 with all the source file directories in my tree? Note that our project is built using makefiles (using nmake), rather than via DSPs.

Hospers answered 30/9, 2008 at 19:48 Comment(0)
N
1

The paths to the source files are recorded in the debugging information (Program Database, .pdb). Make the build tree on your machine the same as the machine it was built on.

Nickelic answered 30/9, 2008 at 23:16 Comment(1)
Mike, we're building (using cl.exe and link.exe) without absolute path names, which means the PDBs don't have the full path to the files (or so I am guessing). That's why I'm after an alternative way of specifying the source file directories.Hospers
S
0


Yes.
go into


TOOLS
OPTIONS
DIRECTORY (tab)

and you can set the SOURCES/LIBRARIES/INCLUDE directory locations. These values apply to all projects within the workspace.


I do not know if setting those values will allow the information to be seen using direct makefiles.

Sublapsarianism answered 1/10, 2008 at 0:16 Comment(0)
H
0

Absolute path information is not recorded in our PDBs files, since we are deliberately not wanting to tie our source tree to a particular top-level directory; when it is deployed, it is not possible to drop the source tree in the same position as was used on the build machine.

EvilTeach's solution certainly gives the desired effect, though our source tree consists of literally hundreds of directories, making entering them manually somewhat cumbersome. There's also the problem that a developer may have multiple source trees that they're running from at any given time, so being able to switch between those trees when debugging a given executable is essential.

I subsequently found that you can programmatically (well, at least from the command line) switch a set of source directories by directly updating the registry:

REGEDIT4

[HKEY_CURRENT_USER\Software\Microsoft\Devstudio\6.0\Build
System\Components\Platforms\Win32 (x86)\Directories]
"Source Dirs"="<path1>;<path2>"

That's not too bad, and would certainly do the trick.

However, the solution I settled upon was setting the SOURCE environment variable to contain all the source paths (as a semicolon-separated list of directories). A very simple batch file could do this, and allow switching between different trees. Then, you run up Visual C++ from the command line, using the option telling it from read SOURCE (and INCLUDE, LIB and PATH) from the environment:

msdev /useenv

Looking under Tools->Options, you'll see that the directories from SOURCE have indeed been loaded. I was then able to attach to a running process, and the debugger was able to locate any code that I debugged into.

Life just got that much easier!

Hospers answered 6/10, 2008 at 5:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.