in ctf

GDB Cheat Sheet

Here is a list of GDB commands for quick reference when reverse engineering. I will update this accordingly.
UPDATE : install gdb peda! (

Set commands

(gdb) b ptrace
Breakpoint 1 at 0x8111a441:
(gdb) command 1
>set ($eax) = 0

Set disassembly flavor to intel
(gdb) ```set disassembly-flavor intel

Run the program
**`(gdb)`** ``r``

Disassemble main
**`(gdb)`** ```disass main```

Set breakpoint at main
**`(gdb)`** ```b main```

Set breakpoint at address function 
**`(gdb)`** ```b *0x50494b1 ```

Display registers
**`(gdb)`** ```i r```

Display the register eax
**`(gdb)`** ```i r eax```

View all breakpoints
**`(gdb)`** ```info breakpoints```

Delete breakpoints
**`(gdb)`** ```delete```

Step instruction 
**`(gdb)`** ```stepi```

Examine Memory 
**`(gdb)`** ```x/'Format' 'Address'```
o – octal
d – decimal
x – hexadecimal
u – unsigned integer
s – string
t – binary

b – byte
h – half
w – word
g – double word

Display stack
**`(gdb)`** ```x/300x $esp```

Run with parameter being passed in  
**`(gdb)`** ```r $(python -c'print "\x13"*37')```

List program command line arguments
**`(gdb)`** ```i args```

Exit GDB
**`(gdb)`** ```q```