Fix to handle properly 'catch signal SIGINT' and SIGTRAP
authorPhilippe Waroquiers <philippe@sourceware.org>
Fri, 3 May 2013 19:16:56 +0000 (19:16 +0000)
committerPhilippe Waroquiers <philippe@sourceware.org>
Fri, 3 May 2013 19:16:56 +0000 (19:16 +0000)
gdb/ChangeLog
gdb/break-catch-sig.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/catch-signal.c
gdb/testsuite/gdb.base/catch-signal.exp

index 654e4fc0c0b3729effe112ae36a4705038db676d..4469076993fc59158ea832e4eab259aa54285a23 100644 (file)
@@ -1,3 +1,9 @@
+2013-05-03  Philippe Waroquiers  <philippe.waroquiers@skynet.be>
+
+       * 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  <brobecker@adacore.com>
 
        * darwin-nat.c (darwin_read_write_inferior): Change types
index 4b5ffae926d9842d2e15142e2c3a2fa9e83e5c0f..c162cc20ff3e0c4e5dd08a567da874ac7b114443 100644 (file)
@@ -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
index ca1e0fb01077c1fe909745c8b24331e45b7ed2a1..7100b34ecaf85668a8c799c735ca484e34f95f39 100644 (file)
@@ -1,3 +1,8 @@
+2013-05-03  Philippe Waroquiers  <philippe.waroquiers@skynet.be>
+
+       * gdb.base/catch-sig.c (main): Raise SIGINT.
+       * gdb.base/catch-sig.exp: Test "catch signal SIGINT".
+
 2013-05-03  Hafiz Abid Qadeer  <abidh@codesourcery.com>
 
        * status-stop.exp (test_tstart_tstart): Check for error
index d128958c30caa68a34974d00d55336adbeac2d2c..36d34d26477a93ef9e108a4dd0a7d7f7c56252ee 100644 (file)
@@ -42,5 +42,7 @@ main ()
   raise (SIGHUP);              /* third HUP */
 
   raise (SIGHUP);              /* fourth HUP */
+
+  raise (SIGINT);              /* first INT */
 }
 
index 2ca4dff7fae89352401b230fb42fceb3640d6cb0..e7179a042e6d4583827c5487e339d075d7397634 100644 (file)
@@ -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.*"
+        
     }
 }