How to get Started Using the Debugger DBX


Dbx can be a very helpful debugger, and it works on C, Fortran, and Pascal code. In order to use dbx, you must compile your code with the -g flag. This flag causes the compiler to produce symbol table information that dbx needs. (Type man cc, man f77, or man pc for details.)

If your program is exiting in the middle with an error such as a segmentation violation or floating exception, then you may want to enable a core dump. Usually, those two messages above would also have (core dumped) by them, indicating that the program wrote an image of its current memory into a file called core in that directory. Athena turned this off by default, since for most people core is just a waste of disk space.

To allow core dumps and still not have quota worries, you can make a symbolic link from the name core into the /tmp directory. Core dumps created this way will not take up quota, and they will automatically vanish when you log out. The dump will also occur more quickly since it doesn't have to go over the network to your directory. To set up a core link in a directory:

ln -s /tmp/core.project ./core
unlimit coredumpsize
/tmp/core.project in the first line is the name that the file is really called. You can change the name to something else if you want to work with more than one directory at a time.

Here are some useful commands to get you started with dbx. Full details are available by typing:

man dbx
To start it up, you'd type a form of the dbx command (on the Sun Sparc workstations, you should type "add sunsoft" prior to using "dbx"!) Once you are in dbx, there are various options. There are a number of other useful commands in dbx. You'll see them in the manual page. Also, note that some of the major problems with dbx are listed at the very end of the manual page.

last updated: 10/13/95