gdb

Table of Contents

1. Basics

  • Pressing ret will run the same command.
  • b : set breakpoint
  • r : run

1.1. Printing info

Once in a breakpoint

  • [p]rint <expression>
  • p/x <expr>: print in hex
  • [i]nfo {[f]rame, [s]tack, [r]registers, [b]reak}

1.2. Disassembly/Assembly

  • [disassemble] <function name>
  • display/I %pc : Display next instruction

1.3. Layout

  • layout next and following with ret will allow you to loop though layouts.
  • Use focus {cmd, src, asm} to change keyboard focus, otherwise arrow keys(eg. prev command/scroll) will not work
  • Layouts
    • next will display the next layout.
    • prev will display the previous layout.
    • src will display the source and command windows.
    • asm will display the assembly and command windows.
    • split will display the source, assembly, and command windows.
    • regs will display the register, source, and command windows when in src layout.

1.4. Stepping

  • [s]tep : Into function calls
  • [n]ext : Over functions calls, stepping by lines
  • [b]ack[t]race / i stack / where: backtrace, prints stacktrace

Created: 2024-07-16 Tue 16:44

Validate