A dbx Tutorial


In this tutorial you will use dbx to debug the 
blankstrip program.  You will debug the program twice:  first by 
setting breakpoints and executing the program a line at a time, second by 
using the debugger's trace command to print the values of key 
variables as the program executes.


As shown previously, when you compile and run blankstrip, the 
program removes leading blanks properly, but fails to remove trailing ones:


coke-1: blankstrip

Enter a string with leading and trailing blanks:

    asdf

input = '    asdf    '

output = 'asdf    '


Before you can debug the program with dbx you must recompile it 
using the -g option of cc.  The Makefile 
will do this for you if you type:


coke-2: make debug

cc -g main.c preblank.c adjstring.c tblank.c

main.c:

preblank.c:

adjstring.c:

tblank.c:}


This command creates a debuggable a.out file.


Now start the debugger:


coke-3: dbx a.out

dbx version 3.12 of 12/6/85 8:35 (paris).

Type 'help' for help.

reading symbolic information ...