<title>GDB Debugger</title> <head> <script language="JavaScript"> </script> </head> <body bgcolor="#ffffcc"> <hr> <center> <h1>GDB Debugger</h1> </center> <hr> <p> The other common debug programs on Unix systems are dbx and dbxtool.<p> Before a program can be processed by the debugger, it must be compiled with the debugger option. <pre> gcc -ggdb -o pipe pipe.c </pre> The program can then be passed to the debugger with <pre> gdb pipe </pre> To pass command line parameters to the program use: <pre> set args -size big </pre> This is equivalent to saying: <pre> pipe -size big </pre> To single step: <pre> break run step </pre> The <b>step</b> command stops execution at the next source statement, if that statement is a function call, gdb will single step into the function. <br> A simular command is <b>next</b> 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. <p> <b>step</b> can be abreviated to <b>s</b> <br> <b>next</b> can be abreviated to <b>n</b> <p> To set break points: <pre> break 48 <-- Program will stop BEFORE executing line 48 break FuncName <-- Program will stop when entering the function run </pre> To display the contents of a variable: <pre> print ant[0] </pre> To change the value of a variable: <pre> set ant[0] = 4 set char = 'z' </pre> <p> <hr> <p> <center> <table border=2 width=80% bgcolor="ivory"> <tr align=center> <td width=25%> <a href=../cref.html> Top</a> </td><td width=25%> <a href=../master_index.html> Master Index</a> </td><td width=25%> <a href=../SYNTAX/keywords.html> Keywords</a> </td><td width=25%> <a href=../FUNCTIONS/funcref.htm> Functions</a> </td> </tr> </table> </center> <p> <hr> <address>Martin Leslie </address><p>