# GDB Debugger

The other common debug programs on Unix systems are dbx and dbxtool.

Before a program can be processed by the debugger, it must be compiled with the debugger option.

    	gcc -ggdb -o pipe pipe.c

The program can then be passed to the debugger with

    	gdb pipe

To pass command line parameters to the program use:

    	set args -size big

This is equivalent to saying:

    	pipe -size big

To single step:

    	break
    	run
    	step

The step command stops execution at the next source statement, if that statement is a function call, gdb will single step into the function.
A simular command is next this will also single step source statements but when a it meets a function call, the function is executed and gdb stops when it reaches a new source statement in the calling function.

step can be abreviated to s
next can be abreviated to n

To set break points:

    	break 48	<-- Program will stop BEFORE executing line 48
    	break FuncName  <-- Program will stop when entering the function
    	run

To display the contents of a variable:

    	print ant[0]

To change the value of a variable:

    	set ant[0] = 4
    	set char = 'z'

Top | Master Index | Keywords | Functions