diff options
Diffstat (limited to 'gdb/gdbserver')
28 files changed, 284 insertions, 135 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 7f7e4d4..0c85343 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,43 @@ +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. + 2005-05-28 Daniel Jacobowitz <dan@codesourcery.com> * Makefile.in (SFILES): Add linux-ppc64-low.c. diff --git a/gdb/gdbserver/acconfig.h b/gdb/gdbserver/acconfig.h deleted file mode 100644 index f0464b0..0000000 --- a/gdb/gdbserver/acconfig.h +++ /dev/null @@ -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 diff --git a/gdb/gdbserver/config.in b/gdb/gdbserver/config.in index e9d21c8..0014fdf 100644 --- a/gdb/gdbserver/config.in +++ b/gdb/gdbserver/config.in @@ -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 diff --git a/gdb/gdbserver/configure b/gdb/gdbserver/configure index 4bd9a72..425ddd2 100755 --- a/gdb/gdbserver/configure +++ b/gdb/gdbserver/configure @@ -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 diff --git a/gdb/gdbserver/configure.ac b/gdb/gdbserver/configure.ac index 894304e..0eaea38 100644 --- a/gdb/gdbserver/configure.ac +++ b/gdb/gdbserver/configure.ac @@ -40,10 +40,16 @@ AC_CHECK_HEADERS(sgtty.h termio.h termios.h sys/reg.h string.h dnl 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"; then [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"; then [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" = yes; then 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 diff --git a/gdb/gdbserver/gdbreplay.c b/gdb/gdbserver/gdbreplay.c index 7c9064b..aaaa723 100644 --- a/gdb/gdbserver/gdbreplay.c +++ b/gdb/gdbserver/gdbreplay.c @@ -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, ':'); diff --git a/gdb/gdbserver/i387-fp.c b/gdb/gdbserver/i387-fp.c index 19a9929..8ddd21d 100644 --- a/gdb/gdbserver/i387-fp.c +++ b/gdb/gdbserver/i387-fp.c @@ -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 diff --git a/gdb/gdbserver/linux-arm-low.c b/gdb/gdbserver/linux-arm-low.c index f091a3d..7c23b17 100644 --- a/gdb/gdbserver/linux-arm-low.c +++ b/gdb/gdbserver/linux-arm-low.c @@ -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, diff --git a/gdb/gdbserver/linux-cris-low.c b/gdb/gdbserver/linux-cris-low.c index 7777685..79912ef 100644 --- a/gdb/gdbserver/linux-cris-low.c +++ b/gdb/gdbserver/linux-cris-low.c @@ -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, diff --git a/gdb/gdbserver/linux-crisv32-low.c b/gdb/gdbserver/linux-crisv32-low.c index 21940b3..fb4b5e5 100644 --- a/gdb/gdbserver/linux-crisv32-low.c +++ b/gdb/gdbserver/linux-crisv32-low.c @@ -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, diff --git a/gdb/gdbserver/linux-i386-low.c b/gdb/gdbserver/linux-i386-low.c index d8cc4ec..b2b92b0 100644 --- a/gdb/gdbserver/linux-i386-low.c +++ b/gdb/gdbserver/linux-i386-low.c @@ -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; diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c index 3795cb6..9e94add 100644 --- a/gdb/gdbserver/linux-low.c +++ b/gdb/gdbserver/linux-low.c @@ -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, char *myaddr, int len) 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; diff --git a/gdb/gdbserver/linux-low.h b/gdb/gdbserver/linux-low.h index 9c35513..22ed57d 100644 --- a/gdb/gdbserver/linux-low.h +++ b/gdb/gdbserver/linux-low.h @@ -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); diff --git a/gdb/gdbserver/linux-m32r-low.c b/gdb/gdbserver/linux-m32r-low.c index 2db03fe..a867207 100644 --- a/gdb/gdbserver/linux-m32r-low.c +++ b/gdb/gdbserver/linux-m32r-low.c @@ -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, diff --git a/gdb/gdbserver/linux-m68k-low.c b/gdb/gdbserver/linux-m68k-low.c index c81df93..52398bd 100644 --- a/gdb/gdbserver/linux-m68k-low.c +++ b/gdb/gdbserver/linux-m68k-low.c @@ -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 diff --git a/gdb/gdbserver/linux-mips-low.c b/gdb/gdbserver/linux-mips-low.c index 51e74ce..4df913e 100644 --- a/gdb/gdbserver/linux-mips-low.c +++ b/gdb/gdbserver/linux-mips-low.c @@ -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, diff --git a/gdb/gdbserver/linux-ppc-low.c b/gdb/gdbserver/linux-ppc-low.c index 2bb0f50..cd573f1 100644 --- a/gdb/gdbserver/linux-ppc-low.c +++ b/gdb/gdbserver/linux-ppc-low.c @@ -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, diff --git a/gdb/gdbserver/linux-ppc64-low.c b/gdb/gdbserver/linux-ppc64-low.c index 9b63aa1..6a8c17d 100644 --- a/gdb/gdbserver/linux-ppc64-low.c +++ b/gdb/gdbserver/linux-ppc64-low.c @@ -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, diff --git a/gdb/gdbserver/linux-s390-low.c b/gdb/gdbserver/linux-s390-low.c index 724e092..d290556 100644 --- a/gdb/gdbserver/linux-s390-low.c +++ b/gdb/gdbserver/linux-s390-low.c @@ -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 diff --git a/gdb/gdbserver/linux-sh-low.c b/gdb/gdbserver/linux-sh-low.c index cbe2f95..7baaf42 100644 --- a/gdb/gdbserver/linux-sh-low.c +++ b/gdb/gdbserver/linux-sh-low.c @@ -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, diff --git a/gdb/gdbserver/mem-break.c b/gdb/gdbserver/mem-break.c index 977b0e3..8c69439 100644 --- a/gdb/gdbserver/mem-break.c +++ b/gdb/gdbserver/mem-break.c @@ -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 *buf, int mem_len) } 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; diff --git a/gdb/gdbserver/mem-break.h b/gdb/gdbserver/mem-break.h index 356e763..adcedad 100644 --- a/gdb/gdbserver/mem-break.h +++ b/gdb/gdbserver/mem-break.h @@ -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 */ diff --git a/gdb/gdbserver/regcache.c b/gdb/gdbserver/regcache.c index bc64ebc..f1d0fe5 100644 --- a/gdb/gdbserver/regcache.c +++ b/gdb/gdbserver/regcache.c @@ -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, int n) 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); } diff --git a/gdb/gdbserver/remote-utils.c b/gdb/gdbserver/remote-utils.c index 8082090..79792a5 100644 --- a/gdb/gdbserver/remote-utils.c +++ b/gdb/gdbserver/remote-utils.c @@ -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 *to, int n) 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 *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 char *to) { int i = 0; char ch; diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c index 137ae9e..55f7c21 100644 --- a/gdb/gdbserver/server.c +++ b/gdb/gdbserver/server.c @@ -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; diff --git a/gdb/gdbserver/server.h b/gdb/gdbserver/server.h index 2ec90b1..49161fb 100644 --- a/gdb/gdbserver/server.h +++ b/gdb/gdbserver/server.h @@ -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, char status, unsigned char sig); 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); diff --git a/gdb/gdbserver/target.c b/gdb/gdbserver/target.c index 2c60e17..0de69e8 100644 --- a/gdb/gdbserver/target.c +++ b/gdb/gdbserver/target.c @@ -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, char *myaddr, int len) } 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) diff --git a/gdb/gdbserver/target.h b/gdb/gdbserver/target.h index 38708fd..e3a183a 100644 --- a/gdb/gdbserver/target.h +++ b/gdb/gdbserver/target.h @@ -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); |