From 2520f38555c9afcd6bec50116807f8bf97311d43 Mon Sep 17 00:00:00 2001 From: johannst Date: Fri, 25 Oct 2019 20:42:48 +0200 Subject: added some notes about debugging --- gdb.txt | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 53 insertions(+), 5 deletions(-) (limited to 'gdb.txt') diff --git a/gdb.txt b/gdb.txt index 47ecdce..37b6b48 100644 --- a/gdb.txt +++ b/gdb.txt @@ -8,6 +8,7 @@ |prompt| |user_commands| |hooks| + |flows| # gdb(1) *gdb* ========= @@ -30,7 +31,7 @@ specify which process to follow on fork(2) sharedlibrary [regex] - load symbols of shared lib, if regex then only symbols + load symbols of shared lib, if REGEX then only symbols for matching libs break thread @@ -41,20 +42,34 @@ so 'rbreak foo' matches barfoobar() command [bp_list] define commands to run after breakpoint hit if - bp_list not supplied attach command to last + BP_LIST not supplied attach command to last created bp - bp_list: space separates list, eg 'command 2 5-8' + 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 functions according to REGEX, if REGEX empty, list all info variables [regex] - list variables according to regex, if regex empty, + list variables according to REGEX, if REGEX empty, list all + info handle [signal] + list bevahior for SIGNAL, if SIGNAL empty list all signals + + handle signal + configure how gdb handles SIGNAL which is ment for the debugee + : + stop/nostop catch signal in gdb and break + print/noprint print message when gdb catches signal + pass/nopass pass signal down to debugee + noignore/ignore synonyms for + + catch signal + create a catchpoint for SIGNAL + user commands: *user_commands* define defines user command to be run @@ -78,6 +93,39 @@ # cmds executing end + + flows: *flows* + # catch SIGSEGV and execute some actions once it happends + - script: + catch signal SIGSEGV + command + bt + ct + end + + # quickly execute gdb command on running process, eg get backtrace from + # thread 1 + - cmd: + $> gdb -ex 'thread 1' -ex 'bt' -p + + # script gdb for automating debugging sessions + - script: run.gdb + set pagination off + + break mmap + command + info reg rdi rsi rdx + bt + c + end + + #initial drop + c + + - cmd: + $> gdb -p -x ./run.gdb --batch &> run.log + + -------------------------------------------------------------------------------- vim:sts=2:et:tw=80:cc=80:fo+=t:ft=help -- cgit v1.2.3