From: Philippe Waroquiers <philippe.waroquiers@skynet.be>
To: gdb-patches@sourceware.org
Subject: RFA: fix handling of catch signal SIGTRAP/SIGINT
Date: Wed, 01 May 2013 18:42:00 -0000 [thread overview]
Message-ID: <1367433782.2626.142.camel@soleil> (raw)
catch signal SIGTRAP/SIGINT is not working when the signal
is catched specifically with 'catch signal SIGTRAP'.
This is because the function signal_catchpoint_breakpoint_hit
still checks !INTERNAL_SIGNAL (signal_number) even
when the signal_number is member of c->signals_to_be_caught
The attached patch fixes this, and modifies gdb.base/catch-signal.exp
to test that SIGINT (one of the two internal signals) is properly
catched.
Ok to apply ?
Index: gdb/ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/ChangeLog,v
retrieving revision 1.15494
diff -u -p -r1.15494 ChangeLog
--- gdb/ChangeLog 30 Apr 2013 23:19:41 -0000 1.15494
+++ gdb/ChangeLog 1 May 2013 13:50:36 -0000
@@ -1,3 +1,9 @@
+2013-05-01 Philippe Waroquiers <philippe.waroquiers@skynet.be>
+
+ * break-catch-sig.c (signal_catchpoint_breakpoint_hit): do not
+ ignore SIGINT and SIGTRAP in case these internals signals are
+ catched explicitely.
+
2013-04-30 Doug Evans <dje@google.com>
* dwarf2read.c (lookup_dwo_unit): Return NULL if DWO not found.
Index: gdb/break-catch-sig.c
===================================================================
RCS file: /cvs/src/src/gdb/break-catch-sig.c,v
retrieving revision 1.3
diff -u -p -r1.3 break-catch-sig.c
--- gdb/break-catch-sig.c 12 Feb 2013 18:27:27 -0000 1.3
+++ gdb/break-catch-sig.c 1 May 2013 13:50:36 -0000
@@ -199,13 +199,13 @@ signal_catchpoint_breakpoint_hit (const
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: gdb/testsuite/ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/ChangeLog,v
retrieving revision 1.3640
diff -u -p -r1.3640 ChangeLog
--- gdb/testsuite/ChangeLog 30 Apr 2013 12:33:51 -0000 1.3640
+++ gdb/testsuite/ChangeLog 1 May 2013 13:50:39 -0000
@@ -1,3 +1,8 @@
+2013-05-01 Philippe Waroquiers <philippe.waroquiers@skynet.be>
+
+ * gdb.base/catch-sig.c (main): add raise SIGINT.
+ * gdb.base/catch-sig.exp: test catch signal SIGINT.
+
2013-03-27 Walfred Tedeschi <walfred.tedeschi@intel.com>
* gdb.xml/maint_print_struct.exp: New file.
Index: gdb/testsuite/gdb.base/catch-signal.c
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/catch-signal.c,v
retrieving revision 1.2
diff -u -p -r1.2 catch-signal.c
--- gdb/testsuite/gdb.base/catch-signal.c 12 Feb 2013 18:27:28 -0000 1.2
+++ gdb/testsuite/gdb.base/catch-signal.c 1 May 2013 13:50:39 -0000
@@ -42,5 +42,7 @@ main ()
raise (SIGHUP); /* third HUP */
raise (SIGHUP); /* fourth HUP */
+
+ raise (SIGINT); /* first INT */
}
Index: gdb/testsuite/gdb.base/catch-signal.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/catch-signal.exp,v
retrieving revision 1.3
diff -u -p -r1.3 catch-signal.exp
--- gdb/testsuite/gdb.base/catch-signal.exp 12 Feb 2013 18:27:28 -0000 1.3
+++ gdb/testsuite/gdb.base/catch-signal.exp 1 May 2013 13:50:39 -0000
@@ -71,6 +71,23 @@ proc test_catch_signal {signame} {
gdb_breakpoint ${srcfile}:[gdb_get_line_number "fourth HUP"]
gdb_continue_to_breakpoint "fourth HUP"
delete_breakpoints
+
+ # Verify an signal used by gdb is properly catched
+ gdb_breakpoint ${srcfile}:[gdb_get_line_number "first INT"]
+ gdb_continue_to_breakpoint "first INT"
+ set test "override SIGINT to catch"
+ gdb_test_multiple "handle SIGINT nostop print nopass" "$test" {
+ -re "SIGINT is used by the debugger.*Are you sure you want to change it.*y or n.*" {
+ gdb_test_multiple "y" "$test" {
+ -re "SIGINT.*No.*Yes.*No.*" {
+ pass "$test"
+ }
+ }
+ }
+ }
+ gdb_test "catch signal SIGINT" "Catchpoint .*"
+ gdb_test "continue" "Catchpoint .*"
+
}
}
next reply other threads:[~2013-05-01 18:42 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-01 18:42 Philippe Waroquiers [this message]
2013-05-02 18:45 ` Pedro Alves
2013-05-02 21:49 ` Philippe Waroquiers
2013-05-03 14:24 ` Pedro Alves
2013-05-03 17:39 ` Philippe Waroquiers
2013-05-03 18:13 ` Pedro Alves
2013-05-03 19:18 ` Philippe Waroquiers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1367433782.2626.142.camel@soleil \
--to=philippe.waroquiers@skynet.be \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox