From Etp
Jump to: navigation, search

Here is a list of commands for gdb. More information on debugging will follow

gdb $yourbinary Starts to debug $yourbinary with gdb
set args $1 $2 If your binary needs two arguments on commandline, you can supply them like thi
run Starts the execution of the program (If no breakpoints are set, the programm will simply run until it ends normally
break 23 Sets a breakpoint in line 23
break functionName Sets a breakpoint at function functionName
break D3PDSelector.C:23 Sets a breakpoint in D3PDSelector.C in line 23. Very usefull if you have multiple files, or want to set a breakpoint before a library is even loaded
condition 1 eventNumber==304 Only breaks at breakpoint 1 if the eventNumber==304.
delete 1 Deletes breakpoint number 1
continue Continue with the execution of the program until the next breakpoint or the end of the program is reached
next execute the next line, then break again
step execute the next line. If this line is a function call, step into the function and break there. This allows to examine what happens inside external functions
finish finishes the current function, then breaks again
print $variablename Prints the current content of a variable
list lists the code surrounding the line where you currently are
watch i Sets a watchpoint for the variable i. Everytime it is changed there will be a break.