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/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.
unlimit coredumpsize
Here are some useful commands to get you started with dbx. Full details are available by typing:
man dbxTo 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"!)
dbx
dbx programname
(dbx) whereFor example:
(dbx) where read.read(0x0, 0x4000, 0x2000) at 0x3a8 _filbuf(0x1958) at 0x353 fgets.fgets(0x7fffe1e4, 0x4f, 0x1958) at 0x209 readResponse(), line 53 in "housing.c" chooseSide(), line 66 in "housing.c" main(0x1, 0x7fffe294, 0x7fffe29c), line 11 in "housing.c"In this example, my function main() called chooseSide(), which called readResponse(), and my program stopped in readResponse line 53.
Usually you'll see other functions called after yours, functions that you didn't write yourself. These are normally system or library function calls, and you shouldn't worry about them. Understanding them can be useful, since they help to verify where the crash actually occured, and the arguments to these functions are usually related to the cause of the crash. (In the above example, these functions are fgets.fgets(), _filbuf(), and read.read().)
(dbx) print variablenameIf you have variables in two different functions with the same name, you can specify the one in the function you want with the syntax:
(dbx) print functionname.variablename
(dbx) stop at BigFunction [2] stop in BigFunction (dbx) print k 7 (dbx) assign j=k+3The above sequence of commands will stop your program at the entry to the function BigFunction(), show you the value of the variable k, and then assign the value 10 (7+3) to the variable j. After having done this, you might choose the continue command to continue running your program (with the value of whatever variables you have assigned set as you wish) or the next command, which will just execute the next line of your source code, and then stop the program again, so that you can inspect more values.
last updated: 10/13/95