Compile

This will compile in debug mode and include symbols

gcc -ggdb cprog.c -o cprog

Load exec in gdb

gdb ./exec

Set breakpoint on main

b main

Show instructions for main function

disassemble

Show all functions

info functions

Show all variables

This will only work if the program is compiled in debug mode (with symbols)

info variables

List breakpoints

i b

Break on a specific memory address

b *0x8048417

Show register values

i r

Show multiple register values

i r ebp esp

View value for a particular register

String value:

x/s $ebp

Int value:

x/d $ebp

Restart program

r

Delete breakpoint

del <number>

View multiple lines from $esp

x/30xw $esp

Step line-by-line

si