Go to main content
Oracle® Developer Studio 12.5: Debugging a Program with dbx

Exit Print View

Updated: June 2016

Finding Source and Object Files

dbx must know the location of the source code files associated with a program. The default directory for the source files is the one they were in when last compiled. If you move the source files or copy them to a new location, you must either relink the program, change to the new location before debugging, or use the pathmap command.

Under the stabs format used by dbx in Sun Studio 11 and earlier releases, debugging information in dbx sometimes uses object files to load additional debugging information. Source files are used when dbx displays source code.

Symbolic information, including paths to source files, is contained within the executable file. When dbx needs to display source lines, it reads as much symbolic information as necessary to locate the source file, and read and display the lines from it.

The symbolic information includes the full path name of a source file, but when you type dbx commands, you typically use only the basename of a file. For example:

stop at test.cc:34

dbx searches for a matching file in the symbolic information.

If you have removed source files, dbx cannot show you source lines from those files, but you can display stack traces, print variable values, and even determine the source line you are on.

If you have moved the source files since you compiled and linked the program, you can add their new location to the search path. The pathmap command creates a mapping from your current view of the file system to the name in the executable image. The mapping is applied to source paths and object file paths.

To establish a new mapping from the directory from to the directory to:

(dbx) pathmap [-c] from to

If -c is used, the mapping is applied to the current working directory as well.

The pathmap command is also useful for dealing with automounted and explicit NFS mounted file systems with different base paths on differing hosts. Use -c when you try to correct problems due to the automounter because current working directories are inaccurate on automounted file systems.

The mapping of /tmp-mnt to / exists by default.