This guide will help you start with gdb on a simple executable.
For more comprehensive guide follow this.
Disassemble with binary printing
Setting a breakpoint on a specific address
Useful commands:
(Note: the bold text is the command while the rest is the response)
(see this)
Examples:
(gdb) x/ $esp
0xffffd53c: 134516778
(gdb) x/x $esp
0xffffd53c: 0x0804902a
(gdb) x/24xw $esp
0xffffd524: 0xffffd5c4 0xffffd5cc 0x080481a8 0x080bdee8
0xffffd534: 0x080e900c 0x080495e0 0x0804902a 0x00000001
0xffffd544: 0xffffd5c4 0xffffd5cc 0x00000000 0x00000000
0xffffd554: 0x080481a8 0x00000000 0x080e900c 0x080495e0
0xffffd564: 0x571d6007 0xa1a831e8 0x00000000 0x00000000
0xffffd574: 0x00000000 0x00000000 0x00000000 0x00000000