From: Joel Brobecker <brobecker@adacore.com>
To: gdb-patches@sourceware.org
Subject: Re: [RFC] undefine SIGHUP if function kill not available...
Date: Thu, 08 Jan 2009 13:51:00 -0000 [thread overview]
Message-ID: <20090108135131.GF20220@adacore.com> (raw)
In-Reply-To: <20090107115832.GF1751@adacore.com>
[-- Attachment #1: Type: text/plain, Size: 1232 bytes --]
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 <brobecker@adacore.com>
* 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
[-- Attachment #2: raise.diff --]
[-- Type: text/plain, Size: 609 bytes --]
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);
next prev parent reply other threads:[~2009-01-08 13:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-07 11:58 Joel Brobecker
2009-01-08 13:51 ` Joel Brobecker [this message]
2009-01-08 15:30 ` Daniel Jacobowitz
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=20090108135131.GF20220@adacore.com \
--to=brobecker@adacore.com \
--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