Debugging with gdb

Command
Description

b <function>

Sets a breakpoint at <function>

b *mem

Sets a breakpoint at the absolute memory location

info b

Displays information about breakpoints

delete b

Removes a breakpoint

run <args>

Starts debugging the program from within gdb using the given arguments

info reg

Displays information about the current register state

stepi or si

Executes one machine instruction

next or n

Executes one function

bt

Backtrace command; shows the names of stack frames

up/down

Moves up and down the stack frames

print var print /x $<reg>

Printes the value of the variable and prints the value of a register, respectively

x /NT A

Examines memory, where N = number of units to display; T = type of data to display (x:hex, d:dec, c:char, s:string, i:instruction); and A = absolute address or symbolic name, such as "main"

quit

exits gdb

Last updated