index.html :: rss :: github :: telegram :: email

gdb: notes

15 Nov 2024

Learning new ways to procrastinate^W, so there is what i've learned about gdb so far:

Documentation

si - step by instruction

layout asm - show instructions

layout regs - show registers

display/3i $pc - show 3 next instructions after each step

p $r13, p $rax - print register values

p/t $r13 - print as binary value

i reg - print all registers

x/i 0x40200d - instruction at address

x/d 0x40200d - decimal value at address

x/i $pc - current instruction at PC

p $rsi, x/d $ - evaluate address in rsi, then print a value under an address

p $eflags - print processor flags (see notes for register names) ($ps is an alias for $eflags)

set $r13 = 123 - set register value

set $sp += 4 - increase stack pointer value by 4.

gdbinit options

set disassembly-flavor intel - switch asm syntax to Intel