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]

Re: [RFC] GDBserver compiler warnings patch


On Wed, Jun 01, 2005 at 12:39:21PM -0500, Manoj Iyer wrote:
> 
> 2005-06-01  Manoj Iyer  <manjo@austin.ibm.com>
> 
> 	* gdbreplay.c: Added #include <sys/types.h>.
> 	(remote_open): Change type of 'tmp' from int to socklen_t.
> 	* remote-utils.c: Added #include <sys/types.h>.
> 	(remote_open): Change type of 'tmp' from int to socklen_t.
> 	* server.c: Change type of 'sig' from unsigned char to char.

No, I'm going to commit something a little different instead.  You also
got half the gcc4 warnings in gdbserver, and not the other half - maybe
because PowerPC and i386 have different signedness on char?

I agree with Mark that we ought to check for socklen_t before using it. 
There were some systems where the type was actually size_t, but I don't
care anywhere near enough to work out a test for that.

Also sig really should be an unsigned char, not a signed char.  That
ripples down a bit.

Please let me know if you find any further warnings.

-- 
Daniel Jacobowitz
CodeSourcery, LLC

2005-06-12  Daniel Jacobowitz  <dan@codesourcery.com>

	* acconfig.h: Remove.
	* configure.ac: Add a test for socklen_t.  Use three-argument
	AC_DEFINE throughout.
	* config.in: Regenerated using autoheader 2.59.
	* configure: Regenerated.

	* gdbreplay.c (socklen_t): Provide a default.
	(remote_open): Use socklen_t.
	* remote-utils.c (socklen_t): Provide a default.
	(remote_open): Use socklen_t.
	(convert_int_to_ascii, convert_ascii_to_int, decode_M_packet): Use
	unsigned char.

	* i387-fp.c (struct i387_fsave, struct i387_fxsave): Use unsigned
	char for buffers.
	* linux-low.c (linux_read_memory, linux_write_memory)
	(linux_read_auxv): Likewise.
	* mem-break.c (breakpoint_data, set_breakpoint_data, check_mem_read)
	(check_mem_write): Likewise.
	* mem-break.h (set_breakpoint_data, check_mem_read, check_mem_write):
	Likewise.
	* regcache.c (struct inferior_rgcache_data, registers_to_string)
	(registers_from_string, register_data): Likewise.
	* server.c (handle_query, main): Likewise.
	* server.h (convert_ascii_to_int, convert_int_to_ascii)
	(decode_M_packet): Likewise.
	* target.c (read_inferior_memory, write_inferior_memory): Likewise.
	* target.h (struct target_ops): Update read_memory, write_memory,
	and read_auxv.
	(read_inferior_memory, write_inferior_memory): Update.
	* linux-low.h (struct linux_target_ops): Change type of breakpoint
	to unsigned char *.
	* linux-arm-low.c, linux-cris-low.c, linux-crisv32-low.c,
	linux-i386-low.c, linux-m32r-low.c, linux-m68k-low.c,
	linux-mips-low.c, linux-ppc-low.c, linux-ppc64-low.c,
	linux-s390-low.c, linux-sh-low.c: Update for changes in
	read_inferior_memory and the_low_target->breakpoint.

Index: acconfig.h
===================================================================
RCS file: acconfig.h
diff -N acconfig.h
--- acconfig.h	11 Jun 2002 17:32:39 -0000	1.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,24 +0,0 @@
-/* Define if the target supports PTRACE_PEEKUSR for register access.  */
-#undef HAVE_LINUX_USRREGS
-
-/* Define if the target supports PTRACE_GETREGS for register access.  */
-#undef HAVE_LINUX_REGSETS
-
-/* Define if the target supports PTRACE_GETFPXREGS for extended
-   register access.  */
-#undef HAVE_PTRACE_GETFPXREGS
-
-/* Define if <sys/procfs.h> has prgregset_t. */
-#undef HAVE_PRGREGSET_T
-
-/* Define if <sys/procfs.h> has prfpregset_t. */
-#undef HAVE_PRFPREGSET_T
-
-/* Define if <sys/procfs.h> has lwpid_t. */
-#undef HAVE_LWPID_T
-
-/* Define if <sys/procfs.h> has psaddr_t. */
-#undef HAVE_PSADDR_T
-
-/* Define if the prfpregset_t type is broken. */
-#undef PRFPREGSET_T_BROKEN
Index: config.in
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/config.in,v
retrieving revision 1.7
diff -u -p -r1.7 config.in
--- config.in	29 Jun 2003 04:01:39 -0000	1.7
+++ config.in	13 Jun 2005 01:57:10 -0000
@@ -1,69 +1,104 @@
-/* config.in.  Generated automatically from configure.in by autoheader.  */
+/* config.in.  Generated from configure.ac by autoheader.  */
 
-/* Define if you have the ANSI C header files.  */
-#undef STDC_HEADERS
+/* Define if <sys/procfs.h> has elf_fpregset_t. */
+#undef HAVE_ELF_FPREGSET_T
 
-/* Define if the target supports PTRACE_PEEKUSR for register access.  */
-#undef HAVE_LINUX_USRREGS
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the <linux/elf.h> header file. */
+#undef HAVE_LINUX_ELF_H
 
-/* Define if the target supports PTRACE_GETREGS for register access.  */
+/* Define if the target supports PTRACE_GETREGS for register access. */
 #undef HAVE_LINUX_REGSETS
 
-/* Define if the target supports PTRACE_GETFPXREGS for extended
-   register access.  */
-#undef HAVE_PTRACE_GETFPXREGS
+/* Define if the target supports PTRACE_PEEKUSR for register access. */
+#undef HAVE_LINUX_USRREGS
 
-/* Define if the prfpregset_t type is broken. */
-#undef PRFPREGSET_T_BROKEN
+/* Define if <sys/procfs.h> has lwpid_t. */
+#undef HAVE_LWPID_T
 
-/* Define if you have the <linux/elf.h> header file.  */
-#undef HAVE_LINUX_ELF_H
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define if <sys/procfs.h> has prfpregset_t. */
+#undef HAVE_PRFPREGSET_T
 
-/* Define if you have the <proc_service.h> header file.  */
+/* Define if <sys/procfs.h> has prgregset_t. */
+#undef HAVE_PRGREGSET_T
+
+/* Define to 1 if you have the <proc_service.h> header file. */
 #undef HAVE_PROC_SERVICE_H
 
-/* Define if you have the <sgtty.h> header file.  */
+/* Define if <sys/procfs.h> has psaddr_t. */
+#undef HAVE_PSADDR_T
+
+/* Define if the target supports PTRACE_GETFPXREGS for extended register
+   access. */
+#undef HAVE_PTRACE_GETFPXREGS
+
+/* Define to 1 if you have the <sgtty.h> header file. */
 #undef HAVE_SGTTY_H
 
-/* Define if you have the <stdlib.h> header file.  */
+/* Define if you have socklen_t. */
+#undef HAVE_SOCKLEN_T
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
 #undef HAVE_STDLIB_H
 
-/* Define if you have the <string.h> header file.  */
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
 #undef HAVE_STRING_H
 
-/* Define if you have the <sys/procfs.h> header file.  */
+/* Define to 1 if you have the <sys/procfs.h> header file. */
 #undef HAVE_SYS_PROCFS_H
 
-/* Define if you have the <sys/reg.h> header file.  */
+/* Define to 1 if you have the <sys/reg.h> header file. */
 #undef HAVE_SYS_REG_H
 
-/* Define if you have the <termio.h> header file.  */
-#undef HAVE_TERMIO_H
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
 
-/* Define if you have the <termios.h> header file.  */
+/* Define to 1 if you have the <termios.h> header file. */
 #undef HAVE_TERMIOS_H
 
-/* Define if you have the <thread_db.h> header file.  */
+/* Define to 1 if you have the <termio.h> header file. */
+#undef HAVE_TERMIO_H
+
+/* Define to 1 if you have the <thread_db.h> header file. */
 #undef HAVE_THREAD_DB_H
 
-/* Define if you have the <unistd.h> header file.  */
+/* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
 
 /* Define if strerror is not declared in system header files. */
 #undef NEED_DECLARATION_STRERROR
 
-/* Define if <sys/procfs.h> has lwpid_t. */
-#undef HAVE_LWPID_T
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
 
-/* Define if <sys/procfs.h> has psaddr_t. */
-#undef HAVE_PSADDR_T
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
 
-/* Define if <sys/procfs.h> has prgregset_t. */
-#undef HAVE_PRGREGSET_T
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
 
-/* Define if <sys/procfs.h> has prfpregset_t. */
-#undef HAVE_PRFPREGSET_T
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
 
-/* Define if <sys/procfs.h> has elf_fpregset_t. */
-#undef HAVE_ELF_FPREGSET_T
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
 
+/* Define if the prfpregset_t type is broken. */
+#undef PRFPREGSET_T_BROKEN
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
Index: configure
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/configure,v
retrieving revision 1.16
diff -u -p -r1.16 configure
--- configure	24 Feb 2005 20:26:32 -0000	1.16
+++ configure	13 Jun 2005 01:57:11 -0000
@@ -3148,10 +3148,76 @@ _ACEOF
 fi
 
 
+echo "$as_me:$LINENO: checking for socklen_t" >&5
+echo $ECHO_N "checking for socklen_t... $ECHO_C" >&6
+if test "${ac_cv_type_socklen_t+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/socket.h>
+
+int
+main ()
+{
+if ((socklen_t *) 0)
+  return 0;
+if (sizeof (socklen_t))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_type_socklen_t=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_socklen_t=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_socklen_t" >&5
+echo "${ECHO_T}$ac_cv_type_socklen_t" >&6
+if test $ac_cv_type_socklen_t = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_SOCKLEN_T 1
+_ACEOF
+
+fi
+
+
 . ${srcdir}/configure.srv
 
 if test "${srv_linux_usrregs}" = "yes"; then
-  cat >>confdefs.h <<\_ACEOF
+
+cat >>confdefs.h <<\_ACEOF
 #define HAVE_LINUX_USRREGS 1
 _ACEOF
 
@@ -3212,7 +3278,8 @@ fi
   echo "$as_me:$LINENO: result: $gdbsrv_cv_have_ptrace_getregs" >&5
 echo "${ECHO_T}$gdbsrv_cv_have_ptrace_getregs" >&6
   if test "${gdbsrv_cv_have_ptrace_getregs}" = "yes"; then
-    cat >>confdefs.h <<\_ACEOF
+
+cat >>confdefs.h <<\_ACEOF
 #define HAVE_LINUX_REGSETS 1
 _ACEOF
 
@@ -3272,7 +3339,8 @@ fi
   echo "$as_me:$LINENO: result: $gdbsrv_cv_have_ptrace_getfpxregs" >&5
 echo "${ECHO_T}$gdbsrv_cv_have_ptrace_getfpxregs" >&6
   if test "${gdbsrv_cv_have_ptrace_getfpxregs}" = "yes"; then
-    cat >>confdefs.h <<\_ACEOF
+
+cat >>confdefs.h <<\_ACEOF
 #define HAVE_PTRACE_GETFPXREGS 1
 _ACEOF
 
@@ -3589,7 +3657,8 @@ fi
     echo "$as_me:$LINENO: result: $gdb_cv_prfpregset_t_broken" >&5
 echo "${ECHO_T}$gdb_cv_prfpregset_t_broken" >&6
     if test $gdb_cv_prfpregset_t_broken = yes; then
-      cat >>confdefs.h <<\_ACEOF
+
+cat >>confdefs.h <<\_ACEOF
 #define PRFPREGSET_T_BROKEN 1
 _ACEOF
 
Index: configure.ac
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/configure.ac,v
retrieving revision 1.2
diff -u -p -r1.2 configure.ac
--- configure.ac	24 Feb 2005 20:26:32 -0000	1.2
+++ configure.ac	13 Jun 2005 01:57:11 -0000
@@ -40,10 +40,16 @@ AC_CHECK_HEADERS(sgtty.h termio.h termio
 
 BFD_NEED_DECLARATION(strerror)
 
+AC_CHECK_TYPE(socklen_t,
+	      [AC_DEFINE(HAVE_SOCKLEN_T, 1, [Define if you have socklen_t.])],
+	      [], [#include <sys/socket.h>])
+
 . ${srcdir}/configure.srv
 
 if test "${srv_linux_usrregs}" = "yes"; then
-  AC_DEFINE(HAVE_LINUX_USRREGS)
+  AC_DEFINE(HAVE_LINUX_USRREGS, 1,
+	    [Define if the target supports PTRACE_PEEKUSR for register ]
+	    [access.])
 fi
 
 if test "${srv_linux_regsets}" = "yes"; then
@@ -55,7 +61,9 @@ if test "${srv_linux_regsets}" = "yes"; 
 		  [gdbsrv_cv_have_ptrace_getregs=no])])
   AC_MSG_RESULT($gdbsrv_cv_have_ptrace_getregs)
   if test "${gdbsrv_cv_have_ptrace_getregs}" = "yes"; then
-    AC_DEFINE(HAVE_LINUX_REGSETS)
+    AC_DEFINE(HAVE_LINUX_REGSETS, 1,
+	      [Define if the target supports PTRACE_GETREGS for register ]
+	      [access.])
   fi
 
   AC_MSG_CHECKING(for PTRACE_GETFPXREGS)
@@ -66,7 +74,9 @@ if test "${srv_linux_regsets}" = "yes"; 
 		  [gdbsrv_cv_have_ptrace_getfpxregs=no])])
   AC_MSG_RESULT($gdbsrv_cv_have_ptrace_getfpxregs)
   if test "${gdbsrv_cv_have_ptrace_getfpxregs}" = "yes"; then
-    AC_DEFINE(HAVE_PTRACE_GETFPXREGS)
+    AC_DEFINE(HAVE_PTRACE_GETFPXREGS, 1,
+	      [Define if the target supports PTRACE_GETFPXREGS for extended ]
+	      [register access.])
   fi
 fi
 
@@ -98,7 +108,8 @@ if test "$ac_cv_header_sys_procfs_h" = y
        gdb_cv_prfpregset_t_broken=yes)])
     AC_MSG_RESULT($gdb_cv_prfpregset_t_broken)
     if test $gdb_cv_prfpregset_t_broken = yes; then
-      AC_DEFINE(PRFPREGSET_T_BROKEN)
+      AC_DEFINE(PRFPREGSET_T_BROKEN, 1,
+		[Define if the prfpregset_t type is broken.])
     fi
   fi
 
Index: gdbreplay.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/gdbreplay.c,v
retrieving revision 1.9
diff -u -p -r1.9 gdbreplay.c
--- gdbreplay.c	12 Mar 2004 20:51:21 -0000	1.9
+++ gdbreplay.c	13 Jun 2005 01:57:11 -0000
@@ -1,5 +1,6 @@
 /* Replay a remote debug session logfile for GDB.
-   Copyright 1996, 1998, 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
+   Copyright 1996, 1998, 1999, 2000, 2002, 2003, 2005
+   Free Software Foundation, Inc.
    Written by Fred Fish (fnf@cygnus.com) from pieces of gdbserver.
 
    This file is part of GDB.
@@ -41,6 +42,10 @@
 #include <unistd.h>
 #endif
 
+#ifndef HAVE_SOCKLEN_T
+typedef int socklen_t;
+#endif
+
 /* Sort of a hack... */
 #define EOL (EOF - 1)
 
@@ -105,7 +110,7 @@ remote_open (char *name)
       char *port_str;
       int port;
       struct sockaddr_in sockaddr;
-      int tmp;
+      socklen_t tmp;
       int tmp_desc;
 
       port_str = strchr (name, ':');
Index: i387-fp.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/i387-fp.c,v
retrieving revision 1.2
diff -u -p -r1.2 i387-fp.c
--- i387-fp.c	11 Jun 2002 17:32:39 -0000	1.2
+++ i387-fp.c	13 Jun 2005 01:57:11 -0000
@@ -1,5 +1,5 @@
 /* i387-specific utility functions, for the remote server for GDB.
-   Copyright 2000, 2001, 2002
+   Copyright 2000, 2001, 2002, 2005
    Free Software Foundation, Inc.
 
    This file is part of GDB.
@@ -43,7 +43,7 @@ struct i387_fsave {
   unsigned int foseg;
 
   /* Space for eight 80-bit FP values.  */
-  char st_space[80];
+  unsigned char st_space[80];
 };
 
 struct i387_fxsave {
@@ -63,10 +63,10 @@ struct i387_fxsave {
   unsigned int _pad1;
 
   /* Space for eight 80-bit FP values in 128-bit spaces.  */
-  char st_space[128];
+  unsigned char st_space[128];
 
   /* Space for eight 128-bit XMM values, or 16 on x86-64.  */
-  char xmm_space[256];
+  unsigned char xmm_space[256];
 };
 
 void
Index: linux-arm-low.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/linux-arm-low.c,v
retrieving revision 1.7
diff -u -p -r1.7 linux-arm-low.c
--- linux-arm-low.c	29 Feb 2004 16:43:49 -0000	1.7
+++ linux-arm-low.c	13 Jun 2005 01:57:11 -0000
@@ -1,5 +1,5 @@
 /* GNU/Linux/ARM specific low level interface, for the remote server for GDB.
-   Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+   Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
    Free Software Foundation, Inc.
 
    This file is part of GDB.
@@ -75,7 +75,7 @@ arm_breakpoint_at (CORE_ADDR where)
 {
   unsigned long insn;
 
-  (*the_target->read_memory) (where, (char *) &insn, 4);
+  (*the_target->read_memory) (where, (unsigned char *) &insn, 4);
   if (insn == arm_breakpoint)
     return 1;
 
@@ -102,7 +102,7 @@ struct linux_target_ops the_low_target =
   arm_cannot_store_register,
   arm_get_pc,
   arm_set_pc,
-  (const char *) &arm_breakpoint,
+  (const unsigned char *) &arm_breakpoint,
   arm_breakpoint_len,
   arm_reinsert_addr,
   0,
Index: linux-cris-low.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/linux-cris-low.c,v
retrieving revision 1.1
diff -u -p -r1.1 linux-cris-low.c
--- linux-cris-low.c	23 May 2005 11:20:07 -0000	1.1
+++ linux-cris-low.c	13 Jun 2005 01:57:11 -0000
@@ -85,7 +85,8 @@ cris_breakpoint_at (CORE_ADDR where)
 {
   unsigned short insn;
 
-  (*the_target->read_memory) (where, (char *) &insn, cris_breakpoint_len);
+  (*the_target->read_memory) (where, (unsigned char *) &insn,
+			      cris_breakpoint_len);
   if (insn == cris_breakpoint)
     return 1;
 
@@ -112,7 +113,7 @@ struct linux_target_ops the_low_target =
   cris_cannot_store_register,
   cris_get_pc,
   cris_set_pc,
-  (const char *) &cris_breakpoint,
+  (const unsigned char *) &cris_breakpoint,
   cris_breakpoint_len,
   cris_reinsert_addr,
   0,
Index: linux-crisv32-low.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/linux-crisv32-low.c,v
retrieving revision 1.1
diff -u -p -r1.1 linux-crisv32-low.c
--- linux-crisv32-low.c	23 May 2005 11:20:07 -0000	1.1
+++ linux-crisv32-low.c	13 Jun 2005 01:57:11 -0000
@@ -77,7 +77,8 @@ cris_breakpoint_at (CORE_ADDR where)
 {
   unsigned short insn;
 
-  (*the_target->read_memory) (where, (char *) &insn, cris_breakpoint_len);
+  (*the_target->read_memory) (where, (unsigned char *) &insn,
+			      cris_breakpoint_len);
   if (insn == cris_breakpoint)
     return 1;
 
@@ -367,7 +368,7 @@ struct linux_target_ops the_low_target =
   NULL,
   cris_get_pc,
   cris_set_pc,
-  (const char *) &cris_breakpoint,
+  (const unsigned char *) &cris_breakpoint,
   cris_breakpoint_len,
   cris_reinsert_addr,
   0,
Index: linux-i386-low.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/linux-i386-low.c,v
retrieving revision 1.6
diff -u -p -r1.6 linux-i386-low.c
--- linux-i386-low.c	16 Oct 2004 17:42:00 -0000	1.6
+++ linux-i386-low.c	13 Jun 2005 01:57:11 -0000
@@ -1,5 +1,5 @@
 /* GNU/Linux/i386 specific low level interface, for the remote server for GDB.
-   Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2004
+   Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2004, 2005
    Free Software Foundation, Inc.
 
    This file is part of GDB.
@@ -160,7 +160,7 @@ struct regset_info target_regsets[] = {
 
 #endif /* HAVE_LINUX_REGSETS */
 
-static const char i386_breakpoint[] = { 0xCC };
+static const unsigned char i386_breakpoint[] = { 0xCC };
 #define i386_breakpoint_len 1
 
 extern int debug_threads;
Index: linux-low.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/linux-low.c,v
retrieving revision 1.36
diff -u -p -r1.36 linux-low.c
--- linux-low.c	16 May 2005 10:24:37 -0000	1.36
+++ linux-low.c	13 Jun 2005 01:57:11 -0000
@@ -1337,7 +1337,7 @@ linux_store_registers (int regno)
    to debugger memory starting at MYADDR.  */
 
 static int
-linux_read_memory (CORE_ADDR memaddr, char *myaddr, int len)
+linux_read_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len)
 {
   register int i;
   /* Round starting address down to longword boundary.  */
@@ -1371,7 +1371,7 @@ linux_read_memory (CORE_ADDR memaddr, ch
    returns the value of errno.  */
 
 static int
-linux_write_memory (CORE_ADDR memaddr, const char *myaddr, int len)
+linux_write_memory (CORE_ADDR memaddr, const unsigned char *myaddr, int len)
 {
   register int i;
   /* Round starting address down to longword boundary.  */
@@ -1450,7 +1450,7 @@ linux_send_signal (int signum)
    to debugger memory starting at MYADDR.  */
 
 static int
-linux_read_auxv (CORE_ADDR offset, char *myaddr, unsigned int len)
+linux_read_auxv (CORE_ADDR offset, unsigned char *myaddr, unsigned int len)
 {
   char filename[PATH_MAX];
   int fd, n;
Index: linux-low.h
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/linux-low.h,v
retrieving revision 1.9
diff -u -p -r1.9 linux-low.h
--- linux-low.h	12 May 2005 12:14:23 -0000	1.9
+++ linux-low.h	13 Jun 2005 01:57:11 -0000
@@ -50,7 +50,7 @@ struct linux_target_ops
   int (*cannot_store_register) (int);
   CORE_ADDR (*get_pc) (void);
   void (*set_pc) (CORE_ADDR newpc);
-  const char *breakpoint;
+  const unsigned char *breakpoint;
   int breakpoint_len;
   CORE_ADDR (*breakpoint_reinsert_addr) (void);
 
Index: linux-m32r-low.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/linux-m32r-low.c,v
retrieving revision 1.1
diff -u -p -r1.1 linux-m32r-low.c
--- linux-m32r-low.c	15 Apr 2005 00:24:51 -0000	1.1
+++ linux-m32r-low.c	13 Jun 2005 01:57:11 -0000
@@ -74,7 +74,8 @@ m32r_breakpoint_at (CORE_ADDR where)
 {
   unsigned short insn;
 
-  (*the_target->read_memory) (where, (char *) &insn, m32r_breakpoint_len);
+  (*the_target->read_memory) (where, (unsigned char *) &insn,
+			      m32r_breakpoint_len);
   if (insn == m32r_breakpoint)
     return 1;
 
@@ -90,7 +91,7 @@ struct linux_target_ops the_low_target =
   m32r_cannot_store_register,
   m32r_get_pc,
   m32r_set_pc,
-  (const char *) &m32r_breakpoint,
+  (const unsigned char *) &m32r_breakpoint,
   m32r_breakpoint_len,
   NULL,
   0,
Index: linux-m68k-low.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/linux-m68k-low.c,v
retrieving revision 1.5
diff -u -p -r1.5 linux-m68k-low.c
--- linux-m68k-low.c	21 Nov 2004 03:09:39 -0000	1.5
+++ linux-m68k-low.c	13 Jun 2005 01:57:11 -0000
@@ -1,5 +1,5 @@
 /* GNU/Linux/m68k specific low level interface, for the remote server for GDB.
-   Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+   Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
    Free Software Foundation, Inc.
 
    This file is part of GDB.
@@ -120,7 +120,7 @@ struct regset_info target_regsets[] = {
 
 #endif /* HAVE_LINUX_REGSETS */
 
-static const char m68k_breakpoint[] = { 0x4E, 0x4F };
+static const unsigned char m68k_breakpoint[] = { 0x4E, 0x4F };
 #define m68k_breakpoint_len 2
 
 static CORE_ADDR
Index: linux-mips-low.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/linux-mips-low.c,v
retrieving revision 1.6
diff -u -p -r1.6 linux-mips-low.c
--- linux-mips-low.c	11 Jun 2002 17:32:39 -0000	1.6
+++ linux-mips-low.c	13 Jun 2005 01:57:11 -0000
@@ -1,5 +1,5 @@
 /* GNU/Linux/MIPS specific low level interface, for the remote server for GDB.
-   Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002
+   Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2005
    Free Software Foundation, Inc.
 
    This file is part of GDB.
@@ -131,7 +131,7 @@ mips_breakpoint_at (CORE_ADDR where)
 {
   unsigned long insn;
 
-  (*the_target->read_memory) (where, (char *) &insn, 4);
+  (*the_target->read_memory) (where, (unsigned char *) &insn, 4);
   if (insn == mips_breakpoint)
     return 1;
 
@@ -147,7 +147,7 @@ struct linux_target_ops the_low_target =
   mips_cannot_store_register,
   mips_get_pc,
   mips_set_pc,
-  (const char *) &mips_breakpoint,
+  (const unsigned char *) &mips_breakpoint,
   mips_breakpoint_len,
   mips_reinsert_addr,
   0,
Index: linux-ppc-low.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/linux-ppc-low.c,v
retrieving revision 1.5
diff -u -p -r1.5 linux-ppc-low.c
--- linux-ppc-low.c	11 Jun 2002 17:32:39 -0000	1.5
+++ linux-ppc-low.c	13 Jun 2005 01:57:11 -0000
@@ -1,6 +1,6 @@
 /* GNU/Linux/PowerPC specific low level interface, for the remote server for
    GDB.
-   Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002
+   Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2005
    Free Software Foundation, Inc.
 
    This file is part of GDB.
@@ -93,7 +93,7 @@ ppc_breakpoint_at (CORE_ADDR where)
 {
   unsigned long insn;
 
-  (*the_target->read_memory) (where, (char *) &insn, 4);
+  (*the_target->read_memory) (where, (unsigned char *) &insn, 4);
   if (insn == ppc_breakpoint)
     return 1;
   /* If necessary, recognize more trap instructions here.  GDB only uses the
@@ -108,7 +108,7 @@ struct linux_target_ops the_low_target =
   ppc_cannot_store_register,
   ppc_get_pc,
   ppc_set_pc,
-  (const char *) &ppc_breakpoint,
+  (const unsigned char *) &ppc_breakpoint,
   ppc_breakpoint_len,
   NULL,
   0,
Index: linux-ppc64-low.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/linux-ppc64-low.c,v
retrieving revision 1.2
diff -u -p -r1.2 linux-ppc64-low.c
--- linux-ppc64-low.c	28 May 2005 22:09:04 -0000	1.2
+++ linux-ppc64-low.c	13 Jun 2005 01:57:11 -0000
@@ -89,7 +89,7 @@ ppc_breakpoint_at (CORE_ADDR where)
 {
   unsigned int insn;
 
-  (*the_target->read_memory) (where, (char *) &insn, 4);
+  (*the_target->read_memory) (where, (unsigned char *) &insn, 4);
   if (insn == ppc_breakpoint)
     return 1;
   /* If necessary, recognize more trap instructions here.  GDB only uses the
@@ -104,7 +104,7 @@ struct linux_target_ops the_low_target =
   ppc_cannot_store_register,
   ppc_get_pc,
   ppc_set_pc,
-  (const char *) &ppc_breakpoint,
+  (const unsigned char *) &ppc_breakpoint,
   ppc_breakpoint_len,
   NULL,
   0,
Index: linux-s390-low.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/linux-s390-low.c,v
retrieving revision 1.5
diff -u -p -r1.5 linux-s390-low.c
--- linux-s390-low.c	10 May 2005 13:48:59 -0000	1.5
+++ linux-s390-low.c	13 Jun 2005 01:57:11 -0000
@@ -76,7 +76,7 @@ s390_cannot_store_register (int regno)
 }
 
 
-static const char s390_breakpoint[] = { 0, 1 };
+static const unsigned char s390_breakpoint[] = { 0, 1 };
 #define s390_breakpoint_len 2
 
 static CORE_ADDR
Index: linux-sh-low.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/linux-sh-low.c,v
retrieving revision 1.5
diff -u -p -r1.5 linux-sh-low.c
--- linux-sh-low.c	28 Jun 2003 18:41:56 -0000	1.5
+++ linux-sh-low.c	13 Jun 2005 01:57:11 -0000
@@ -1,5 +1,5 @@
 /* GNU/Linux/SH specific low level interface, for the remote server for GDB.
-   Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003
+   Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2005
    Free Software Foundation, Inc.
 
    This file is part of GDB.
@@ -81,7 +81,7 @@ sh_breakpoint_at (CORE_ADDR where)
 {
   unsigned short insn;
 
-  (*the_target->read_memory) (where, (char *) &insn, 2);
+  (*the_target->read_memory) (where, (unsigned char *) &insn, 2);
   if (insn == sh_breakpoint)
     return 1;
 
@@ -97,7 +97,7 @@ struct linux_target_ops the_low_target =
   sh_cannot_store_register,
   sh_get_pc,
   sh_set_pc,
-  (const char *) &sh_breakpoint,
+  (const unsigned char *) &sh_breakpoint,
   sh_breakpoint_len,
   NULL,
   0,
Index: mem-break.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/mem-break.c,v
retrieving revision 1.3
diff -u -p -r1.3 mem-break.c
--- mem-break.c	8 Jul 2003 18:51:44 -0000	1.3
+++ mem-break.c	13 Jun 2005 01:57:11 -0000
@@ -1,5 +1,5 @@
 /* Memory breakpoint operations for the remote server for GDB.
-   Copyright 2002
+   Copyright 2002, 2003, 2005
    Free Software Foundation, Inc.
 
    Contributed by MontaVista Software.
@@ -23,7 +23,7 @@
 
 #include "server.h"
 
-const char *breakpoint_data;
+const unsigned char *breakpoint_data;
 int breakpoint_len;
 
 #define MAX_BREAKPOINT_LEN 8
@@ -203,14 +203,14 @@ check_breakpoints (CORE_ADDR stop_pc)
 }
 
 void
-set_breakpoint_data (const char *bp_data, int bp_len)
+set_breakpoint_data (const unsigned char *bp_data, int bp_len)
 {
   breakpoint_data = bp_data;
   breakpoint_len = bp_len;
 }
 
 void
-check_mem_read (CORE_ADDR mem_addr, char *buf, int mem_len)
+check_mem_read (CORE_ADDR mem_addr, unsigned char *buf, int mem_len)
 {
   struct breakpoint *bp = breakpoints;
   CORE_ADDR mem_end = mem_addr + mem_len;
@@ -243,7 +243,7 @@ check_mem_read (CORE_ADDR mem_addr, char
 }
 
 void
-check_mem_write (CORE_ADDR mem_addr, char *buf, int mem_len)
+check_mem_write (CORE_ADDR mem_addr, unsigned char *buf, int mem_len)
 {
   struct breakpoint *bp = breakpoints;
   CORE_ADDR mem_end = mem_addr + mem_len;
Index: mem-break.h
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/mem-break.h,v
retrieving revision 1.1
diff -u -p -r1.1 mem-break.h
--- mem-break.h	20 Apr 2002 17:04:09 -0000	1.1
+++ mem-break.h	13 Jun 2005 01:57:11 -0000
@@ -1,5 +1,5 @@
 /* Memory breakpoint interfaces for the remote server for GDB.
-   Copyright 2002
+   Copyright 2002, 2005
    Free Software Foundation, Inc.
 
    Contributed by MontaVista Software.
@@ -55,17 +55,17 @@ int check_breakpoints (CORE_ADDR stop_pc
    to MEM_ADDR + MEM_LEN.  Update the data already read from the target
    (in BUF) if necessary.  */
 
-void check_mem_read (CORE_ADDR mem_addr, char *buf, int mem_len);
+void check_mem_read (CORE_ADDR mem_addr, unsigned char *buf, int mem_len);
 
 /* See if any breakpoints shadow the target memory area from MEM_ADDR
    to MEM_ADDR + MEM_LEN.  Update the data to be written to the target
    (in BUF) if necessary, as well as the original data for any breakpoints.  */
 
-void check_mem_write (CORE_ADDR mem_addr, char *buf, int mem_len);
+void check_mem_write (CORE_ADDR mem_addr, unsigned char *buf, int mem_len);
 
 /* Set the byte pattern to insert for memory breakpoints.  This function
    must be called before any breakpoints are set.  */
 
-void set_breakpoint_data (const char *bp_data, int bp_len);
+void set_breakpoint_data (const unsigned char *bp_data, int bp_len);
 
 #endif /* MEM_BREAK_H */
Index: regcache.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/regcache.c,v
retrieving revision 1.7
diff -u -p -r1.7 regcache.c
--- regcache.c	30 Jan 2004 15:08:57 -0000	1.7
+++ regcache.c	13 Jun 2005 01:57:11 -0000
@@ -1,5 +1,5 @@
 /* Register support routines for the remote server for GDB.
-   Copyright 2001, 2002, 2004
+   Copyright 2001, 2002, 2004, 2005
    Free Software Foundation, Inc.
 
    This file is part of GDB.
@@ -32,7 +32,7 @@
 struct inferior_regcache_data
 {
   int registers_valid;
-  char *registers;
+  unsigned char *registers;
 };
 
 static int register_bytes;
@@ -144,7 +144,7 @@ set_register_cache (struct reg *regs, in
 void
 registers_to_string (char *buf)
 {
-  char *registers = get_regcache (current_inferior, 1)->registers;
+  unsigned char *registers = get_regcache (current_inferior, 1)->registers;
 
   convert_int_to_ascii (registers, buf, register_bytes);
 }
@@ -153,7 +153,7 @@ void
 registers_from_string (char *buf)
 {
   int len = strlen (buf);
-  char *registers = get_regcache (current_inferior, 1)->registers;
+  unsigned char *registers = get_regcache (current_inferior, 1)->registers;
 
   if (len != register_bytes * 2)
     {
@@ -200,10 +200,11 @@ register_size (int n)
   return reg_defs[n].size / 8;
 }
 
-static char *
+static unsigned char *
 register_data (int n, int fetch)
 {
-  char *registers = get_regcache (current_inferior, fetch)->registers;
+  unsigned char *registers
+    = get_regcache (current_inferior, fetch)->registers;
 
   return registers + (reg_defs[n].offset / 8);
 }
Index: remote-utils.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/remote-utils.c,v
retrieving revision 1.24
diff -u -p -r1.24 remote-utils.c
--- remote-utils.c	12 May 2005 12:14:23 -0000	1.24
+++ remote-utils.c	13 Jun 2005 01:57:11 -0000
@@ -37,6 +37,10 @@
 #include <unistd.h>
 #include <arpa/inet.h>
 
+#ifndef HAVE_SOCKLEN_T
+typedef int socklen_t;
+#endif
+
 /* A cache entry for a successfully looked-up symbol.  */
 struct sym_cache
 {
@@ -122,7 +126,7 @@ remote_open (char *name)
       char *port_str;
       int port;
       struct sockaddr_in sockaddr;
-      int tmp;
+      socklen_t tmp;
       int tmp_desc;
 
       port_str = strchr (name, ':');
@@ -544,10 +548,10 @@ write_enn (char *buf)
 }
 
 void
-convert_int_to_ascii (char *from, char *to, int n)
+convert_int_to_ascii (unsigned char *from, char *to, int n)
 {
   int nib;
-  char ch;
+  int ch;
   while (n--)
     {
       ch = *from++;
@@ -561,7 +565,7 @@ convert_int_to_ascii (char *from, char *
 
 
 void
-convert_ascii_to_int (char *from, char *to, int n)
+convert_ascii_to_int (char *from, unsigned char *to, int n)
 {
   int nib1, nib2;
   while (n--)
@@ -722,7 +726,7 @@ decode_m_packet (char *from, CORE_ADDR *
 
 void
 decode_M_packet (char *from, CORE_ADDR *mem_addr_ptr, unsigned int *len_ptr,
-		 char *to)
+		 unsigned char *to)
 {
   int i = 0;
   char ch;
Index: server.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/server.c,v
retrieving revision 1.25
diff -u -p -r1.25 server.c
--- server.c	12 May 2005 12:14:23 -0000	1.25
+++ server.c	13 Jun 2005 01:57:11 -0000
@@ -126,7 +126,7 @@ handle_query (char *own_buf)
   if (the_target->read_auxv != NULL
       && strncmp ("qPart:auxv:read::", own_buf, 17) == 0)
     {
-      char data[(PBUFSIZ - 1) / 2];
+      unsigned char data[(PBUFSIZ - 1) / 2];
       CORE_ADDR ofs;
       unsigned int len;
       int n;
@@ -313,7 +313,8 @@ gdbserver_usage (void)
 int
 main (int argc, char *argv[])
 {
-  char ch, status, *own_buf, mem_buf[2000];
+  char ch, status, *own_buf;
+  unsigned char mem_buf[2000];
   int i = 0;
   int signal;
   unsigned int len;
Index: server.h
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/server.h,v
retrieving revision 1.16
diff -u -p -r1.16 server.h
--- server.h	3 Mar 2005 16:56:53 -0000	1.16
+++ server.h	13 Jun 2005 01:57:11 -0000
@@ -136,8 +136,8 @@ void enable_async_io (void);
 void disable_async_io (void);
 void unblock_async_io (void);
 void block_async_io (void);
-void convert_ascii_to_int (char *from, char *to, int n);
-void convert_int_to_ascii (char *from, char *to, int n);
+void convert_ascii_to_int (char *from, unsigned char *to, int n);
+void convert_int_to_ascii (unsigned char *from, char *to, int n);
 void new_thread_notify (int id);
 void dead_thread_notify (int id);
 void prepare_resume_reply (char *buf, char status, unsigned char sig);
@@ -145,7 +145,7 @@ void prepare_resume_reply (char *buf, ch
 void decode_m_packet (char *from, CORE_ADDR * mem_addr_ptr,
 		      unsigned int *len_ptr);
 void decode_M_packet (char *from, CORE_ADDR * mem_addr_ptr,
-		      unsigned int *len_ptr, char *to);
+		      unsigned int *len_ptr, unsigned char *to);
 
 int unhexify (char *bin, const char *hex, int count);
 int hexify (char *hex, const char *bin, int count);
Index: target.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/target.c,v
retrieving revision 1.4
diff -u -p -r1.4 target.c
--- target.c	5 Mar 2004 03:43:19 -0000	1.4
+++ target.c	13 Jun 2005 01:57:11 -0000
@@ -1,5 +1,5 @@
 /* Target operations for the remote server for GDB.
-   Copyright 2002, 2004
+   Copyright 2002, 2004, 2005
    Free Software Foundation, Inc.
 
    Contributed by MontaVista Software.
@@ -58,7 +58,7 @@ set_desired_inferior (int use_general)
 }
 
 int
-read_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
+read_inferior_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len)
 {
   int res;
   res = (*the_target->read_memory) (memaddr, myaddr, len);
@@ -67,12 +67,13 @@ read_inferior_memory (CORE_ADDR memaddr,
 }
 
 int
-write_inferior_memory (CORE_ADDR memaddr, const char *myaddr, int len)
+write_inferior_memory (CORE_ADDR memaddr, const unsigned char *myaddr,
+		       int len)
 {
   /* Lacking cleanups, there is some potential for a memory leak if the
      write fails and we go through error().  Make sure that no more than
      one buffer is ever pending by making BUFFER static.  */
-  static char *buffer = 0;
+  static unsigned char *buffer = 0;
   int res;
 
   if (buffer != NULL)
Index: target.h
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/target.h,v
retrieving revision 1.13
diff -u -p -r1.13 target.h
--- target.h	12 May 2005 12:14:23 -0000	1.13
+++ target.h	13 Jun 2005 01:57:11 -0000
@@ -106,7 +106,7 @@ struct target_ops
   
      Returns 0 on success and errno on failure.  */
 
-  int (*read_memory) (CORE_ADDR memaddr, char *myaddr, int len);
+  int (*read_memory) (CORE_ADDR memaddr, unsigned char *myaddr, int len);
 
   /* Write memory to the inferior process.  This should generally be
      called through write_inferior_memory, which handles breakpoint shadowing.
@@ -115,7 +115,8 @@ struct target_ops
 
      Returns 0 on success and errno on failure.  */
 
-  int (*write_memory) (CORE_ADDR memaddr, const char *myaddr, int len);
+  int (*write_memory) (CORE_ADDR memaddr, const unsigned char *myaddr,
+		       int len);
 
   /* Query GDB for the values of any symbols we're interested in.
      This function is called whenever we receive a "qSymbols::"
@@ -132,7 +133,8 @@ struct target_ops
 
      Read LEN bytes at OFFSET into a buffer at MYADDR.  */
 
-  int (*read_auxv) (CORE_ADDR offset, char *myaddr, unsigned int len);
+  int (*read_auxv) (CORE_ADDR offset, unsigned char *myaddr,
+		    unsigned int len);
 
   /* Insert and remove a hardware watchpoint.
      Returns 0 on success, -1 on failure and 1 on unsupported.  
@@ -183,9 +185,10 @@ void set_target_ops (struct target_ops *
 
 unsigned char mywait (char *statusp, int connected_wait);
 
-int read_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len);
+int read_inferior_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len);
 
-int write_inferior_memory (CORE_ADDR memaddr, const char *myaddr, int len);
+int write_inferior_memory (CORE_ADDR memaddr, const unsigned char *myaddr,
+			   int len);
 
 void set_desired_inferior (int id);
 


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