Most tricky/useful commands for gdb debugger [closed]
- backtrace full: Complete backtrace with local variables
- up, down, frame: Move through frames
- watch: Suspend the process when a certain condition is met
- set print pretty on: Prints out prettily formatted C source code
- set logging on: Log debugging session to show to others for support
- set print array on: Pretty array printing
- finish: Continue till end of function
- enable and disable: Enable/disable breakpoints
- tbreak: Break once, and then remove the breakpoint
- where: Line number currently being executed
- info locals: View all local variables
- info args: View all function arguments
- list: view source
- rbreak: break on function matching regular expression
Start gdb with a textual user interface
gdb -tui
Starting in gdb 7.0, there is reversible debugging, so your new favourite commands are:
* reverse-continue ('rc') -- Continue program being debugged but run it in reverse
* reverse-finish -- Execute backward until just before the selected stack frame is called
* reverse-next ('rn') -- Step program backward, proceeding through subroutine calls.
* reverse-nexti ('rni') -- Step backward one instruction, but proceed through called subroutines.
* reverse-step ('rs') -- Step program backward until it reaches the beginning of a previous source line
* reverse-stepi -- Step backward exactly one instruction
* set exec-direction (forward/reverse) -- Set direction of execution.
Instead of launching GDB with "-tui" param you can also switch to text mode after a while using by typing "wh".