Skip to content
SaeHie Park edited this page Jan 17, 2017 · 5 revisions

GDB frequent used commands

settings

show assembly code in c/c++

set disassemble-next-line on

default settings ?

put set inside ~/.gdbinit file

commands

show register value

info register

breakpoint

add

b umthunkstub.S:114
b dllimportcallback.h:286

enable or disable with breakpoint number

dis(able) 1
ena(ble) 1

add breakpoint at some specific address

b *0xb247dc71 // add breakpoint at 0xb247dc71

step

  • s : step in
  • n : next, step over
  • ni : next assembly instruction
  • si : step in assembly instruction, like call

dump

  • x/ni : dump n instructions, disassemble
    • x/20i
  • x/nx : dump n hex values
    • x/20x

multiple commands in one line

Use user defined function with multiple commands, like macro recording

(gdb) define fn
> c
> info register esp
> end
(gdb)

to use, just type the name (gdb) fn

Clone this wiki locally