From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10489 invoked by alias); 8 Jan 2009 13:51:53 -0000 Received: (qmail 10467 invoked by uid 22791); 8 Jan 2009 13:51:44 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 08 Jan 2009 13:51:41 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 89DC52A9681 for ; Thu, 8 Jan 2009 08:51:39 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id Xn4xAycbm+AQ for ; Thu, 8 Jan 2009 08:51:39 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id C18362A9686 for ; Thu, 8 Jan 2009 08:51:38 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id EAC76E7ACD; Thu, 8 Jan 2009 17:51:31 +0400 (RET) Date: Thu, 08 Jan 2009 13:51:00 -0000 From: Joel Brobecker To: gdb-patches@sourceware.org Subject: Re: [RFC] undefine SIGHUP if function kill not available... Message-ID: <20090108135131.GF20220@adacore.com> References: <20090107115832.GF1751@adacore.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="UugvWAfsgieZRqgk" Content-Disposition: inline In-Reply-To: <20090107115832.GF1751@adacore.com> User-Agent: Mutt/1.4.2.2i 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 X-SW-Source: 2009-01/txt/msg00160.txt.bz2 --UugvWAfsgieZRqgk Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 1232 On Wed, Jan 07, 2009 at 03:58:32PM +0400, Joel Brobecker wrote: > I have just seen Mark's comments (thank you!) about this patch, so I just > downgraded this request to a request for comments. > > Here is the problem: > > In event-top.c, some code that is conditional on SIGHUP being defined > also uses kill(). On x86_64-windows, the MinGW signal.h now defines > SIGHUP, but kill is still not available. So the approach I took for > now was to pretend that SIGHUP is not defined if kill is not available. > This is clearly a hack, hence the comment I added. Here is a new patch that replaces calls to "kill (getpid (), ...)" by calls to "raise". 2009-01-08 Joel Brobecker * event-top.c (async_disconnect, async_stop_sig): use "raise" instead of "kill" to raise a signal. Tested on x86-linux, although I doubt that the testcase actually exercises this part of the code. I tried to trigger the signal handler that calls the "raise", but somehow it doesn't happen. I wonder if this happens only when the inferior is still running... In any case, it looks relatively straightforward, but I'd rather have the confirmation from someone who's experienced with signals. Thanks, -- Joel --UugvWAfsgieZRqgk Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="raise.diff" Content-length: 609 diff --git a/gdb/event-top.c b/gdb/event-top.c index 5483608..fd7c521 100644 --- a/gdb/event-top.c +++ b/gdb/event-top.c @@ -977,7 +977,7 @@ async_disconnect (gdb_client_data arg) "Could not kill the program being debugged", RETURN_MASK_ALL); signal (SIGHUP, SIG_DFL); /*FIXME: ??????????? */ - kill (getpid (), SIGHUP); + raise (SIGHUP); } #endif @@ -1005,7 +1005,7 @@ async_stop_sig (gdb_client_data arg) #elif HAVE_SIGSETMASK sigsetmask (0); #endif - kill (getpid (), SIGTSTP); + raise (SIGTSTP); signal (SIGTSTP, handle_stop_sig); #else signal (STOP_SIGNAL, handle_stop_sig); --UugvWAfsgieZRqgk--