From a20ebf65bfc2a1d56964c6e90557ff009730c6b3 Mon Sep 17 00:00:00 2001 From: johannst Date: Sun, 7 Jul 2019 17:53:21 +0200 Subject: added gdb notes --- gdb.txt | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 gdb.txt diff --git a/gdb.txt b/gdb.txt new file mode 100644 index 0000000..65015be --- /dev/null +++ b/gdb.txt @@ -0,0 +1,82 @@ +.:: GDB ::. +-------------------------------------------------------------------------------- + +# toc +------ + |gdb| + |opts| + |prompt| + |user-commands| + |hooks| + +# gdb(1) *gdb* +========= + gdb [opts] [exe [coredump | pid]] + gdb [opts] --args exe + opts: *opts* + -p attach to pid + -x execute script before prompt + -ex execute command before prompt + --tty set I/O tty for debugee (see *prompt* for details) + + + prompt: *prompt* + tty + set as tty for debugee. make sure nobody reads from target + tty, easiest is to spawn a shell and run + > while true; do sleep 1024; done + + set follow-fork-mode + specify which process to follow on fork(2) + + sharedlibrary [regex] + load symbols of shared lib, if regex then only symbols for matching + libs + + break thread + set a breakpoint only on a specific thread + + rbreak + set breakpoints based on symbols matching regex + is internally expanded to .*.* + so 'rbreak foo' matches barfoobar() + + command [bp_list] + define commands to run after breakpoint hit + if bp_list not supplied attach command to last created bp + + bp_list: space separates list, eg 'command 2 5-8' + to run command for bp 2,5,6,7,8 + + info functions [regex] + list functions according to regex, if regex empty, list all + + info variables [regex] + list variables according to regex, if regex empty, list all + + + user commands: *user-commands* + define defines user command to be run + # cmds in prompt or script + end + + document define documentation for cmd + # docu + end + + help user-defined list user defined commands + help list documentation for command + + + hooks: *hooks* + define hook- run commands defined in hook before + # cmds executing + end + + define hookpost- run commands defined in hookpost after + # cmds executing + end + +-------------------------------------------------------------------------------- +vim:sts=2:et:tw=80:cc=80:fo+=t:ft=help + -- cgit v1.2.3