How do I manage my search path so TotalView finds my source files?

 

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:

  1. If you always debug from somewhere inside your source tree, set the path in a .tvdrc file in the directory where you start TotalView. (This tip is actually part 4 of the startup tips. The Tip of the Week archive has links to the previous startup tips.)

    Here's an example:

    dset EXECUTABLE_PATH "./src1:./src2:./src2/subdir1"

  2. 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.

  3. 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" \
    tv_subdirs1

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

    dset EXECUTABLE_PATH ".$tv_subdirs1$tv_subdirs2"


You can find tips that we've already sent out in our Tip Archive

Help us improve these tips!