gdb
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| gdb [2017/09/20 00:13] – fe80:a5b0:8fc5:656d:b429:1723:31ec:834e | gdb [2024/11/14 06:58] (current) – A User Not Logged in | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | GDB cheatsheet: | + | ====== General ====== |
| + | |||
| + | attach to running process without break: | ||
| + | |||
| + | gdb attach -ex cont -iex "set pagination off" $(pidof process_name) | ||
| < | < | ||
| Line 9: | Line 13: | ||
| end | end | ||
| </ | </ | ||
| + | |||
| + | ====== Print Command ====== | ||
| + | |||
| + | print string pointed by $rdi: | ||
| + | |||
| + | x/s $rdi | ||
| + | | ||
| + | show bytes pointed by register with offset: | ||
| + | |||
| + | x/16bx $rsi+0x42 | ||
| + | | ||
| + | print array with size as bytes in registers: | ||
| + | |||
| + | p/x *(char *)$rcx@$dx | ||
| + | p/x (char[size]) *$rcx | ||
| + | |||
| + | ====== Breakpoint ====== | ||
| + | |||
| + | break on address: | ||
| + | |||
| + | b *0xdeadbeef | ||
| + | |||
| + | break at offset to function name: | ||
| + | |||
| + | < | ||
| + | b *(& | ||
| + | b *(funcname+0xbeef) | ||
| + | b *(' | ||
| + | </ | ||
| + | |||
| + | set conditional breakpoint: | ||
| + | |||
| + | break dlopen if strcmp(file, | ||
| + | |||
| + | set logpoint: | ||
| + | |||
| + | < | ||
| + | break func_name | ||
| + | commands | ||
| + | silent | ||
| + | printf "msg: %d\n", *($rdi+0xbeef) | ||
| + | cont | ||
| + | end | ||
| + | |||
| + | </ | ||
| + | | ||
| + | | ||
| + | |||
gdb.1505866425.txt.gz · Last modified: by fe80:a5b0:8fc5:656d:b429:1723:31ec:834e
