This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH: Fix bitrot in signals/signals.c


There's two sets of code for realtime signals in signals/signals.c: one for
if REALTIME_LO is defined and one for SIGRTMIN.  REALTIME_LO always (? or
generally) is defined in GDB, however, so the SIGRTMIN case has rotted. 
This only affects gdbserver.  Better would be to unify them, but I've left
that for another day and just brought them back in sync.

Committed as obvious.

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer

2002-06-09  Daniel Jacobowitz  <drow@mvista.com>

	* signals/signals.c (target_signal_from_host): Fix #ifdef
	SIGRTMIN case.
	(do_target_signal_to_host): Likewise.

Index: gdb/signals/signals.c
===================================================================
RCS file: /cvs/src/src/gdb/signals/signals.c,v
retrieving revision 1.3
diff -u -p -r1.3 signals.c
--- gdb/signals/signals.c	9 May 2002 22:20:29 -0000	1.3
+++ gdb/signals/signals.c	9 Jun 2002 19:17:45 -0000
@@ -498,8 +498,11 @@ target_signal_from_host (int hostsig)
       if (33 <= hostsig && hostsig <= 63)
 	return (enum target_signal)
 	  (hostsig - 33 + (int) TARGET_SIGNAL_REALTIME_33);
-      else if (hostsig == 64)
-	return TARGET_SIGNAL_REALTIME_64;
+      else if (hostsig == 32)
+	return TARGET_SIGNAL_REALTIME_32;
+      else if (64 <= hostsig && hostsig <= 127)
+	return (enum target_signal)
+	  (hostsig - 64 + (int) TARGET_SIGNAL_REALTIME_64);
       else
 	error ("GDB bug: target.c (target_signal_from_host): unrecognized real-time signal");
     }
@@ -784,8 +787,21 @@ do_target_signal_to_host (enum target_si
 	  if (retsig >= SIGRTMIN && retsig <= SIGRTMAX)
 	    return retsig;
 	}
-      else if (oursig == TARGET_SIGNAL_REALTIME_64)
-	return 64;
+      else if (oursig == TARGET_SIGNAL_REALTIME_32)
+	{
+	  /* TARGET_SIGNAL_REALTIME_32 isn't contiguous with
+             TARGET_SIGNAL_REALTIME_33.  It is 32 by definition.  */
+	  return 32;
+	}
+      else if (oursig >= TARGET_SIGNAL_REALTIME_64
+	  && oursig <= TARGET_SIGNAL_REALTIME_127)
+	{
+	  /* This block of signals is continuous, and
+             TARGET_SIGNAL_REALTIME_64 is 64 by definition.  */
+	  int retsig =
+	    (int) oursig - (int) TARGET_SIGNAL_REALTIME_64 + 64;
+	  return retsig;
+	}
 #endif
       *oursig_ok = 0;
       return 0;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]