From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14960 invoked by alias); 3 May 2013 22:43:46 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 14920 invoked by uid 89); 3 May 2013 22:43:41 -0000 X-Spam-SWARE-Status: No, score=-3.2 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 Received: from mailrelay001.isp.belgacom.be (HELO mailrelay001.isp.belgacom.be) (195.238.6.51) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Fri, 03 May 2013 22:43:40 +0000 X-Belgacom-Dynamic: yes X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjgDAFw8hFFtgZKL/2dsb2JhbAANQ4M+gzy7dQMBgRCDEwEBAQMBIwRXCwsaAiYCAlcih32vfHKQe4EkjS4sOhaCKoETA6E7ggWILQ Received: from 139.146-129-109.adsl-dyn.isp.belgacom.be (HELO [192.168.1.7]) ([109.129.146.139]) by relay.skynet.be with ESMTP; 04 May 2013 00:43:37 +0200 Subject: Re: RFC: gdb_assert with 'catch signal ...' and fork From: Philippe Waroquiers To: gdb-patches@sourceware.org In-Reply-To: <1367620645.2243.49.camel@soleil> References: <1367620645.2243.49.camel@soleil> Content-Type: text/plain; charset="UTF-8" Date: Fri, 03 May 2013 22:43:00 -0000 Message-ID: <1367621018.14613.2.camel@soleil> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-SW-Source: 2013-05/txt/msg00066.txt.bz2 On Sat, 2013-05-04 at 00:37 +0200, Philippe Waroquiers wrote: > The patch below modifies catch-signal.c, catch-signal.exp > and modifies breakpoint.c so as to avoid the assert. Forgot to give -up option, here is the same with -up Index: gdb/breakpoint.c =================================================================== RCS file: /cvs/src/src/gdb/breakpoint.c,v retrieving revision 1.759 diff -u -p -r1.759 breakpoint.c --- gdb/breakpoint.c 24 Apr 2013 23:09:31 -0000 1.759 +++ gdb/breakpoint.c 3 May 2013 22:39:48 -0000 @@ -3550,6 +3550,9 @@ detach_breakpoints (ptid_t ptid) if (bl->pspace != inf->pspace) continue; + if (bl->owner->type == bp_catchpoint) + continue; + if (bl->inserted) val |= remove_breakpoint_1 (bl, mark_inserted); } Index: gdb/testsuite/gdb.base/catch-signal.c =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.base/catch-signal.c,v retrieving revision 1.3 diff -u -p -r1.3 catch-signal.c --- gdb/testsuite/gdb.base/catch-signal.c 3 May 2013 19:16:56 -0000 1.3 +++ gdb/testsuite/gdb.base/catch-signal.c 3 May 2013 22:39:48 -0000 @@ -15,6 +15,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +#include #include #include @@ -44,5 +45,17 @@ main () raise (SIGHUP); /* fourth HUP */ raise (SIGINT); /* first INT */ + + signal (SIGCHLD, handle); + switch (fork()) /* fork marker */ + { + case -1: + perror ("fork"); + exit (1); + case 0: + exit (0); + } + (void) wait(NULL); + raise (SIGHUP); /* fifth HUP */ } Index: gdb/testsuite/gdb.base/catch-signal.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.base/catch-signal.exp,v retrieving revision 1.4 diff -u -p -r1.4 catch-signal.exp --- gdb/testsuite/gdb.base/catch-signal.exp 3 May 2013 19:16:56 -0000 1.4 +++ gdb/testsuite/gdb.base/catch-signal.exp 3 May 2013 22:39:48 -0000 @@ -83,7 +83,16 @@ proc test_catch_signal {signame} { y gdb_test "catch signal SIGINT" "Catchpoint .*" gdb_test "continue" "Catchpoint .* SIGINT.*" + + delete_breakpoints + # Test interaction with fork. This used to cause a gdb_assert. + gdb_breakpoint ${srcfile}:[gdb_get_line_number "fork marker"] + gdb_continue_to_breakpoint "fork marker" + gdb_test "handle SIGHUP nostop noprint pass" \ + "SIGHUP.*No.*No.*Yes.*" + gdb_test "catch signal SIGHUP" "Catchpoint .*" + gdb_test "continue" "Catchpoint .* SIGHUP.*" "got SIGHUP after fork" } }