Searching for Source and STB Files

After the program is linked and CodeWatch is invoked with the loaded executable file as an argument, the debugger requires access to both the program source file(s) and the STB file(s).

The source file(s) will, by default, be searched for first in the directory that was specified to the compiler (relative to the current directory), and if not found, then in the current directory.

The STB file(s) will, by default, be searched for first in the current directory (where they are created), and if they are not found, they will be searched for in the directory that was specified to the compiler. This is the exact opposite of the search algorithm used for source files.

It is possible through the use of debugger command-line arguments and/or environment variables to specify alternate directories in which to search for both source and STB files before the default directories are searched.

The CodeWatch options -srcpath and/or -stbpath, followed by a list of directory names separated by colons (:), may be given to specify a list of directories to be searched before any other directories are searched. These directory lists will be searched (in order) for source files and/or STB files, respectively. If a directory list starts with a colon, the current directory (.) is assumed to be first (a trailing colon is ignored). The -path option followed by a directory list will be used in place of the -srcpath option and/or the -stbpath option if one or both is not given.

If the source and/or STB files are not yet found after searching any directories specified when invoking CodeWatch, the debugger will search directories specified by environment variables in a similar manner. The environment variables CODEWATCH_SRCPATH and/or CODEWATCH_STBPATH may be set to a list of directory names, separated by colons. These directory lists will be searched (in order) for source files and/or STB files, respectively. The environment variable CODEWATCH_PATH followed by a directory list will be used in place of the CODEWATCH_SRCPATH environment variables and/or the CODEWATCH_STBPATH environment variables if one or both is not given.

For example, the following command:

cw_java -srcpath :/pl1progs/src:/src/pl1progs\ -stbpath /pl1progs/stb:/pl1progs/obj program-name

will cause the debugger to search for the source files in the following directories in order:

  1. /pl1progs/src
  2. /src/pl1progs
  3. The directory specified at compilation (if other than the current directory)
  4. The current directory (.)

The debugger will search for the STB files in the following directories in order:

  1. /pl1 progs/stb and /pl1 progs/obj
  2. The current directory (.)
  3. The directory specified at compilation (if other than the current directory)