X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gdb%2Fhp300ux-nat.c;h=26aa80fbdfbb9cc46a81e6d406df1331132dace3;hb=c65ecaf37b02a936e0d8c4074da3b5da8017e464;hp=38f68e1bdb7b90038f208b2029c40bbbd4f332ec;hpb=1996fae84682e8ddd146215dd2959ad1ec924c09;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/hp300ux-nat.c b/gdb/hp300ux-nat.c index 38f68e1bdb..26aa80fbdf 100644 --- a/gdb/hp300ux-nat.c +++ b/gdb/hp300ux-nat.c @@ -1,25 +1,28 @@ /* HP/UX native interface for HP 300's, for GDB when running under Unix. - Copyright 1986, 1987, 1989, 1991, 1992, 1993 Free Software Foundation, Inc. - -This file is part of GDB. + Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1996, 1999, 2000, + 2001 Free Software Foundation, Inc. -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 file is part of GDB. -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. + 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. -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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + 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., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ #include "defs.h" #include "frame.h" #include "inferior.h" +#include "regcache.h" /* Defining this means some system include files define some extra stuff. */ #define WOPR @@ -34,37 +37,38 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include -static void -fetch_inferior_register PARAMS ((int, unsigned int)); +static void fetch_inferior_register (int, unsigned int); -static void -store_inferior_register_1 PARAMS ((int, unsigned int, int)); +static void store_inferior_register_1 (int, unsigned int, int); -static void -store_inferior_register PARAMS ((int, unsigned int)); +static void store_inferior_register (int, unsigned int); /* Get kernel_u_addr using HPUX-style nlist(). */ CORE_ADDR kernel_u_addr; -struct hpnlist { - char * n_name; - long n_value; - unsigned char n_type; - unsigned char n_length; - short n_almod; - short n_unused; -}; -static struct hpnlist nl[] = {{ "_u", -1, }, { (char *) 0, }}; +struct hpnlist + { + char *n_name; + long n_value; + unsigned char n_type; + unsigned char n_length; + short n_almod; + short n_unused; + }; +static struct hpnlist nl[] = +{ + {"_u", -1,}, + {(char *) 0,}}; /* read the value of the u area from the hp-ux kernel */ void -_initialize_hp300ux_nat () +_initialize_hp300ux_nat (void) { #ifndef HPUX_VERSION_5 - nlist ("/hp-ux", nl); - kernel_u_addr = nl[0].n_value; + nlist ("/hp-ux", nl); + kernel_u_addr = nl[0].n_value; #else /* HPUX version 5. */ - kernel_u_addr = (CORE_ADDR) 0x0097900; + kernel_u_addr = (CORE_ADDR) 0x0097900; #endif } @@ -75,27 +79,30 @@ _initialize_hp300ux_nat () - kernel_u_addr) static void -fetch_inferior_register (regno, regaddr) - register int regno; - register unsigned int regaddr; +fetch_inferior_register (register int regno, register unsigned int regaddr) { #ifndef HPUX_VERSION_5 if (regno == PS_REGNUM) { - union { int i; short s[2]; } ps_val; + union + { + int i; + short s[2]; + } + ps_val; int regval; - + ps_val.i = (ptrace (PT_RUAREA, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, 0, 0)); regval = ps_val.s[0]; - supply_register (regno, (char *)®val); + supply_register (regno, (char *) ®val); } else #endif /* not HPUX_VERSION_5 */ { char buf[MAX_REGISTER_RAW_SIZE]; register int i; - + for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int)) { *(int *) &buf[i] = ptrace (PT_RUAREA, inferior_pid, @@ -108,10 +115,7 @@ fetch_inferior_register (regno, regaddr) } static void -store_inferior_register_1 (regno, regaddr, val) - int regno; - unsigned int regaddr; - int val; +store_inferior_register_1 (int regno, unsigned int regaddr, int val) { errno = 0; ptrace (PT_WUAREA, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, val, 0); @@ -121,7 +125,7 @@ store_inferior_register_1 (regno, regaddr, val) if (errno != 0) { char string_buf[64]; - + sprintf (string_buf, "writing register number %d", regno); perror_with_name (string_buf); } @@ -130,15 +134,18 @@ store_inferior_register_1 (regno, regaddr, val) } static void -store_inferior_register (regno, regaddr) - register int regno; - register unsigned int regaddr; +store_inferior_register (register int regno, register unsigned int regaddr) { #ifndef HPUX_VERSION_5 if (regno == PS_REGNUM) { - union { int i; short s[2]; } ps_val; - + union + { + int i; + short s[2]; + } + ps_val; + ps_val.i = (ptrace (PT_RUAREA, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, 0, 0)); ps_val.s[0] = (read_register (regno)); @@ -148,8 +155,7 @@ store_inferior_register (regno, regaddr) #endif /* not HPUX_VERSION_5 */ { register int i; - extern char registers[]; - + for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int)) { store_inferior_register_1 @@ -162,12 +168,11 @@ store_inferior_register (regno, regaddr) } void -fetch_inferior_registers (regno) - int regno; +fetch_inferior_registers (int regno) { struct user u; register unsigned int ar0_offset; - + ar0_offset = (INFERIOR_AR0 (u)); if (regno == -1) { @@ -188,8 +193,7 @@ fetch_inferior_registers (regno) Otherwise, REGNO specifies which register (so we can save time). */ void -store_inferior_registers (regno) - register int regno; +store_inferior_registers (register int regno) { struct user u; register unsigned int ar0_offset; @@ -199,7 +203,7 @@ store_inferior_registers (regno) store_inferior_register (regno, (FP_REGISTER_ADDR (u, regno))); return; } - + ar0_offset = (INFERIOR_AR0 (u)); if (regno >= 0) { @@ -215,7 +219,7 @@ store_inferior_registers (regno) } int -getpagesize () +getpagesize (void) { return 4096; }