Cherin's List of Useful gdb Commands

This list is a small subset of what gdb can do. Some or all of these commands can be useful in disarming your binary bombs.

  1. Setting up breakpoints at a function
    (gdb) break function_name
    
    Here is an example
    (gdb) break main
    
  2. Example of setting up a breakpoint at a particular address
    (gdb) break *0x8bffd5c0
    
  3. Run your program. It will stop at a breakpoint or for user input or at the end of the program.
    (gdb) run
    
  4. Execute one instruction
    (gdb) stepi
    
  5. Execute eight instructions
    (gdb) stepi 8
    
  6. Execute one instruction like stepi, but proceed through function calls
    (gdb) nexti
    
  7. Continue execution
    (gdb) continue
    
  8. Run until current function returns
    (gdb) finish
    
  9. Look at the contents of registers
    (gdb) info registers
    
  10. Examine the contents of a location in memory
    (pre) x/x 0x8bffd5c0
    
    Hint: use 'help x' to learn about the other formatting options with the x command.
  11. Gdb is a powerful tool. Learn more gdb commands to improve your productivity. Use the 'help' command.