From 0050a760a7646cdfb63a4c693fca974459776909 Mon Sep 17 00:00:00 2001 From: Daniel Jacobowitz Date: Wed, 15 Mar 2006 16:13:29 +0000 Subject: [PATCH] * configure.ac: Remove checks for prfpregset_t. * gdb_proc_service.h: New file. * linux-i386-low.c, linux-x86-64-low.c, thread-db.c: Use the new "gdb_proc_service.h". * proc-service.c: Likewise. (ps_pglobal_lookup, ps_pdread, ps_pdwrite): Use psaddr_t. (ps_lgetfpregs, ps_lsetfpregs): Use a void* argument. * Makefile.in (gdb_proc_service_h): Updated. * configure, config.in: Regenerated. --- gdb/gdbserver/ChangeLog | 12 +++ gdb/gdbserver/Makefile.in | 2 +- gdb/gdbserver/config.in | 6 -- gdb/gdbserver/configure | 125 ------------------------------- gdb/gdbserver/configure.ac | 32 +------- gdb/gdbserver/gdb_proc_service.h | 75 +++++++++++++++++++ gdb/gdbserver/linux-i386-low.c | 16 +--- gdb/gdbserver/linux-x86-64-low.c | 16 +--- gdb/gdbserver/proc-service.c | 34 +++------ gdb/gdbserver/thread-db.c | 16 +--- 10 files changed, 106 insertions(+), 228 deletions(-) create mode 100644 gdb/gdbserver/gdb_proc_service.h diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 119736e7626..f7e94947f8e 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,15 @@ +2006-03-15 Daniel Jacobowitz + + * configure.ac: Remove checks for prfpregset_t. + * gdb_proc_service.h: New file. + * linux-i386-low.c, linux-x86-64-low.c, thread-db.c: Use the + new "gdb_proc_service.h". + * proc-service.c: Likewise. + (ps_pglobal_lookup, ps_pdread, ps_pdwrite): Use psaddr_t. + (ps_lgetfpregs, ps_lsetfpregs): Use a void* argument. + * Makefile.in (gdb_proc_service_h): Updated. + * configure, config.in: Regenerated. + 2006-03-03 Daniel Jacobowitz * remote-utils.c (prepare_resume_reply): Move declaration diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in index 19ee78b221f..47d90660d68 100644 --- a/gdb/gdbserver/Makefile.in +++ b/gdb/gdbserver/Makefile.in @@ -242,7 +242,7 @@ version.o: version.c $(server_h) # will remove them. MAKEOVERRIDES= -gdb_proc_service_h = $(srcdir)/../gdb_proc_service.h $(srcdir)/../gregset.h +gdb_proc_service_h = $(srcdir)/gdb_proc_service.h regdat_sh = $(srcdir)/../regformats/regdat.sh regdef_h = $(srcdir)/../regformats/regdef.h regcache_h = $(srcdir)/regcache.h diff --git a/gdb/gdbserver/config.in b/gdb/gdbserver/config.in index 59e56bc8e8e..3aa2811ecef 100644 --- a/gdb/gdbserver/config.in +++ b/gdb/gdbserver/config.in @@ -25,9 +25,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H -/* Define if has prfpregset_t. */ -#undef HAVE_PRFPREGSET_T - /* Define if has prgregset_t. */ #undef HAVE_PRGREGSET_T @@ -104,8 +101,5 @@ /* 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 1373538d1dd..262d5ef99ac 100755 --- a/gdb/gdbserver/configure +++ b/gdb/gdbserver/configure @@ -3544,131 +3544,6 @@ _ACEOF echo "$as_me:$LINENO: result: $bfd_cv_have_sys_procfs_type_prgregset_t" >&5 echo "${ECHO_T}$bfd_cv_have_sys_procfs_type_prgregset_t" >&6 - echo "$as_me:$LINENO: checking for prfpregset_t in sys/procfs.h" >&5 -echo $ECHO_N "checking for prfpregset_t in sys/procfs.h... $ECHO_C" >&6 - if test "${bfd_cv_have_sys_procfs_type_prfpregset_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. */ - -#define _SYSCALL32 -#include -int -main () -{ -prfpregset_t avar - ; - 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 - bfd_cv_have_sys_procfs_type_prfpregset_t=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -bfd_cv_have_sys_procfs_type_prfpregset_t=no - -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi - - if test $bfd_cv_have_sys_procfs_type_prfpregset_t = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_PRFPREGSET_T 1 -_ACEOF - - fi - echo "$as_me:$LINENO: result: $bfd_cv_have_sys_procfs_type_prfpregset_t" >&5 -echo "${ECHO_T}$bfd_cv_have_sys_procfs_type_prfpregset_t" >&6 - - - - - if test $bfd_cv_have_sys_procfs_type_prfpregset_t = yes; then - echo "$as_me:$LINENO: checking whether prfpregset_t type is broken" >&5 -echo $ECHO_N "checking whether prfpregset_t type is broken... $ECHO_C" >&6 - if test "${gdb_cv_prfpregset_t_broken+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then - gdb_cv_prfpregset_t_broken=yes -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - int main () - { - if (sizeof (prfpregset_t) == sizeof (void *)) - return 1; - return 0; - } -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (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 - gdb_cv_prfpregset_t_broken=no -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -gdb_cv_prfpregset_t_broken=yes -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -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 -#define PRFPREGSET_T_BROKEN 1 -_ACEOF - - fi - fi - echo "$as_me:$LINENO: checking for elf_fpregset_t in sys/procfs.h" >&5 echo $ECHO_N "checking for elf_fpregset_t in sys/procfs.h... $ECHO_C" >&6 if test "${bfd_cv_have_sys_procfs_type_elf_fpregset_t+set}" = set; then diff --git a/gdb/gdbserver/configure.ac b/gdb/gdbserver/configure.ac index fabd94db517..a952af5d83c 100644 --- a/gdb/gdbserver/configure.ac +++ b/gdb/gdbserver/configure.ac @@ -1,5 +1,6 @@ dnl Autoconf configure script for GDB server. -dnl Copyright (C) 2000, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. +dnl Copyright (C) 2000, 2002, 2003, 2004, 2005, 2006 +dnl Free Software Foundation, Inc. dnl dnl This file is part of GDB. dnl @@ -88,35 +89,6 @@ if test "$ac_cv_header_sys_procfs_h" = yes; then BFD_HAVE_SYS_PROCFS_TYPE(lwpid_t) BFD_HAVE_SYS_PROCFS_TYPE(psaddr_t) BFD_HAVE_SYS_PROCFS_TYPE(prgregset_t) - BFD_HAVE_SYS_PROCFS_TYPE(prfpregset_t) - - dnl Check for broken prfpregset_t type - - dnl For Linux/i386, glibc 2.1.3 was released with a bogus - dnl prfpregset_t type (it's a typedef for the pointer to a struct - dnl instead of the struct itself). We detect this here, and work - dnl around it in gdb_proc_service.h. - - if test $bfd_cv_have_sys_procfs_type_prfpregset_t = yes; then - AC_MSG_CHECKING(whether prfpregset_t type is broken) - AC_CACHE_VAL(gdb_cv_prfpregset_t_broken, - [AC_TRY_RUN([#include - int main () - { - if (sizeof (prfpregset_t) == sizeof (void *)) - return 1; - return 0; - }], - gdb_cv_prfpregset_t_broken=no, - gdb_cv_prfpregset_t_broken=yes, - 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, 1, - [Define if the prfpregset_t type is broken.]) - fi - fi - BFD_HAVE_SYS_PROCFS_TYPE(elf_fpregset_t) fi diff --git a/gdb/gdbserver/gdb_proc_service.h b/gdb/gdbserver/gdb_proc_service.h new file mode 100644 index 00000000000..e5aefbdd418 --- /dev/null +++ b/gdb/gdbserver/gdb_proc_service.h @@ -0,0 +1,75 @@ +/* replacement for systems that don't have it. + Copyright (C) 2000, 2006 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ + +#ifndef GDB_PROC_SERVICE_H +#define GDB_PROC_SERVICE_H + +#include + +#ifdef HAVE_PROC_SERVICE_H +#include +#else + +#ifdef HAVE_SYS_PROCFS_H +#include +#endif + +/* Not all platforms bring in via . If + wasn't enough to find elf_fpregset_t, try the kernel + headers also (but don't if we don't need to). */ +#ifndef HAVE_ELF_FPREGSET_T +# ifdef HAVE_LINUX_ELF_H +# include +# endif +#endif + +typedef enum +{ + PS_OK, /* Success. */ + PS_ERR, /* Generic error. */ + PS_BADPID, /* Bad process handle. */ + PS_BADLID, /* Bad LWP id. */ + PS_BADADDR, /* Bad address. */ + PS_NOSYM, /* Symbol not found. */ + PS_NOFREGS /* FPU register set not available. */ +} ps_err_e; + +#ifndef HAVE_LWPID_T +typedef unsigned int lwpid_t; +#endif + +#ifndef HAVE_PSADDR_T +typedef unsigned long psaddr_t; +#endif + +#ifndef HAVE_PRGREGSET_T +typedef elf_gregset_t prgregset_t; +#endif + +#endif /* HAVE_PROC_SERVICE_H */ + +/* Structure that identifies the target process. */ +struct ps_prochandle +{ + /* The process id is all we need. */ + pid_t pid; +}; + +#endif /* gdb_proc_service.h */ diff --git a/gdb/gdbserver/linux-i386-low.c b/gdb/gdbserver/linux-i386-low.c index 96359fb92e1..c0daf0b76ca 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 (C) 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2004, 2005 + Copyright (C) 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2004, 2005, 2006 Free Software Foundation, Inc. This file is part of GDB. @@ -23,19 +23,7 @@ #include "linux-low.h" #include "i387-fp.h" -/* Correct for all GNU/Linux targets (for quite some time). */ -#define GDB_GREGSET_T elf_gregset_t -#define GDB_FPREGSET_T elf_fpregset_t - -#ifndef HAVE_ELF_FPREGSET_T -/* Make sure we have said types. Not all platforms bring in - via . */ -#ifdef HAVE_LINUX_ELF_H -#include -#endif -#endif - -#include "../gdb_proc_service.h" +#include "gdb_proc_service.h" #include diff --git a/gdb/gdbserver/linux-x86-64-low.c b/gdb/gdbserver/linux-x86-64-low.c index 7a4a76aa443..43cd10b0b39 100644 --- a/gdb/gdbserver/linux-x86-64-low.c +++ b/gdb/gdbserver/linux-x86-64-low.c @@ -1,6 +1,6 @@ /* GNU/Linux/x86-64 specific low level interface, for the remote server for GDB. - Copyright (C) 2002, 2004, 2005 + Copyright (C) 2002, 2004, 2005, 2006 Free Software Foundation, Inc. This file is part of GDB. @@ -24,19 +24,7 @@ #include "linux-low.h" #include "i387-fp.h" -/* Correct for all GNU/Linux targets (for quite some time). */ -#define GDB_GREGSET_T elf_gregset_t -#define GDB_FPREGSET_T elf_fpregset_t - -#ifndef HAVE_ELF_FPREGSET_T -/* Make sure we have said types. Not all platforms bring in - via . */ -#ifdef HAVE_LINUX_ELF_H -#include -#endif -#endif - -#include "../gdb_proc_service.h" +#include "gdb_proc_service.h" #include #include diff --git a/gdb/gdbserver/proc-service.c b/gdb/gdbserver/proc-service.c index a64919e54ee..99083f17333 100644 --- a/gdb/gdbserver/proc-service.c +++ b/gdb/gdbserver/proc-service.c @@ -1,5 +1,5 @@ /* libthread_db helper functions for the remote server for GDB. - Copyright (C) 2002, 2004, 2005 + Copyright (C) 2002, 2004, 2005, 2006 Free Software Foundation, Inc. Contributed by MontaVista Software. @@ -29,19 +29,7 @@ #include "linux-low.h" -/* Correct for all GNU/Linux targets (for quite some time). */ -#define GDB_GREGSET_T elf_gregset_t -#define GDB_FPREGSET_T elf_fpregset_t - -#ifndef HAVE_ELF_FPREGSET_T -/* Make sure we have said types. Not all platforms bring in - via . */ -#ifdef HAVE_LINUX_ELF_H -#include -#endif -#endif - -#include "../gdb_proc_service.h" +#include "gdb_proc_service.h" typedef struct ps_prochandle *gdb_ps_prochandle_t; typedef void *gdb_ps_read_buf_t; @@ -75,14 +63,14 @@ gregset_info(void) ps_err_e ps_pglobal_lookup (gdb_ps_prochandle_t ph, const char *obj, - const char *name, paddr_t *sym_addr) + const char *name, psaddr_t *sym_addr) { CORE_ADDR addr; if (look_up_one_symbol (name, &addr) == 0) return PS_NOSYM; - *sym_addr = (paddr_t) (unsigned long) addr; + *sym_addr = (psaddr_t) (unsigned long) addr; return PS_OK; } @@ -90,20 +78,20 @@ ps_pglobal_lookup (gdb_ps_prochandle_t ph, const char *obj, them into BUF. */ ps_err_e -ps_pdread (gdb_ps_prochandle_t ph, paddr_t addr, +ps_pdread (gdb_ps_prochandle_t ph, psaddr_t addr, gdb_ps_read_buf_t buf, gdb_ps_size_t size) { - read_inferior_memory (addr, buf, size); + read_inferior_memory ((unsigned long) addr, buf, size); return PS_OK; } /* Write SIZE bytes from BUF into the target process PH at address ADDR. */ ps_err_e -ps_pdwrite (gdb_ps_prochandle_t ph, paddr_t addr, +ps_pdwrite (gdb_ps_prochandle_t ph, psaddr_t addr, gdb_ps_write_buf_t buf, gdb_ps_size_t size) { - return write_inferior_memory (addr, buf, size); + return write_inferior_memory ((unsigned long) addr, buf, size); } /* Get the general registers of LWP LWPID within the target process PH @@ -149,8 +137,7 @@ ps_lsetregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, const prgregset_t gregset) process PH and store them in FPREGSET. */ ps_err_e -ps_lgetfpregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, - gdb_prfpregset_t *fpregset) +ps_lgetfpregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, void *fpregset) { /* Unneeded. */ return PS_ERR; @@ -160,8 +147,7 @@ ps_lgetfpregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, process PH from FPREGSET. */ ps_err_e -ps_lsetfpregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, - const gdb_prfpregset_t *fpregset) +ps_lsetfpregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, void *fpregset) { /* Unneeded. */ return PS_ERR; diff --git a/gdb/gdbserver/thread-db.c b/gdb/gdbserver/thread-db.c index 561e3809231..b47f576d2e9 100644 --- a/gdb/gdbserver/thread-db.c +++ b/gdb/gdbserver/thread-db.c @@ -1,5 +1,5 @@ /* Thread management interface, for the remote server for GDB. - Copyright (C) 2002, 2004, 2005 + Copyright (C) 2002, 2004, 2005, 2006 Free Software Foundation, Inc. Contributed by MontaVista Software. @@ -31,19 +31,7 @@ extern int debug_threads; #include #endif -/* Correct for all GNU/Linux targets (for quite some time). */ -#define GDB_GREGSET_T elf_gregset_t -#define GDB_FPREGSET_T elf_fpregset_t - -#ifndef HAVE_ELF_FPREGSET_T -/* Make sure we have said types. Not all platforms bring in - via . */ -#ifdef HAVE_LINUX_ELF_H -#include -#endif -#endif - -#include "../gdb_proc_service.h" +#include "gdb_proc_service.h" /* Structure that identifies the child process for the interface. */ -- 2.30.2