diff options
author | Mark Kettenis <kettenis@gnu.org> | 2004-08-06 19:14:44 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@gnu.org> | 2004-08-06 19:14:44 +0000 |
commit | b9e1c0d643d9bf37ae9d91f57de5efdda204c803 (patch) | |
tree | 8add00800d52864ad381a08dc6ecfd64d81a9e5d /gdb/vax-nat.c | |
parent | 9ad7bec7fd2f5b82db7f194ad79ce862ab7b1f02 (diff) | |
download | gdb-b9e1c0d643d9bf37ae9d91f57de5efdda204c803.zip gdb-b9e1c0d643d9bf37ae9d91f57de5efdda204c803.tar.gz gdb-b9e1c0d643d9bf37ae9d91f57de5efdda204c803.tar.bz2 |
* vax-nat.c: New file.
* vaxbsd-nat.c: Tweak comment.
* Makefile.in (ALLDEPFILES): Add vax-nat.c, vaxbsd-nat.c and
vaxnbsd-tdep.c.
(vax-nat.o): New dependency.
* configure.host (vax-*-bsd*, vax-*-ultrix*): Set gdb_host to vax.
(vax-*-ultrix2*): Remove.
* config/vax/vax.mh: New file.
* config/vax/nm-vax.h (vax_kernel_u_addr): New extern declaration.
(KERNEL_U_ADDR): Define as vax_kernel_u_addr.
(vax_register_u_addr): New prototype.
(REGISTER_U_ADDR): Define using vax_register_u_addr.
* config/vax/vaxult2.mh: Remove file.
* config/vax/vaxult.mh: Remove file.
* config/vax/vaxbsd.mh: Remove file.
* config/vax/vax.mt (TM_FILE): Remove.
* config/vax/tm-vaxbsd.h: Remove file.
Diffstat (limited to 'gdb/vax-nat.c')
-rw-r--r-- | gdb/vax-nat.c | 106 |
1 files changed, 106 insertions, 0 deletions
diff --git a/gdb/vax-nat.c b/gdb/vax-nat.c new file mode 100644 index 0000000..9dc0c51 --- /dev/null +++ b/gdb/vax-nat.c @@ -0,0 +1,106 @@ +/* Native-dependent code for VAX UNIXen (including older BSD's). + + Copyright 2004 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., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include "defs.h" +#include "inferior.h" + +#include "gdb_assert.h" +#include <sys/types.h> +#include <sys/dir.h> +#include <sys/user.h> + +#ifdef HAVE_SYS_PTRACE_H +#include <sys/ptrace.h> +#endif + +#ifndef PT_READ_U +#define PT_READ_U 3 +#endif + +#ifdef SYS_REG_H +/* UNIX 32V and derivatives (including 3BSD). */ +#include <sys/reg.h> +#else +/* 4.2BSD and derivatives. */ +#include <machine/reg.h> +#endif + +#include "vax-tdep.h" + +/* Address of the user structure. This is the the value for 32V; 3BSD + uses a different value, but hey, who's still using those systems? */ +CORE_ADDR vax_kernel_u_addr = 0x80020000; + +/* Location of the user's stored registers; usage is `u.u_ar0[XX]'. + For 4.2BSD and ULTRIX these are negative! See <machine/reg.h>. */ +static int vax_register_index[] = +{ + R0, R1, R2, R3, R4, R5, + R6, R7, R8, R9, R10, R11, + AP, FP, SP, PC, PS +}; + +CORE_ADDR +vax_register_u_addr (CORE_ADDR u_ar0, int regnum) +{ + gdb_assert (regnum >= 0 && regnum < ARRAY_SIZE (vax_register_index)); + + /* Type is `int *u_ar0'. See <sys/user.h>. */ + return u_ar0 + vax_register_index[regnum - VAX_R0_REGNUM] * 4; +} + + +CORE_ADDR +vax_register_u_offset (int regnum) +{ + size_t u_ar0_offset = offsetof (struct user, u_ar0); + CORE_ADDR u_ar0; + int pid; + + errno = 0; + pid = PIDGET (inferior_ptid); + u_ar0 = ptrace (PT_READ_U, pid, u_ar0_offset, 0); + if (errno) + perror_with_name ("Unable to determine location of registers"); + + return vax_register_u_addr (u_ar0, regnum) - vax_kernel_u_addr; +} + + +#include <nlist.h> + +#ifndef _PATH_UNIX +#define _PATH_UNIX "/vmunix" +#endif + +/* Provide a prototype to silence -Wmissing-prototypes. */ +void _initialize_vax_nat (void); + +void +_initialize_vax_nat (void) +{ + struct nlist names[2]; + + names[0].n_name = "_u"; + names[1].n_name = NULL; + if (nlist (_PATH_UNIX, names) == 0) + vax_kernel_u_addr = names[0].n_value; +} |