From: Jim Kingdon Date: Wed, 28 Apr 1993 21:20:40 +0000 (+0000) Subject: * hp300ux-nat.c: Cast second arg to supply_register calls. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0626f40d92f8d572550e5085e6f08b909a59492b;p=binutils-gdb.git * hp300ux-nat.c: Cast second arg to supply_register calls. (_initialize_kernel_u_addr, getpagesize): New functions. (store_inferior_register_1): Change arg name from value to val. (fetch_core_registers): Make arg core_reg_size unsigned. Pass 5 args to ptrace. * config/m68k/xm-hp300hpux.h: Define FIVE_ARG_PTRACE. Remove KERNEL_U_ADDR stuff. * infptrace.c [FIVE_ARG_PTRACE]: Pass 5th arg to ptrace. * config/m68k/hp300hpux.m{t,h}: Move exec.o from NATDEPFILES to TDEPFILES * config/m68k/hp300hpux.mt: Mention GAS requirement. Remove hp-include stuff. Add m68k-tdep.o to TDEPFILES. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 4c6a7f4374c..9b0952318ff 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,18 @@ +Wed Apr 28 06:11:38 1993 Jim Kingdon (kingdon@cygnus.com) + + * hp300ux-nat.c: Cast second arg to supply_register calls. + (_initialize_kernel_u_addr, getpagesize): New functions. + (store_inferior_register_1): Change arg name from value to val. + (fetch_core_registers): Make arg core_reg_size unsigned. + Pass 5 args to ptrace. + * config/m68k/xm-hp300hpux.h: Define FIVE_ARG_PTRACE. + Remove KERNEL_U_ADDR stuff. + * infptrace.c [FIVE_ARG_PTRACE]: Pass 5th arg to ptrace. + * config/m68k/hp300hpux.m{t,h}: + Move exec.o from NATDEPFILES to TDEPFILES + * config/m68k/hp300hpux.mt: Mention GAS requirement. Remove + hp-include stuff. Add m68k-tdep.o to TDEPFILES. + Wed Apr 28 13:27:54 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) * ch-exp.y (yylex): Don't STREQ with simplename if it is NULL. diff --git a/gdb/config/m68k/hp300hpux.mh b/gdb/config/m68k/hp300hpux.mh index 43e27a3c50b..825311f4909 100644 --- a/gdb/config/m68k/hp300hpux.mh +++ b/gdb/config/m68k/hp300hpux.mh @@ -7,7 +7,7 @@ XM_FILE= xm-hp300hpux.h NAT_FILE= nm-hp300hpux.h -NATDEPFILES= exec.o infptrace.o inftarg.o fork-child.o hp300ux-nat.o +NATDEPFILES= infptrace.o inftarg.o fork-child.o hp300ux-nat.o SYSV_DEFINE=-DSYSV REGEX=regex.o REGEX1=regex.o diff --git a/gdb/config/m68k/hp300hpux.mt b/gdb/config/m68k/hp300hpux.mt index a8902cdf220..2a53b4bfc3f 100644 --- a/gdb/config/m68k/hp300hpux.mt +++ b/gdb/config/m68k/hp300hpux.mt @@ -1,11 +1,8 @@ # Target: Hewlett-Packard 9000 series 300, running HPUX #msg Note that GDB can only read symbols from programs that were -#msg compiled with GCC +#msg compiled with GCC using GAS. #msg -# The headers in the directory hp-include override system headers -# and tell GDB to use BSD executable file format (hence -Ihp-include) -MT_CFLAGS=-Ihp-include -TDEPFILES= m68k-pinsn.o +TDEPFILES= exec.o m68k-pinsn.o m68k-tdep.o TM_FILE= tm-hp300hpux.h diff --git a/gdb/config/m68k/xm-hp300hpux.h b/gdb/config/m68k/xm-hp300hpux.h index 54979b530a8..8edc0e0d34b 100644 --- a/gdb/config/m68k/xm-hp300hpux.h +++ b/gdb/config/m68k/xm-hp300hpux.h @@ -17,11 +17,16 @@ 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* HP/UX is USG, but it does have */ -#include - #define HOST_BYTE_ORDER BIG_ENDIAN +/* HPUX 8.0, in its infinite wisdom, has chosen to prototype ptrace + with five arguments, so programs written for normal ptrace lose. + + Idiots. + + (They should have just made it varadic). */ +#define FIVE_ARG_PTRACE + /* Define this to indicate problems with traps after continuing. */ #define HP_OS_BUG @@ -53,16 +58,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* So we'll just have to avoid big alloca's. */ #define BROKEN_LARGE_ALLOCA -/* This is the amount to subtract from u.u_ar0 - to get the offset in the core file of the register values. */ - -#ifdef HPUX_VERSION_5 -#define KERNEL_U_ADDR 0x00979000 -#else /* Not HPUX version 5. */ -/* Use HPUX-style nlist() to get kernel_u_addr. */ -#define KERNEL_U_ADDR_HPUX -#endif /* Not HPUX version 5. */ - #define REGISTER_ADDR(u_ar0, regno) \ (unsigned int) \ (((regno) < PS_REGNUM) \ diff --git a/gdb/hp300ux-nat.c b/gdb/hp300ux-nat.c index 05590551771..0f392ab0f9b 100644 --- a/gdb/hp300ux-nat.c +++ b/gdb/hp300ux-nat.c @@ -39,11 +39,35 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include +/* 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, }}; + +/* read the value of the u area from the hp-ux kernel */ +void _initialize_kernel_u_addr () +{ +#ifndef HPUX_VERSION_5 + nlist ("/hp-ux", nl); + kernel_u_addr = nl[0].n_value; +#else /* HPUX version 5. */ + kernel_u_addr = (CORE_ADDR) 0x0097900; +#endif +} + #define INFERIOR_AR0(u) \ ((ptrace \ (PT_RUAREA, inferior_pid, \ - (PTRACE_ARG3_TYPE) ((char *) &u.u_ar0 - (char *) &u), 0)) \ - - KERNEL_U_ADDR) + (PTRACE_ARG3_TYPE) ((char *) &u.u_ar0 - (char *) &u), 0, 0)) \ + - kernel_u_addr) static void fetch_inferior_register (regno, regaddr) @@ -57,9 +81,9 @@ fetch_inferior_register (regno, regaddr) int regval; ps_val.i = (ptrace (PT_RUAREA, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, - 0)); + 0, 0)); regval = ps_val.s[0]; - supply_register (regno, ®val); + supply_register (regno, (char *)®val); } else #endif /* not HPUX_VERSION_5 */ @@ -70,7 +94,7 @@ fetch_inferior_register (regno, regaddr) for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int)) { *(int *) &buf[i] = ptrace (PT_RUAREA, inferior_pid, - (PTRACE_ARG3_TYPE) regaddr, 0); + (PTRACE_ARG3_TYPE) regaddr, 0, 0); regaddr += sizeof (int); } supply_register (regno, buf); @@ -79,13 +103,13 @@ fetch_inferior_register (regno, regaddr) } static void -store_inferior_register_1 (regno, regaddr, value) +store_inferior_register_1 (regno, regaddr, val) int regno; unsigned int regaddr; - int value; + int val; { errno = 0; - ptrace (PT_WUAREA, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, value); + ptrace (PT_WUAREA, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, val, 0); #if 0 /* HP-UX randomly sets errno to non-zero for regno == 25. However, the value is correctly written, so ignore errno. */ @@ -111,7 +135,7 @@ store_inferior_register (regno, regaddr) union { int i; short s[2]; } ps_val; ps_val.i = (ptrace (PT_RUAREA, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, - 0)); + 0, 0)); ps_val.s[0] = (read_register (regno)); store_inferior_register_1 (regno, regaddr, ps_val.i); } @@ -199,7 +223,7 @@ store_inferior_registers (regno) void fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr) char *core_reg_sect; - int core_reg_size; + unsigned int core_reg_size; int which; unsigned int reg_addr; /* Unused in this version */ { @@ -214,10 +238,10 @@ fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr) ((char *) &es.e_offset - (char *) &es.e_regs[R0])) error ("Not enough registers in core file"); for (regno = 0; (regno < PS_REGNUM); regno++) - supply_register (regno, &es.e_regs[regno + R0]); + supply_register (regno, (char *) &es.e_regs[regno + R0]); val = es.e_PS; - supply_register (regno++, &val); - supply_register (regno++, &es.e_PC); + supply_register (regno++, (char *) &val); + supply_register (regno++, (char *) &es.e_PC); } else if (which == 2) { @@ -231,3 +255,9 @@ fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr) } } } + +int +getpagesize () +{ + return 4096; +} diff --git a/gdb/infptrace.c b/gdb/infptrace.c index f97d2c32f98..aafbd85f64f 100644 --- a/gdb/infptrace.c +++ b/gdb/infptrace.c @@ -22,8 +22,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "inferior.h" #include "target.h" -#include "nm.h" - #ifdef USG #include #endif @@ -33,11 +31,13 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include +#ifndef NO_PTRACE_H #ifdef PTRACE_IN_WRONG_PLACE #include #else #include #endif +#endif /* NO_PTRACE_H */ #if !defined (PT_KILL) #define PT_KILL 8 @@ -64,6 +64,11 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #endif #include +#if defined (FIVE_ARG_PTRACE +/* Deal with HPUX 8.0 braindamage. */ +#define ptrace(a,b,c,d) ptrace(a,b,c,d,0) +#endif + #if !defined (FETCH_INFERIOR_REGISTERS) #include /* Probably need to poke the user structure */ #if defined (KERNEL_U_ADDR_BSD) @@ -133,10 +138,6 @@ child_resume (step, signal) } #ifdef ATTACH_DETACH -/* Nonzero if we are debugging an attached process rather than - an inferior. */ -extern int attach_flag; - /* Start debugging the process whose number is PID. */ int attach (pid)