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]

[commit] Clean up a type nastiness in gdbserver


Sometimes signal values are treated as int in gdbserver, and sometimes as
unsigned char.  I tried to use a negative value for a special signal code,
and the sign extension did absolutely not what I wanted it to do...

This patch converts signals to always be stored as integers.  Tested on
i686-pc-linux-gnu and committed.

-- 
Daniel Jacobowitz
CodeSourcery, LLC

2005-05-04  Daniel Jacobowitz  <dan@codesourcery.com>

	* server.c (start_inferior): Change return type to int.
	(attach_inferior): Change sigptr to int *.
	(handle_v_cont, handle_v_requests): Change signal to int *.
	(main): Change signal to int.

Index: gdb/gdbserver/server.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/server.c,v
retrieving revision 1.23
diff -u -p -r1.23 server.c
--- gdb/gdbserver/server.c	3 Mar 2005 16:56:53 -0000	1.23
+++ gdb/gdbserver/server.c	4 May 2005 17:51:47 -0000
@@ -43,7 +43,7 @@ jmp_buf toplevel;
 
 unsigned long signal_pid;
 
-static unsigned char
+static int
 start_inferior (char *argv[], char *statusptr)
 {
   signal (SIGTTOU, SIG_DFL);
@@ -63,7 +63,7 @@ start_inferior (char *argv[], char *stat
 }
 
 static int
-attach_inferior (int pid, char *statusptr, unsigned char *sigptr)
+attach_inferior (int pid, char *statusptr, int *sigptr)
 {
   /* myattach should return -1 if attaching is unsupported,
      0 if it succeeded, and call error() otherwise.  */
@@ -150,7 +150,7 @@ handle_query (char *own_buf)
 
 /* Parse vCont packets.  */
 void
-handle_v_cont (char *own_buf, char *status, unsigned char *signal)
+handle_v_cont (char *own_buf, char *status, int *signal)
 {
   char *p, *q;
   int n = 0, i = 0;
@@ -255,7 +255,7 @@ err:
 
 /* Handle all of the extended 'v' packets.  */
 void
-handle_v_requests (char *own_buf, char *status, unsigned char *signal)
+handle_v_requests (char *own_buf, char *status, int *signal)
 {
   if (strncmp (own_buf, "vCont;", 6) == 0)
     {
@@ -315,7 +315,7 @@ main (int argc, char *argv[])
 {
   char ch, status, *own_buf, mem_buf[2000];
   int i = 0;
-  unsigned char signal;
+  int signal;
   unsigned int len;
   CORE_ADDR mem_addr;
   int bad_attach;


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