1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
(sig.sh:7):
7: if [[ "$1"x != x ]] ; then
+# Test that debugged program's signals are saved and restored across
+# debug calls.
+### Testing that we have our signal set up...
+info signals
Signal Stop Print Stack Value
EXIT stop noprint nostack trap -- '_Dbg_exit_handler "$BASH_COMMAND"' EXIT
EXIT stop noprint nostack trap -- '_Dbg_exit_handler "$BASH_COMMAND"' EXIT
SIGINT stop print showstack trap -- '_Dbg_sig_handler 2 "$BASH_COMMAND" "$@"' SIGINT
SIGQUIT stop print showstack trap -- '_Dbg_sig_handler 3 "$BASH_COMMAND" "$@"' SIGQUIT
SIGILL stop print showstack trap -- '_Dbg_sig_handler 4 "$BASH_COMMAND" "$@"' SIGILL
SIGTRAP stop print showstack trap -- '_Dbg_sig_handler 5 "$BASH_COMMAND" "$@"' SIGTRAP
SIGTERM stop print showstack trap -- '_Dbg_sig_handler 15 "$BASH_COMMAND" "$@"' SIGTERM
+### Testing handle command...
+handle TERM nostack
+handle foo
Bad signal name: foo
+handle 1000
Bad signal number: 1000
+handle TERM bogus
Need to give a command: stop, nostop, stack, nostack, print, noprint
+eval kill -TERM $$
Program received signal SIGTERM (15)...
+### Should not have printed a stack trace above...
+handle TERM noprint
+handle TERM stack
+handle INT nostop
+eval kill -TERM $$
+info signals
Signal Stop Print Stack Value
EXIT stop noprint nostack trap -- '_Dbg_exit_handler "$BASH_COMMAND"' EXIT
EXIT stop noprint nostack trap -- '_Dbg_exit_handler "$BASH_COMMAND"' EXIT
SIGINT nostop print showstack trap -- '_Dbg_sig_handler 2 "$BASH_COMMAND" "$@"' SIGINT
SIGQUIT stop print showstack trap -- '_Dbg_sig_handler 3 "$BASH_COMMAND" "$@"' SIGQUIT
SIGILL stop print showstack trap -- '_Dbg_sig_handler 4 "$BASH_COMMAND" "$@"' SIGILL
SIGTRAP stop print showstack trap -- '_Dbg_sig_handler 5 "$BASH_COMMAND" "$@"' SIGTRAP
SIGTERM stop noprint showstack trap -- '_Dbg_sig_handler 15 "$BASH_COMMAND" "$@"' SIGTERM
+continue
Program received signal SIGTERM (15)...
->0 in file `eval.sh' at line 1
##1 _Dbg_do_eval("kill", "-TERM", "$$") called from file `processor.sh' at line 402
##2 _Dbg_onecmd("eval", "kill -TERM $$") called from file `processor.sh' at line 167
##3 _Dbg_process_commands() called from file `hook.sh' at line 188
##4 _Dbg_debug_trap_handler("0", "[[ "$1"x != x ]]") called from file `sig.sh' at line 7
##5 source("sig.sh") called from file `bashdb' at line 157
##6 main() called from file `bashdb' at line 0
+### Should have printed a stack trace above...
+continue
+where 1
->0 in file `sig.sh' at line 1
+continue
Program received signal SIGINT (2)...
->0 in file `sig.sh' at line 1
##1 source("sig.sh") called from file `bashdb' at line 157
##2 main() called from file `bashdb' at line 0
Program received signal SIGINT (2)...
->0 in file `sig.sh' at line 1
##1 source("sig.sh") called from file `bashdb' at line 157
##2 main() called from file `bashdb' at line 0
Debugged program terminated normally. Use q to quit or R to restart.
+kill
sig.tests: line 12: 9711 Killed $SH ${top_builddir}/bashdb -B -q -L $top_builddir -x $cmdfile $debugged_script
|