Skip to content

Latest commit

 

History

History
executable file
·
80 lines (50 loc) · 1.48 KB

gdb.md

File metadata and controls

executable file
·
80 lines (50 loc) · 1.48 KB

GDB

Catch events

Catch syscalls (Linux)

(gdb) catch syscall SYSCALL_NAME

Examples

(gdb) catch syscall read
(gdb) catch syscall fork

If you have an old GDB and it doesn't support catch syscall by name or you know syscall number you can catch syscall by number.

Example: Catch fork()

(gdb) catch syscall 57

See

Catch a new thread event (Linux)

(gdb) catch syscall clone

or

(gdb) break __pthread_create_2_1

See

GDB initialization scripts

  • /etc/gdbinit
  • ~/.gdbinit
  • ./.gdbinit

Source: systutorials.com: gdbinit (5) - Linux Man Pages

Other

Set Intel syntax for assembly

set disassembly-flavor intel

Command history

set history save on

Hint: Add command above to some of initialization scripts(e.g. ~/.gdbinit).

Default path for history is ./.gdb_history

Source: sourceware.org: Debugging with GDB: 22.3 Command History

TODO

  • Remote debugging