APPENDIX E3
************************************************************
* UNIX DEBUGGING TOOLS *
************************************************************
The debugger on Unix is called: dbx.
There is a manual entry on dbx. Just type:
man dbx
To use dbx, you need:
a) to compile your source program with the option -g.
For example, if the source file is called: merge.c, type:
cc -g merge.c
b) we will assume that the code file is called a.out, and
resides in the same directory as the source file, merge.c
c) execute:
dbx
d) then run the debugger, using the option: 'r'
A script session of the debugger follows. In this example, I
omitted on purpose to create the input files, associated
with the merge program, to create a Segmentation Fault.
dbx found that the error was in the fgets() function, but
could not find the source (it is a library function).
There should be also ways to use dbx with trace functions.
************************************************************
* Script started on Tue May 3 15:19:32 1994 *
* % dbx *
* enter object file name (default is `a.out'): *
* dbx version 2.10.1 *
* Type 'help' for help. *
* reading symbolic information ... *
* main: 46 MAXLINE=80; *
* (dbx) r *
* *
* Segmentation fault [fgets.fgets:13 +0x20,0x4008ac] *
* Source not available *
* (dbx) q *
* % *
* script done on Tue May 3 15:19:46 1994 *
************************************************************
.bp