From: Philippe Waroquiers Date: Fri, 3 May 2013 19:16:56 +0000 (+0000) Subject: Fix to handle properly 'catch signal SIGINT' and SIGTRAP X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=96f7d3f1666830257f8942c168640ad8cc8b0ea0;p=binutils-gdb.git Fix to handle properly 'catch signal SIGINT' and SIGTRAP --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 654e4fc0c0b..4469076993f 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2013-05-03 Philippe Waroquiers + + * break-catch-sig.c (signal_catchpoint_breakpoint_hit): Do not + ignore SIGINT and SIGTRAP in case these internal signals are + caught explicitely. + 2013-05-01 Joel Brobecker * darwin-nat.c (darwin_read_write_inferior): Change types diff --git a/gdb/break-catch-sig.c b/gdb/break-catch-sig.c index 4b5ffae926d..c162cc20ff3 100644 --- a/gdb/break-catch-sig.c +++ b/gdb/break-catch-sig.c @@ -199,13 +199,13 @@ signal_catchpoint_breakpoint_hit (const struct bp_location *bl, VEC_iterate (gdb_signal_type, c->signals_to_be_caught, i, iter); i++) if (signal_number == iter) - break; + return 1; /* Not the same. */ - if (!iter) - return 0; + gdb_assert (!iter); + return 0; } - - return c->catch_all || !INTERNAL_SIGNAL (signal_number); + else + return c->catch_all || !INTERNAL_SIGNAL (signal_number); } /* Implement the "print_it" breakpoint_ops method for signal diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index ca1e0fb0107..7100b34ecaf 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-05-03 Philippe Waroquiers + + * gdb.base/catch-sig.c (main): Raise SIGINT. + * gdb.base/catch-sig.exp: Test "catch signal SIGINT". + 2013-05-03 Hafiz Abid Qadeer * status-stop.exp (test_tstart_tstart): Check for error diff --git a/gdb/testsuite/gdb.base/catch-signal.c b/gdb/testsuite/gdb.base/catch-signal.c index d128958c30c..36d34d26477 100644 --- a/gdb/testsuite/gdb.base/catch-signal.c +++ b/gdb/testsuite/gdb.base/catch-signal.c @@ -42,5 +42,7 @@ main () raise (SIGHUP); /* third HUP */ raise (SIGHUP); /* fourth HUP */ + + raise (SIGINT); /* first INT */ } diff --git a/gdb/testsuite/gdb.base/catch-signal.exp b/gdb/testsuite/gdb.base/catch-signal.exp index 2ca4dff7fae..e7179a042e6 100644 --- a/gdb/testsuite/gdb.base/catch-signal.exp +++ b/gdb/testsuite/gdb.base/catch-signal.exp @@ -71,6 +71,19 @@ proc test_catch_signal {signame} { gdb_breakpoint ${srcfile}:[gdb_get_line_number "fourth HUP"] gdb_continue_to_breakpoint "fourth HUP" delete_breakpoints + + # Verify an internal signal used by gdb is properly caught. + gdb_breakpoint ${srcfile}:[gdb_get_line_number "first INT"] + gdb_continue_to_breakpoint "first INT" + set test "override SIGINT to catch" + gdb_test "handle SIGINT nostop print nopass" \ + "SIGINT.*No.*Yes.*No.*" \ + "$test" \ + "SIGINT is used by the debugger.*Are you sure you want to change it.*y or n.*" \ + y + gdb_test "catch signal SIGINT" "Catchpoint .*" + gdb_test "continue" "Catchpoint .* SIGINT.*" + } }