This is the mail archive of the gdb-patches@sourceware.cygnus.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]

Re: [PATCH] Fix for target.c:do_target_signal_to_host()


   Date: Tue, 15 Feb 2000 19:32:16 +1100
   From: Andrew Cagney <ac131313@cygnus.com>

   If you add a comment noting that:

	   o	TARGET_SIGNAL_REALTIME_32 isn't
		   contigious with TARGET_SIGNAL_REALTIME_32

	   o	TARGET_SIGNAL_REALTIME_33 is 33 by defintion.

   then it can go straight in.

While adding the comments I noticed that the function will return 32
for TARGET_SIGNAL_REALTIME_32 even if it doesn't exist, and that (with
my patch) for the other RT signals the upper bound was checked, but
not the lower bound.  Not likely to be very problematic, but this is
not right according to the comment at the top of the function.

I also moved the TARGET_SIGNAL_REALTIME_32 case within the
default: where the other RT signals are handled.  I think this
makes it easier to understand the code.

OK to check this in?

Mark


2000-02-16  Mark Kettenis  <kettenis@gnu.org>

	* target.c (do_target_signal_to_host): Do not use REALTIME_LO in
	the conversion of the signal number.  TARGET_SIGNAL_REALTIME_33 is
	33 by definition, whereas REALTIME_LO might be 32 on systems that
	have SIG32 such as Linux.  Make sure that the signal number
	returned is within the range specified by REALTIME_LO and
	REALTIME_HI.


Index: gdb/target.c
===================================================================
RCS file: /cvs/src/src/gdb/target.c,v
retrieving revision 1.2
diff -u -r1.2 target.c
--- gdb/target.c	2000/02/09 08:52:47	1.2
+++ gdb/target.c	2000/02/16 15:12:31
@@ -2022,8 +2022,6 @@
       return SIGPRIO;
 #endif
 
-    case TARGET_SIGNAL_REALTIME_32: return 32; /* by definition */ 
-
       /* Mach exceptions.  Assumes that the values for EXC_ are positive! */
 #if defined (EXC_BAD_ACCESS) && defined (_NSIG)
     case TARGET_EXC_BAD_ACCESS:
@@ -2060,11 +2058,21 @@
       if (oursig >= TARGET_SIGNAL_REALTIME_33
 	  && oursig <= TARGET_SIGNAL_REALTIME_63)
 	{
+	  /* This block of signals is continuous, and
+             TARGET_SIGNAL_REALTIME_33 is 33 by definition.  */
 	  int retsig =
-	  (int) oursig - (int) TARGET_SIGNAL_REALTIME_33 + REALTIME_LO;
-	  if (retsig < REALTIME_HI)
+	    (int) oursig - (int) TARGET_SIGNAL_REALTIME_33 + 33;
+	  if (retsig >= REALTIME_LO && retsig < REALTIME_HI)
 	    return retsig;
 	}
+#if (REALTIME_LO < 33)
+      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;
+	}
+#endif
 #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]