Remove conditionals for ANSI-standard signals
Commit Message
Hi all,
This patch removes all preprocessor conditionals for ANSI-standard
signals (SIGINT, SIGILL, SIGABRT, SIGFPE, SIGSEGV and SIGTERM) which
are guaranteed to always be defined.
Built and regtested on RHEL6.5 x86_64.
Ok to commit?
Cheers,
Gary
--
gdb/
2014-06-05 Gary Benson <gbenson@redhat.com>
* common/signals.c: Remove preprocessor conditionals for
always-defined signals SIGINT, SIGILL, SIGABRT, SIGFPE,
SIGSEGV and SIGTERM.
* proc-events.c: Likewise.
gdb/testsuite/
2014-06-05 Gary Benson <gbenson@redhat.com>
* gdb.base/call-signals.c: Remove preprocessor conditionals
for always-defined signals SIGINT, SIGILL, SIGABRT, SIGFPE,
SIGSEGV and SIGTERM.
* gdb.base/sigall.c: Likewise.
* gdb.base/unwindonsignal.c: Likewise.
* gdb.reverse/sigall-reverse.c: Likewise.
Comments
> Date: Thu, 5 Jun 2014 15:50:53 +0100
> From: Gary Benson <gbenson@redhat.com>
> Cc: Doug Evans <xdje42@gmail.com>, Eli Zaretskii <eliz@gnu.org>
>
> This patch removes all preprocessor conditionals for ANSI-standard
> signals (SIGINT, SIGILL, SIGABRT, SIGFPE, SIGSEGV and SIGTERM) which
> are guaranteed to always be defined.
>
> Built and regtested on RHEL6.5 x86_64.
>
> Ok to commit?
Looks good to me, but since Doug wanted to review this, please wait
at least for his response.
Thanks.
Eli Zaretskii wrote:
> > Date: Thu, 5 Jun 2014 15:50:53 +0100
> > From: Gary Benson <gbenson@redhat.com>
> > Cc: Doug Evans <xdje42@gmail.com>, Eli Zaretskii <eliz@gnu.org>
> >
> > This patch removes all preprocessor conditionals for ANSI-standard
> > signals (SIGINT, SIGILL, SIGABRT, SIGFPE, SIGSEGV and SIGTERM) which
> > are guaranteed to always be defined.
> >
> > Built and regtested on RHEL6.5 x86_64.
> >
> > Ok to commit?
>
> Looks good to me, but since Doug wanted to review this, please wait
> at least for his response.
For sure.
Thanks,
Gary
On Thu, Jun 5, 2014 at 7:50 AM, Gary Benson <gbenson@redhat.com> wrote:
> Hi all,
>
> This patch removes all preprocessor conditionals for ANSI-standard
> signals (SIGINT, SIGILL, SIGABRT, SIGFPE, SIGSEGV and SIGTERM) which
> are guaranteed to always be defined.
>
> Built and regtested on RHEL6.5 x86_64.
>
> Ok to commit?
>
> Cheers,
> Gary
>
> --
> gdb/
> 2014-06-05 Gary Benson <gbenson@redhat.com>
>
> * common/signals.c: Remove preprocessor conditionals for
> always-defined signals SIGINT, SIGILL, SIGABRT, SIGFPE,
> SIGSEGV and SIGTERM.
> * proc-events.c: Likewise.
Ok, with one request.
IWBN to have one more patch after this one, as its preferable to move
code around as a separate patch.
I can't see any sorting order to the places that have all the #ifdefs
(common/signals.c in particular), and I wonder if it would be useful
to put the non-#ifdef'd signals first with a comment explaining why
they don't have #ifdefs.
One could also sort them alphabetically of course too, of course,
within each group (non-#ifdef, #ifdef), but I don't have a strong
opinion on that.
> Date: Thu, 5 Jun 2014 09:10:14 -0700
> From: Doug Evans <xdje42@gmail.com>
> Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>, Eli Zaretskii <eliz@gnu.org>
>
> I can't see any sorting order to the places that have all the #ifdefs
> (common/signals.c in particular)
They are probably sorted in the order of their numerical values.
> and I wonder if it would be useful
> to put the non-#ifdef'd signals first with a comment explaining why
> they don't have #ifdefs.
Sounds like a good idea, indeed.
@@ -131,34 +131,26 @@ gdb_signal_from_host (int hostsig)
if (hostsig == SIGHUP)
return GDB_SIGNAL_HUP;
#endif
-#if defined (SIGINT)
if (hostsig == SIGINT)
return GDB_SIGNAL_INT;
-#endif
#if defined (SIGQUIT)
if (hostsig == SIGQUIT)
return GDB_SIGNAL_QUIT;
#endif
-#if defined (SIGILL)
if (hostsig == SIGILL)
return GDB_SIGNAL_ILL;
-#endif
#if defined (SIGTRAP)
if (hostsig == SIGTRAP)
return GDB_SIGNAL_TRAP;
#endif
-#if defined (SIGABRT)
if (hostsig == SIGABRT)
return GDB_SIGNAL_ABRT;
-#endif
#if defined (SIGEMT)
if (hostsig == SIGEMT)
return GDB_SIGNAL_EMT;
#endif
-#if defined (SIGFPE)
if (hostsig == SIGFPE)
return GDB_SIGNAL_FPE;
-#endif
#if defined (SIGKILL)
if (hostsig == SIGKILL)
return GDB_SIGNAL_KILL;
@@ -167,10 +159,8 @@ gdb_signal_from_host (int hostsig)
if (hostsig == SIGBUS)
return GDB_SIGNAL_BUS;
#endif
-#if defined (SIGSEGV)
if (hostsig == SIGSEGV)
return GDB_SIGNAL_SEGV;
-#endif
#if defined (SIGSYS)
if (hostsig == SIGSYS)
return GDB_SIGNAL_SYS;
@@ -183,10 +173,8 @@ gdb_signal_from_host (int hostsig)
if (hostsig == SIGALRM)
return GDB_SIGNAL_ALRM;
#endif
-#if defined (SIGTERM)
if (hostsig == SIGTERM)
return GDB_SIGNAL_TERM;
-#endif
#if defined (SIGUSR1)
if (hostsig == SIGUSR1)
return GDB_SIGNAL_USR1;
@@ -388,34 +376,26 @@ do_gdb_signal_to_host (enum gdb_signal oursig,
case GDB_SIGNAL_HUP:
return SIGHUP;
#endif
-#if defined (SIGINT)
case GDB_SIGNAL_INT:
return SIGINT;
-#endif
#if defined (SIGQUIT)
case GDB_SIGNAL_QUIT:
return SIGQUIT;
#endif
-#if defined (SIGILL)
case GDB_SIGNAL_ILL:
return SIGILL;
-#endif
#if defined (SIGTRAP)
case GDB_SIGNAL_TRAP:
return SIGTRAP;
#endif
-#if defined (SIGABRT)
case GDB_SIGNAL_ABRT:
return SIGABRT;
-#endif
#if defined (SIGEMT)
case GDB_SIGNAL_EMT:
return SIGEMT;
#endif
-#if defined (SIGFPE)
case GDB_SIGNAL_FPE:
return SIGFPE;
-#endif
#if defined (SIGKILL)
case GDB_SIGNAL_KILL:
return SIGKILL;
@@ -424,10 +404,8 @@ do_gdb_signal_to_host (enum gdb_signal oursig,
case GDB_SIGNAL_BUS:
return SIGBUS;
#endif
-#if defined (SIGSEGV)
case GDB_SIGNAL_SEGV:
return SIGSEGV;
-#endif
#if defined (SIGSYS)
case GDB_SIGNAL_SYS:
return SIGSYS;
@@ -440,10 +418,8 @@ do_gdb_signal_to_host (enum gdb_signal oursig,
case GDB_SIGNAL_ALRM:
return SIGALRM;
#endif
-#if defined (SIGTERM)
case GDB_SIGNAL_TERM:
return SIGTERM;
-#endif
#if defined (SIGUSR1)
case GDB_SIGNAL_USR1:
return SIGUSR1;
@@ -1404,39 +1404,29 @@ static struct trans signal_table[] =
#ifdef SIGHUP
{ SIGHUP, "SIGHUP", "Hangup" },
#endif
-#ifdef SIGINT
{ SIGINT, "SIGINT", "Interrupt (rubout)" },
-#endif
#ifdef SIGQUIT
{ SIGQUIT, "SIGQUIT", "Quit (ASCII FS)" },
#endif
-#ifdef SIGILL
{ SIGILL, "SIGILL", "Illegal instruction" }, /* not reset when caught */
-#endif
#ifdef SIGTRAP
{ SIGTRAP, "SIGTRAP", "Trace trap" }, /* not reset when caught */
#endif
-#ifdef SIGABRT
{ SIGABRT, "SIGABRT", "used by abort()" }, /* replaces SIGIOT */
-#endif
#ifdef SIGIOT
{ SIGIOT, "SIGIOT", "IOT instruction" },
#endif
#ifdef SIGEMT
{ SIGEMT, "SIGEMT", "EMT instruction" },
#endif
-#ifdef SIGFPE
{ SIGFPE, "SIGFPE", "Floating point exception" },
-#endif
#ifdef SIGKILL
{ SIGKILL, "SIGKILL", "Kill" }, /* Solaris: cannot be caught/ignored */
#endif
#ifdef SIGBUS
{ SIGBUS, "SIGBUS", "Bus error" },
#endif
-#ifdef SIGSEGV
{ SIGSEGV, "SIGSEGV", "Segmentation violation" },
-#endif
#ifdef SIGSYS
{ SIGSYS, "SIGSYS", "Bad argument to system call" },
#endif
@@ -1446,9 +1436,7 @@ static struct trans signal_table[] =
#ifdef SIGALRM
{ SIGALRM, "SIGALRM", "Alarm clock" },
#endif
-#ifdef SIGTERM
{ SIGTERM, "SIGTERM", "Software termination signal from kill" },
-#endif
#ifdef SIGUSR1
{ SIGUSR1, "SIGUSR1", "User defined signal 1" },
#endif
@@ -31,9 +31,7 @@ void
gen_signal ()
{
/* According to sigall.exp, SIGABRT is always supported. */
-#ifdef SIGABRT
kill (getpid (), SIGABRT);
-#endif
/* If we get here we couldn't generate a signal, tell dejagnu. */
printf ("no signal\n");
}
@@ -819,11 +819,7 @@ return 0;
int
gen_ILL ()
{
-#ifdef SIGILL
kill (getpid (), SIGILL);
-#else
- handle_ILL (0);
-#endif
return 0;
}
@@ -874,11 +870,7 @@ return 0;
int
gen_SEGV ()
{
-#ifdef SIGSEGV
kill (getpid (), SIGSEGV);
-#else
- handle_SEGV (0);
-#endif
return 0;
}
@@ -1050,7 +1042,7 @@ return 0;
int
gen_LOST ()
{
-#if defined(SIGLOST) && (!defined(SIGABRT) || SIGLOST != SIGABRT)
+#if defined(SIGLOST) && SIGLOST != SIGABRT
kill (getpid (), SIGLOST);
#else
handle_LOST (0);
@@ -1593,21 +1585,15 @@ main ()
#ifdef SIGQUIT
signal (SIGQUIT, handle_QUIT);
#endif
-#ifdef SIGILL
signal (SIGILL, handle_ILL);
-#endif
#ifdef SIGEMT
signal (SIGEMT, handle_EMT);
#endif
-#ifdef SIGFPE
signal (SIGFPE, handle_FPE);
-#endif
#ifdef SIGBUS
signal (SIGBUS, handle_BUS);
#endif
-#ifdef SIGSEGV
signal (SIGSEGV, handle_SEGV);
-#endif
#ifdef SIGSYS
signal (SIGSYS, handle_SYS);
#endif
@@ -1653,7 +1639,7 @@ main ()
#ifdef SIGWINCH
signal (SIGWINCH, handle_WINCH);
#endif
-#if defined(SIGLOST) && (!defined(SIGABRT) || SIGLOST != SIGABRT)
+#if defined(SIGLOST) && SIGLOST != SIGABRT
signal (SIGLOST, handle_LOST);
#endif
#ifdef SIGUSR1
@@ -25,9 +25,7 @@ void
gen_signal ()
{
/* According to sigall.exp, SIGABRT is always supported. */
-#ifdef SIGABRT
kill (getpid (), SIGABRT);
-#endif
/* If we get here we couldn't generate a signal, tell dejagnu. */
printf ("no signal\n");
}
@@ -410,11 +410,7 @@ return 0;
int
gen_ILL (void)
{
-#ifdef SIGILL
kill (getpid (), SIGILL);
-#else
- handle_ILL (0);
-#endif
return 0;
}
@@ -465,11 +461,7 @@ return 0;
int
gen_SEGV (void)
{
-#ifdef SIGSEGV
kill (getpid (), SIGSEGV);
-#else
- handle_SEGV (0);
-#endif
return 0;
}
@@ -641,7 +633,7 @@ return 0;
int
gen_LOST (void)
{
-#if defined(SIGLOST) && (!defined(SIGABRT) || SIGLOST != SIGABRT)
+#if defined(SIGLOST) && SIGLOST != SIGABRT
kill (getpid (), SIGLOST);
#else
handle_LOST (0);
@@ -1183,21 +1175,15 @@ main ()
#ifdef SIGQUIT
signal (SIGQUIT, handle_QUIT);
#endif
-#ifdef SIGILL
signal (SIGILL, handle_ILL);
-#endif
#ifdef SIGEMT
signal (SIGEMT, handle_EMT);
#endif
-#ifdef SIGFPE
signal (SIGFPE, handle_FPE);
-#endif
#ifdef SIGBUS
signal (SIGBUS, handle_BUS);
#endif
-#ifdef SIGSEGV
signal (SIGSEGV, handle_SEGV);
-#endif
#ifdef SIGSYS
signal (SIGSYS, handle_SYS);
#endif
@@ -1243,7 +1229,7 @@ main ()
#ifdef SIGWINCH
signal (SIGWINCH, handle_WINCH);
#endif
-#if defined(SIGLOST) && (!defined(SIGABRT) || SIGLOST != SIGABRT)
+#if defined(SIGLOST) && SIGLOST != SIGABRT
signal (SIGLOST, handle_LOST);
#endif
#ifdef SIGUSR1