Here are some common commands used in GDB (GNU Debugger):
run
: starts the program being debuggedbreak [file:]line
: sets a breakpoint at the specified line in the current file or in the specified fileinfo breakpoints
: lists all breakpointsdelete [breakpoint-number]
: deletes a breakpointcontinue
: continues execution until the next breakpoint or the end of the programnext
: executes the next line of the program, stepping over function callsstep
: executes the next line of the program, stepping into function callsbacktrace
: displays a stack trace of the current execution stateprint [variable-name]
: prints the value of the specified variablehelp
: displays a list of commands or information about a specific commandquit
orq
: exits GDB
Note: gdb has a lot more command to debug and inspect, These are the most common and useful command which is used to debug C/C++ programs.