From bd2fa4f6c95dc2ced5e7fa5a102465eb7be18478 Mon Sep 17 00:00:00 2001 From: "J.T. Conklin" Date: Fri, 8 Dec 2000 19:46:08 +0000 Subject: [PATCH] * gdbserver/low-hppabsd.c (buf2, environ, quit, quit_flag): Removed unused variables and declarations. * gdbserver/low-linux.c (buf2, environ, query, quit, quit_flag): Likewise. * gdbserver/low-nbsd.c (buf2, environ, quit, quit_flag): Likewise. * gdbserver/low-sparc.c (buf2, environ, query, quit, quit_flag): Likewise. * gdbserver/low-sun.c (buf2, environ, query, quit, quit_flag): Likewise. * gdbserver/low-hppabsd.c, gdbserver/low-linux.c, gdbserver/low-nbsd.c, gdbserver/low-sparc.c, gdbserver/low-sun3.c (create_inferior): Update comment. * gdbserver/low-nbsd.c (initialize_arch, fetch_inferior_registers, store_inferior_registers): Provide implementations for the m68k and ns32k. * config/m68k/nbsd.mt (GDBSERVER_DEPFILES): Add low-nbsd.o * config/ns32k/nbsd.mt (GDBSERVER_DEPFILES): Likewise. * configure.tgt (m68*-*-netbsd*, ns32k-*-netbsd*): Add gdbserver to configdirs. ------------------------------------------------------------------- --- gdb/ChangeLog | 25 ++++++ gdb/config/m68k/nbsd.mt | 2 + gdb/config/ns32k/nbsd.mt | 2 + gdb/configure.tgt | 6 +- gdb/gdbserver/low-hppabsd.c | 14 +--- gdb/gdbserver/low-linux.c | 14 +--- gdb/gdbserver/low-nbsd.c | 156 +++++++++++++++++++++++++++++++++--- gdb/gdbserver/low-sparc.c | 14 +--- gdb/gdbserver/low-sun3.c | 14 +--- 9 files changed, 186 insertions(+), 61 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 5384666d8b6..fbbc3e61151 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,28 @@ +2000-12-07 J.T. Conklin + + * gdbserver/low-hppabsd.c (buf2, environ, quit, quit_flag): + Removed unused variables and declarations. + * gdbserver/low-linux.c (buf2, environ, query, quit, quit_flag): + Likewise. + * gdbserver/low-nbsd.c (buf2, environ, quit, quit_flag): + Likewise. + * gdbserver/low-sparc.c (buf2, environ, query, quit, quit_flag): + Likewise. + * gdbserver/low-sun.c (buf2, environ, query, quit, quit_flag): + Likewise. + + * gdbserver/low-hppabsd.c, gdbserver/low-linux.c, + gdbserver/low-nbsd.c, gdbserver/low-sparc.c, gdbserver/low-sun3.c + (create_inferior): Update comment. + + * gdbserver/low-nbsd.c (initialize_arch, fetch_inferior_registers, + store_inferior_registers): Provide implementations for the m68k + and ns32k. + * config/m68k/nbsd.mt (GDBSERVER_DEPFILES): Add low-nbsd.o + * config/ns32k/nbsd.mt (GDBSERVER_DEPFILES): Likewise. + * configure.tgt (m68*-*-netbsd*, ns32k-*-netbsd*): Add gdbserver + to configdirs. + 2000-12-07 Elena Zannoni * config/sh/tm-sh.h (struct gdbarch_tdep): Rename fields diff --git a/gdb/config/m68k/nbsd.mt b/gdb/config/m68k/nbsd.mt index 52270e16b38..ce5e4ee3f44 100644 --- a/gdb/config/m68k/nbsd.mt +++ b/gdb/config/m68k/nbsd.mt @@ -1,3 +1,5 @@ # Target: Motorola m68k running NetBSD TDEPFILES= m68k-tdep.o solib.o solib-svr4.o TM_FILE= tm-nbsd.h + +GDBSERVER_DEPFILES= low-nbsd.o diff --git a/gdb/config/ns32k/nbsd.mt b/gdb/config/ns32k/nbsd.mt index 3a2836b9261..1656978b237 100644 --- a/gdb/config/ns32k/nbsd.mt +++ b/gdb/config/ns32k/nbsd.mt @@ -1,3 +1,5 @@ # Target: PC532 running NetBSD TDEPFILES= ns32k-tdep.o solib.o solib-svr4.o TM_FILE= tm-nbsd.h + +GDBSERVER_DEPFILES= low-nbsd.o diff --git a/gdb/configure.tgt b/gdb/configure.tgt index df84e5530f4..f092d2484d3 100644 --- a/gdb/configure.tgt +++ b/gdb/configure.tgt @@ -167,7 +167,8 @@ m68*-*-linux*) gdb_target=linux configdirs="${configdirs} gdbserver" ;; m68*-*-lynxos*) gdb_target=m68klynx configdirs="${configdirs} gdbserver" ;; -m68*-*-netbsd*) gdb_target=nbsd ;; +m68*-*-netbsd*) gdb_target=nbsd + configdirs="${configdirs} gdbserver" ;; m68*-*-os68k*) gdb_target=os68k ;; m68*-*-sunos3*) gdb_target=sun3os3 ;; m68*-*-sunos4*) gdb_target=sun3os4 ;; @@ -222,7 +223,8 @@ mn10300-*-*) gdb_target=mn10300 ;; none-*-*) gdb_target=none ;; ns32k-*-mach3*) gdb_target=ns32km3 ;; -ns32k-*-netbsd*) gdb_target=nbsd ;; +ns32k-*-netbsd*) gdb_target=nbsd + configdirs="${configdirs} gdbserver" ;; ns32k-utek-sysv*) gdb_target=merlin ;; ns32k-utek-*) gdb_target=umax ;; diff --git a/gdb/gdbserver/low-hppabsd.c b/gdb/gdbserver/low-hppabsd.c index e85c0b2dcc2..d031e307f10 100644 --- a/gdb/gdbserver/low-hppabsd.c +++ b/gdb/gdbserver/low-hppabsd.c @@ -33,29 +33,19 @@ #include /***************Begin MY defs*********************/ -int quit_flag = 0; static char my_registers[REGISTER_BYTES]; char *registers = my_registers; - -/* Index within `registers' of the first byte of the space for - register N. */ - - -char buf2[MAX_REGISTER_RAW_SIZE]; /***************End MY defs*********************/ #include #include -extern char **environ; extern int errno; extern int inferior_pid; -void quit (), perror_with_name (); -int query (); +void perror_with_name (); /* Start an inferior process and returns its pid. - ALLARGS is a vector of program-name and args. - ENV is the environment vector to pass. */ + ALLARGS is a vector of program-name and args. */ int create_inferior (char *program, char **allargs) diff --git a/gdb/gdbserver/low-linux.c b/gdb/gdbserver/low-linux.c index 7df5157e427..c718c4ea9ab 100644 --- a/gdb/gdbserver/low-linux.c +++ b/gdb/gdbserver/low-linux.c @@ -33,15 +33,8 @@ #include /***************Begin MY defs*********************/ -int quit_flag = 0; static char my_registers[REGISTER_BYTES]; char *registers = my_registers; - -/* Index within `registers' of the first byte of the space for - register N. */ - - -char buf2[MAX_REGISTER_RAW_SIZE]; /***************End MY defs*********************/ #ifdef HAVE_SYS_REG_H @@ -53,17 +46,14 @@ char buf2[MAX_REGISTER_RAW_SIZE]; #define PTRACE_XFER_TYPE int #endif -extern char **environ; extern int errno; extern int inferior_pid; -void quit (), perror_with_name (); -int query (); +void perror_with_name (); static void initialize_arch (void); /* Start an inferior process and returns its pid. - ALLARGS is a vector of program-name and args. - ENV is the environment vector to pass. */ + ALLARGS is a vector of program-name and args. */ int create_inferior (char *program, char **allargs) diff --git a/gdb/gdbserver/low-nbsd.c b/gdb/gdbserver/low-nbsd.c index b5199dca775..fc54845f48d 100644 --- a/gdb/gdbserver/low-nbsd.c +++ b/gdb/gdbserver/low-nbsd.c @@ -27,24 +27,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include /***************Begin MY defs*********************/ -int quit_flag = 0; static char my_registers[REGISTER_BYTES]; char *registers = my_registers; - -/* Index within `registers' of the first byte of the space for - register N. */ - -char buf2[MAX_REGISTER_RAW_SIZE]; /***************End MY defs*********************/ #include #include -extern int sys_nerr; +// extern int sys_nerr; // extern char **sys_errlist; -extern char **environ; extern int inferior_pid; -void quit (), perror_with_name (); +void perror_with_name (); #define RF(dst, src) \ memcpy(®isters[REGISTER_BYTE(dst)], &src, sizeof(src)) @@ -106,6 +99,20 @@ initialize_arch (void) } #endif /* !__i386__ */ +#ifdef __m68k__ +static void +initialize_arch (void) +{ +} +#endif /* !__m68k__ */ + +#ifdef __ns32k__ +static void +initialize_arch (void) +{ +} +#endif /* !__ns32k__ */ + #ifdef __powerpc__ #include "ppc-tdep.h" @@ -117,8 +124,7 @@ initialize_arch (void) /* Start an inferior process and returns its pid. - ALLARGS is a vector of program-name and args. - ENV is the environment vector to pass. */ + ALLARGS is a vector of program-name and args. */ int create_inferior (char *program, char **allargs) @@ -313,6 +319,134 @@ store_inferior_registers (int ignored) } #endif /* !__i386__ */ +#ifdef __m68k__ +/* Fetch one or more registers from the inferior. REGNO == -1 to get + them all. We actually fetch more than requested, when convenient, + marking them as valid so we won't fetch them again. */ + +void +fetch_inferior_registers (int regno) +{ + struct reg inferior_registers; + struct fpreg inferior_fp_registers; + + ptrace (PT_GETREGS, inferior_pid, + (PTRACE_ARG3_TYPE) & inferior_registers, 0); + memcpy (®isters[REGISTER_BYTE (0)], &inferior_registers, + sizeof (inferior_registers)); + + ptrace (PT_GETFPREGS, inferior_pid, + (PTRACE_ARG3_TYPE) & inferior_fp_registers, 0); + memcpy (®isters[REGISTER_BYTE (FP0_REGNUM)], &inferior_fp_registers, + sizeof (inferior_fp_registers)); +} + +/* Store our register values back into the inferior. + If REGNO is -1, do this for all registers. + Otherwise, REGNO specifies which register (so we can save time). */ + +void +store_inferior_registers (int regno) +{ + struct reg inferior_registers; + struct fpreg inferior_fp_registers; + + memcpy (&inferior_registers, ®isters[REGISTER_BYTE (0)], + sizeof (inferior_registers)); + ptrace (PT_SETREGS, inferior_pid, + (PTRACE_ARG3_TYPE) & inferior_registers, 0); + + memcpy (&inferior_fp_registers, ®isters[REGISTER_BYTE (FP0_REGNUM)], + sizeof (inferior_fp_registers)); + ptrace (PT_SETFPREGS, inferior_pid, + (PTRACE_ARG3_TYPE) & inferior_fp_registers, 0); +} +#endif /* !__m68k__ */ + + +#ifdef __ns32k__ +/* Fetch one or more registers from the inferior. REGNO == -1 to get + them all. We actually fetch more than requested, when convenient, + marking them as valid so we won't fetch them again. */ + +void +fetch_inferior_registers (int regno) +{ + struct reg inferior_registers; + struct fpreg inferior_fpregisters; + + ptrace (PT_GETREGS, inferior_pid, + (PTRACE_ARG3_TYPE) & inferior_registers, 0); + ptrace (PT_GETFPREGS, inferior_pid, + (PTRACE_ARG3_TYPE) & inferior_fpregisters, 0); + + RF (R0_REGNUM + 0, inferior_registers.r_r0); + RF (R0_REGNUM + 1, inferior_registers.r_r1); + RF (R0_REGNUM + 2, inferior_registers.r_r2); + RF (R0_REGNUM + 3, inferior_registers.r_r3); + RF (R0_REGNUM + 4, inferior_registers.r_r4); + RF (R0_REGNUM + 5, inferior_registers.r_r5); + RF (R0_REGNUM + 6, inferior_registers.r_r6); + RF (R0_REGNUM + 7, inferior_registers.r_r7); + + RF (SP_REGNUM, inferior_registers.r_sp); + RF (FP_REGNUM, inferior_registers.r_fp); + RF (PC_REGNUM, inferior_registers.r_pc); + RF (PS_REGNUM, inferior_registers.r_psr); + + RF (FPS_REGNUM, inferior_fpregisters.r_fsr); + RF (FP0_REGNUM + 0, inferior_fpregisters.r_freg[0]); + RF (FP0_REGNUM + 2, inferior_fpregisters.r_freg[2]); + RF (FP0_REGNUM + 4, inferior_fpregisters.r_freg[4]); + RF (FP0_REGNUM + 6, inferior_fpregisters.r_freg[6]); + RF (LP0_REGNUM + 1, inferior_fpregisters.r_freg[1]); + RF (LP0_REGNUM + 3, inferior_fpregisters.r_freg[3]); + RF (LP0_REGNUM + 5, inferior_fpregisters.r_freg[5]); + RF (LP0_REGNUM + 7, inferior_fpregisters.r_freg[7]); +} + +/* Store our register values back into the inferior. + If REGNO is -1, do this for all registers. + Otherwise, REGNO specifies which register (so we can save time). */ + +void +store_inferior_registers (int regno) +{ + struct reg inferior_registers; + struct fpreg inferior_fpregisters; + + RS (R0_REGNUM + 0, inferior_registers.r_r0); + RS (R0_REGNUM + 1, inferior_registers.r_r1); + RS (R0_REGNUM + 2, inferior_registers.r_r2); + RS (R0_REGNUM + 3, inferior_registers.r_r3); + RS (R0_REGNUM + 4, inferior_registers.r_r4); + RS (R0_REGNUM + 5, inferior_registers.r_r5); + RS (R0_REGNUM + 6, inferior_registers.r_r6); + RS (R0_REGNUM + 7, inferior_registers.r_r7); + + RS (SP_REGNUM, inferior_registers.r_sp); + RS (FP_REGNUM, inferior_registers.r_fp); + RS (PC_REGNUM, inferior_registers.r_pc); + RS (PS_REGNUM, inferior_registers.r_psr); + + RS (FPS_REGNUM, inferior_fpregisters.r_fsr); + RS (FP0_REGNUM + 0, inferior_fpregisters.r_freg[0]); + RS (FP0_REGNUM + 2, inferior_fpregisters.r_freg[2]); + RS (FP0_REGNUM + 4, inferior_fpregisters.r_freg[4]); + RS (FP0_REGNUM + 6, inferior_fpregisters.r_freg[6]); + RS (LP0_REGNUM + 1, inferior_fpregisters.r_freg[1]); + RS (LP0_REGNUM + 3, inferior_fpregisters.r_freg[3]); + RS (LP0_REGNUM + 5, inferior_fpregisters.r_freg[5]); + RS (LP0_REGNUM + 7, inferior_fpregisters.r_freg[7]); + + ptrace (PT_SETREGS, inferior_pid, + (PTRACE_ARG3_TYPE) & inferior_registers, 0); + ptrace (PT_SETFPREGS, inferior_pid, + (PTRACE_ARG3_TYPE) & inferior_fpregisters, 0); + +} +#endif /* !__ns32k__ */ + #ifdef __powerpc__ /* Fetch one or more registers from the inferior. REGNO == -1 to get them all. We actually fetch more than requested, when convenient, diff --git a/gdb/gdbserver/low-sparc.c b/gdb/gdbserver/low-sparc.c index e667c2edd34..34e4192521f 100644 --- a/gdb/gdbserver/low-sparc.c +++ b/gdb/gdbserver/low-sparc.c @@ -36,15 +36,8 @@ #include /***************Begin MY defs*********************/ -int quit_flag = 0; static char my_registers[REGISTER_BYTES]; char *registers = my_registers; - -/* Index within `registers' of the first byte of the space for - register N. */ - - -char buf2[MAX_REGISTER_RAW_SIZE]; /***************End MY defs*********************/ #include @@ -52,15 +45,12 @@ char buf2[MAX_REGISTER_RAW_SIZE]; extern int sys_nerr; extern char **sys_errlist; -extern char **environ; extern int errno; extern int inferior_pid; -void quit (), perror_with_name (); -int query (); +void perror_with_name (); /* Start an inferior process and returns its pid. - ALLARGS is a vector of program-name and args. - ENV is the environment vector to pass. */ + ALLARGS is a vector of program-name and args. */ int create_inferior (char *program, char **allargs) diff --git a/gdb/gdbserver/low-sun3.c b/gdb/gdbserver/low-sun3.c index b20c2a80c1b..e1e64b6ba1d 100644 --- a/gdb/gdbserver/low-sun3.c +++ b/gdb/gdbserver/low-sun3.c @@ -33,15 +33,8 @@ #include /***************Begin MY defs*********************/ -int quit_flag = 0; static char my_registers[REGISTER_BYTES]; char *registers = my_registers; - -/* Index within `registers' of the first byte of the space for - register N. */ - - -char buf2[MAX_REGISTER_RAW_SIZE]; /***************End MY defs*********************/ #include @@ -49,15 +42,12 @@ char buf2[MAX_REGISTER_RAW_SIZE]; extern int sys_nerr; extern char **sys_errlist; -extern char **environ; extern int errno; extern int inferior_pid; -void quit (), perror_with_name (); -int query (); +void perror_with_name (); /* Start an inferior process and returns its pid. - ALLARGS is a vector of program-name and args. - ENV is the environment vector to pass. */ + ALLARGS is a vector of program-name and args. */ int create_inferior (char *program, char **allargs) -- 2.30.2