gdb - ybendito/tips GitHub Wiki

GDB cheat sheet

  • attach: gdb -p $(pidof qemu-system-x86_64)

  • info threads

  • thread <id>

  • memdump: x/8xg <mem>

  • breakpoint:
    b procedure -> c -> break
    i r a5 (info registers a5) -> si (step instruction)

  • vs.QEMU stub: qemu-riscv -s -S ...
    riscv-gdb riscv.elf
    target extended-remote localhost:1234

  • signal processing (example):
    handle SIGUSR1 nostop print pass (to just prevent break on this signal)

  • coredump analysis: (especially when the dump is lz4)
    coredumpctl list
    coredumpctl info <pid>
    coredumpctl gdb <pid>

⚠️ **GitHub.com Fallback** ⚠️