View Full Version : How do I manage my search path so TotalView finds my source files?

07-20-2006, 10:47 AM
Most of the time, you do not need to worry about your search path since your compiler places information about a file's location within the debugging information that TotalView uses. If, however, you move your executable or if you are using a compiler that doesn't do a good job, TotalView may not find some of your source code unless you set a search path.

Here are three ways to set it: If you always debug from somewhere inside your source tree, set the path in a .tvdrc file in the directory where you start TotalView.

Here's an example:

dset EXECUTABLE_PATH "./src1:./src2:./src2/subdir1"[br]
If you have an environment variable that points to the source directory, you can use it within a Tcl statement that sets the EXECUTABLE_PATH variable. For example:

dset EXECUTABLE_PATH \ "$DEVEL_ROOT/src1:$DEVEL_ROOT/src2:$DEVEL_ROOT/src2/subdir1"

Totalview will expand the DEVEL_ROOT environment variable to define a search path.[br]
You can use Tcl to expand things for you. The following example does the same thing as the second example:
set root_dir $env(DEVELOP_ROOT)

set module1_subdirs { ./src1 ./src2 ./src2/subdir1 }
regsub -all { +\.} $module1_subdirs ":$root_dir" \

set module2_subdirs { ./src3 ./src4 ./src5/subdir1}
regsub -all { +\.} $module2_subdirs ":$root_dir/module2" \

dset EXECUTABLE_PATH ".$tv_subdirs1$tv_subdirs2"

4. Use a TCL proc as follows:
# Usage: [/url]
# [/url]
# rpath [root] [filter] [/url]
# [/url]
# If root is not specified, start at the current directory. filter is a [/url]
# a regular expression that removes unwanted entries. If it is not [/url]
# specified, the macro automatically filters out CVS/RCS/SCCS [/url]
# directories. The TotalView search path is set to the result. [/url]
proc rpath {{root "."} {filter "/(CVS|RCS|SCCS)(/|$)"}} { [/url]
# Invoke the UNIX find command to recursively obtain [/url]
# a list of all directory names below "root". [/url]
set find [split [exec find $root[b] –type d –print] \n] [/url]
set npath "" [/url]
# Filter out unwanted directories. [/url]
foreach path $find { [/url]
if {! [regexp $filter $path]} { [/url]
append npath ":" [/url]
append npath $path [/url]
} [/url]
} [/url]
# Tell TotalView to use it. [/url]
dset EXECUTABLE_PATH $npath [/url]
} [/url] [/url]
Notice that the CLI is executing the shell's [b]find command to traverse your computer's file system. The found directories are then appended to a variable. [/url]
Notice that the statement setting the [b]EXECUTABLE_PATH variable is the only statement that is unique to the CLI.