ALL GDB commands:
COMMAND | DESCRIPTION |
---|---|
help | List gdb command categories |
help category | List gdb commands of category |
help command | Displays description of command |
apropos search-word | Display commands list containing search-word in their help description |
info args i args |
Displays arguments of current function |
info breakpoints info break info b i b |
Displays list of breakpoints |
info break breakpoint-number i b breakpoint-number |
Displays description of breakpoint having breakpoint-number |
info watchpoints i watchpoints |
Displays list of watchpoints |
info registers i r |
Display processor's register contents |
info threads i threads |
Display information about current thread |
info set i set |
List set-able options |
r | Start running program until a breakpoint or end of program |
Breakpoints and Watchpoints | |
break funname break line-no break ClassName::funcName |
Set a breakpoint at specified function or line number. |
break +line-offset break -line-offset |
Set a breakpoint at specified number of lines forward or backward from current line of execution. |
break filename:funcname | Set a breapoint at specified funcname of given filename. |
break filename:line-no | Set a breakpoint at given line-no of specified filename. |
break *address | Set a breakpoint at specified instrunction address. |
break line-no if condition | Set a conditional breakpoint at line-no of current file. Program will suspend only when condition is true. |
break line thread thread-no | Set a breakpoint at line in thread with thread-no. |
tbreak | tbreak is similar to break but it will temporary breakpoint. i.e. Breakpoint will be deleted once it is hit. |
watch condition | Set a watchpoint for given condition. Program will suspend when condition is true. |
clear clear function clear line-number |
Delete breakpoints as identified by command option. Delete all breakpoints in function Delete breakpoints at given line |
delete | Delete all breakpoints, watchpoints, or catchpoints. |
delete breakpoint-number delete range |
Delete the breakpoints, watchpoints, or catchpoints specified by number or ranges. |
disable breakpoint-number disable range enable breakpoint-number enable range |
Enable/Disable breakpoints, watchpoints or catchpoints specified by number or ranges. |
enable breakpoint-number once | Enables given breakpoint once. And disables it after it is hit. |
Program Execution | |
continue c |
Continues/Resumes running the program until the next breakpoint or end of program |
continue number | Continue but ignore current breakpoint number times. |
finish | Continue until the current function is finished |
step | Runs the next line of the program |
step N | Runs the next N lines of program |
next | Like s, but it does not step into functions |
print var | Prints the current value of the variable "var" |
set var=val | Assign "val" value to the variable "var" |
backtrace | Prints a stack trace |
q | Quit from gdb |
From:www.gdbtutorial.com/gdb_commands