1992-10-16 18:47:34 +08:00
|
|
|
|
/* Native-dependent code for GDB, for NYU Ultra3 running Sym1 OS.
|
1992-10-16 14:05:36 +08:00
|
|
|
|
Copyright (C) 1988, 1989, 1991, 1992 Free Software Foundation, Inc.
|
|
|
|
|
Contributed by David Wood (wood@nyu.edu) at New York University.
|
|
|
|
|
|
|
|
|
|
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
|
1995-08-02 11:41:12 +08:00
|
|
|
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
1992-10-16 14:05:36 +08:00
|
|
|
|
|
|
|
|
|
#define DEBUG
|
|
|
|
|
#include "defs.h"
|
|
|
|
|
#include "frame.h"
|
|
|
|
|
#include "inferior.h"
|
|
|
|
|
#include "symtab.h"
|
|
|
|
|
#include "value.h"
|
|
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
#include <sys/param.h>
|
|
|
|
|
#include <signal.h>
|
|
|
|
|
#include <sys/ioctl.h>
|
|
|
|
|
#include <fcntl.h>
|
|
|
|
|
|
|
|
|
|
#include "gdbcore.h"
|
|
|
|
|
|
|
|
|
|
#include <sys/file.h>
|
* configure.in: Check for working mmap, ansi headers, string.h,
strings.h, and memory.h.
* configure: Regenerated.
* gdb_stat.h: New file, "portable" <sys/stat.h>.
* gdb_string.h: New file, "portable" <string.h>.
* altos-xdep.c, arm-tdep.c, arm-xdep.c, convex-tdep.c,
convex-xdep.c, coredep.c, cxux-nat.c, dbxread.c, exec.c,
gould-xdep.c, hppa-tdep.c, i386aix-nat.c, i386b-nat.c,
i386mach-nat.c, i386v-nat.c, infptrace.c, m88k-nat.c, main.c,
mdebugread.c, objfiles.c, os9kread.c, procfs.c, pyr-xdep.c,
rs6000-nat.c, source.c, standalone.c, stuff.c, sun386-nat.c,
symfile.c, symm-nat.c, symm-tdep.c, symtab.c, top.c, ultra3-nat.c,
ultra3-xdep.c, umax-xdep.c, xcoffread.c: Include "gdb_stat.h"
instead of <sys/stat.h>.
* alpha-tdep.c, breakpoint.c, buildsym.c, c-typeprint.c,
ch-typeprint.c, coffread.c, command.c, core-sol2.c, core-svr4.c,
core.c, corelow.c, cp-valprint.c, dbxread.c, dcache.c, demangle.c,
dpx2-nat.c, dstread.c, dwarfread.c, elfread.c, environ.c, eval.c,
exec.c, f-lang.c, f-typeprint.c, f-valprint.c, findvar.c,
fork-child.c, gdbtypes.c, hpread.c, i386-tdep.c, infcmd.c,
inflow.c, infptrace.c, infrun.c, irix5-nat.c, language.c,
m2-typeprint.c, main.c, mdebugread.c, minsyms.c, mipsread.c,
monitor.c, nlmread.c, objfiles.c, os9kread.c, osfsolib.c, parse.c,
printcmd.c, procfs.c, regex.c, remote-adapt.c, remote-arc.c,
remote-array.c, remote-bug.c, remote-e7000.c, remote-eb.c,
remote-es.c, remote-hms.c, remote-mm.c, remote-os9k.c,
remote-pa.c, remote-sim.c, remote-st.c, remote-udi.c,
remote-utils.c, remote-vx.c, remote-vx29k.c, remote-vx68.c,
remote-vx960.c, remote-vxmips.c, remote-vxsparc.c, remote.c,
solib.c, somread.c, source.c, stabsread.c, stack.c, symfile.c,
symmisc.c, symtab.c, target.c, top.c, typeprint.c, utils.c,
valarith.c, valops.c, valprint.c, values.c, xcoffread.c: Include
"gdb_string.h" instead of <string.h>.
* gdbtk.c: Likewise.
* config/xm-sysv4.h, i386/xm-ptx.h, m68k/xm-sun3os4.h,
sparc/xm-sun4os4.h (HAVE_MMAP): Removed.
* config/xm-lynx.h, config/i386/xm-ptx.h,
config/m68k/nm-apollo68b.h, config/m68k/xm-hp300hpux.h,
config/mips/xm-irix3.h, config/mips/xm-mips.h,
config/mips/xm-news-mips.h, config/mips/xm-riscos.h,
config/pa/hppah.h, config/rs6000/xm-rs6000.h,
config/sparc/xm-sun4os4.h, config/sparc/xm-sun4sol2.h,
config/vax/xm-vaxbsd.h, config/vax/xm-vaxult.h,
config/vax/xm-vaxult2.h (MEM_FNS_DECLARED): Removed.
* config/mips/xm-irix3.h, config/mips/xm-mips.h,
config/pa/xm-hppah.h (memcpy, memset): Removed declarations.
1995-08-02 04:14:27 +08:00
|
|
|
|
#include "gdb_stat.h"
|
1992-10-16 14:05:36 +08:00
|
|
|
|
|
1992-10-16 18:47:34 +08:00
|
|
|
|
/* Assumes support for AMD's Binary Compatibility Standard
|
|
|
|
|
for ptrace(). If you define ULTRA3, the ultra3 extensions to
|
|
|
|
|
ptrace() are used allowing the reading of more than one register
|
|
|
|
|
at a time.
|
|
|
|
|
|
|
|
|
|
This file assumes KERNEL_DEBUGGING is turned off. This means
|
|
|
|
|
that if the user/gdb tries to read gr64-gr95 or any of the
|
|
|
|
|
protected special registers we silently return -1 (see the
|
|
|
|
|
CANNOT_STORE/FETCH_REGISTER macros). */
|
|
|
|
|
#define ULTRA3
|
|
|
|
|
|
|
|
|
|
#if !defined (offsetof)
|
|
|
|
|
# define offsetof(TYPE, MEMBER) ((unsigned long) &((TYPE *)0)->MEMBER)
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
extern int errno;
|
|
|
|
|
struct ptrace_user pt_struct;
|
|
|
|
|
|
1992-10-16 14:05:36 +08:00
|
|
|
|
/* Get all available registers from the inferior. Registers that are
|
|
|
|
|
* defined in REGISTER_NAMES, but not available to the user/gdb are
|
|
|
|
|
* supplied as -1. This may include gr64-gr95 and the protected special
|
|
|
|
|
* purpose registers.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
fetch_inferior_registers (regno)
|
|
|
|
|
int regno;
|
|
|
|
|
{
|
|
|
|
|
register int i,j,ret_val=0;
|
|
|
|
|
char buf[128];
|
|
|
|
|
|
|
|
|
|
if (regno != -1) {
|
|
|
|
|
fetch_register (regno);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Global Registers */
|
|
|
|
|
#ifdef ULTRA3
|
|
|
|
|
errno = 0;
|
|
|
|
|
ptrace (PT_READ_STRUCT, inferior_pid,
|
|
|
|
|
(PTRACE_ARG3_TYPE) register_addr(GR96_REGNUM,0),
|
|
|
|
|
(int)&pt_struct.pt_gr[0], 32*4);
|
|
|
|
|
if (errno != 0) {
|
|
|
|
|
perror_with_name ("reading global registers");
|
|
|
|
|
ret_val = -1;
|
|
|
|
|
} else for (regno=GR96_REGNUM, j=0 ; j<32 ; regno++, j++) {
|
|
|
|
|
supply_register (regno, &pt_struct.pt_gr[j]);
|
|
|
|
|
}
|
|
|
|
|
#else
|
|
|
|
|
for (regno=GR96_REGNUM ; !ret_val && regno < GR96_REGNUM+32 ; regno++)
|
|
|
|
|
fetch_register(regno);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* Local Registers */
|
|
|
|
|
#ifdef ULTRA3
|
|
|
|
|
errno = 0;
|
|
|
|
|
ptrace (PT_READ_STRUCT, inferior_pid,
|
|
|
|
|
(PTRACE_ARG3_TYPE) register_addr(LR0_REGNUM,0),
|
|
|
|
|
(int)&pt_struct.pt_lr[0], 128*4);
|
|
|
|
|
if (errno != 0) {
|
|
|
|
|
perror_with_name ("reading local registers");
|
|
|
|
|
ret_val = -1;
|
|
|
|
|
} else for (regno=LR0_REGNUM, j=0 ; j<128 ; regno++, j++) {
|
|
|
|
|
supply_register (regno, &pt_struct.pt_lr[j]);
|
|
|
|
|
}
|
|
|
|
|
#else
|
|
|
|
|
for (regno=LR0_REGNUM ; !ret_val && regno < LR0_REGNUM+128 ; regno++)
|
|
|
|
|
fetch_register(regno);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* Special Registers */
|
|
|
|
|
fetch_register(GR1_REGNUM);
|
|
|
|
|
fetch_register(CPS_REGNUM);
|
|
|
|
|
fetch_register(PC_REGNUM);
|
|
|
|
|
fetch_register(NPC_REGNUM);
|
|
|
|
|
fetch_register(PC2_REGNUM);
|
|
|
|
|
fetch_register(IPC_REGNUM);
|
|
|
|
|
fetch_register(IPA_REGNUM);
|
|
|
|
|
fetch_register(IPB_REGNUM);
|
|
|
|
|
fetch_register(Q_REGNUM);
|
|
|
|
|
fetch_register(BP_REGNUM);
|
|
|
|
|
fetch_register(FC_REGNUM);
|
|
|
|
|
|
|
|
|
|
/* Fake any registers that are in REGISTER_NAMES, but not available to gdb */
|
|
|
|
|
registers_fetched();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* 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).
|
|
|
|
|
* NOTE: Assumes AMD's binary compatibility standard.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
store_inferior_registers (regno)
|
|
|
|
|
int regno;
|
|
|
|
|
{
|
|
|
|
|
register unsigned int regaddr;
|
|
|
|
|
char buf[80];
|
|
|
|
|
|
|
|
|
|
if (regno >= 0)
|
|
|
|
|
{
|
|
|
|
|
if (CANNOT_STORE_REGISTER(regno))
|
|
|
|
|
return;
|
|
|
|
|
regaddr = register_addr (regno, 0);
|
|
|
|
|
errno = 0;
|
|
|
|
|
ptrace (PT_WRITE_U, inferior_pid,
|
|
|
|
|
(PTRACE_ARG3_TYPE) regaddr, read_register(regno));
|
|
|
|
|
if (errno != 0)
|
|
|
|
|
{
|
|
|
|
|
sprintf (buf, "writing register %s (#%d)", reg_names[regno],regno);
|
|
|
|
|
perror_with_name (buf);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
#ifdef ULTRA3
|
|
|
|
|
pt_struct.pt_gr1 = read_register(GR1_REGNUM);
|
|
|
|
|
for (regno = GR96_REGNUM; regno < GR96_REGNUM+32; regno++)
|
|
|
|
|
pt_struct.pt_gr[regno] = read_register(regno);
|
|
|
|
|
for (regno = LR0_REGNUM; regno < LR0_REGNUM+128; regno++)
|
|
|
|
|
pt_struct.pt_gr[regno] = read_register(regno);
|
|
|
|
|
errno = 0;
|
|
|
|
|
ptrace (PT_WRITE_STRUCT, inferior_pid,
|
|
|
|
|
(PTRACE_ARG3_TYPE) register_addr(GR1_REGNUM,0),
|
|
|
|
|
(int)&pt_struct.pt_gr1,(1*32*128)*4);
|
|
|
|
|
if (errno != 0)
|
|
|
|
|
{
|
|
|
|
|
sprintf (buf, "writing all local/global registers");
|
|
|
|
|
perror_with_name (buf);
|
|
|
|
|
}
|
|
|
|
|
pt_struct.pt_psr = read_register(CPS_REGNUM);
|
|
|
|
|
pt_struct.pt_pc0 = read_register(NPC_REGNUM);
|
|
|
|
|
pt_struct.pt_pc1 = read_register(PC_REGNUM);
|
|
|
|
|
pt_struct.pt_pc2 = read_register(PC2_REGNUM);
|
|
|
|
|
pt_struct.pt_ipc = read_register(IPC_REGNUM);
|
|
|
|
|
pt_struct.pt_ipa = read_register(IPA_REGNUM);
|
|
|
|
|
pt_struct.pt_ipb = read_register(IPB_REGNUM);
|
|
|
|
|
pt_struct.pt_q = read_register(Q_REGNUM);
|
|
|
|
|
pt_struct.pt_bp = read_register(BP_REGNUM);
|
|
|
|
|
pt_struct.pt_fc = read_register(FC_REGNUM);
|
|
|
|
|
errno = 0;
|
|
|
|
|
ptrace (PT_WRITE_STRUCT, inferior_pid,
|
|
|
|
|
(PTRACE_ARG3_TYPE) register_addr(CPS_REGNUM,0),
|
|
|
|
|
(int)&pt_struct.pt_psr,(10)*4);
|
|
|
|
|
if (errno != 0)
|
|
|
|
|
{
|
|
|
|
|
sprintf (buf, "writing all special registers");
|
|
|
|
|
perror_with_name (buf);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
#else
|
|
|
|
|
store_inferior_registers(GR1_REGNUM);
|
|
|
|
|
for (regno=GR96_REGNUM ; regno<GR96_REGNUM+32 ; regno++)
|
|
|
|
|
store_inferior_registers(regno);
|
|
|
|
|
for (regno=LR0_REGNUM ; regno<LR0_REGNUM+128 ; regno++)
|
|
|
|
|
store_inferior_registers(regno);
|
|
|
|
|
store_inferior_registers(CPS_REGNUM);
|
|
|
|
|
store_inferior_registers(PC_REGNUM);
|
|
|
|
|
store_inferior_registers(NPC_REGNUM);
|
|
|
|
|
store_inferior_registers(PC2_REGNUM);
|
|
|
|
|
store_inferior_registers(IPC_REGNUM);
|
|
|
|
|
store_inferior_registers(IPA_REGNUM);
|
|
|
|
|
store_inferior_registers(IPB_REGNUM);
|
|
|
|
|
store_inferior_registers(Q_REGNUM);
|
|
|
|
|
store_inferior_registers(BP_REGNUM);
|
|
|
|
|
store_inferior_registers(FC_REGNUM);
|
|
|
|
|
#endif /* ULTRA3 */
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Fetch an individual register (and supply it).
|
|
|
|
|
* return 0 on success, -1 on failure.
|
|
|
|
|
* NOTE: Assumes AMD's Binary Compatibility Standard for ptrace().
|
|
|
|
|
*/
|
|
|
|
|
static void
|
|
|
|
|
fetch_register (regno)
|
|
|
|
|
int regno;
|
|
|
|
|
{
|
|
|
|
|
char buf[128];
|
|
|
|
|
int val;
|
|
|
|
|
|
|
|
|
|
if (CANNOT_FETCH_REGISTER(regno)) {
|
|
|
|
|
val = -1;
|
|
|
|
|
supply_register (regno, &val);
|
|
|
|
|
} else {
|
|
|
|
|
errno = 0;
|
|
|
|
|
val = ptrace (PT_READ_U, inferior_pid,
|
|
|
|
|
(PTRACE_ARG3_TYPE) register_addr(regno,0), 0);
|
|
|
|
|
if (errno != 0) {
|
|
|
|
|
sprintf(buf,"reading register %s (#%d)",reg_names[regno],regno);
|
|
|
|
|
perror_with_name (buf);
|
|
|
|
|
} else {
|
|
|
|
|
supply_register (regno, &val);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Read AMD's Binary Compatibilty Standard conforming core file.
|
|
|
|
|
* struct ptrace_user is the first thing in the core file
|
|
|
|
|
*/
|
|
|
|
|
|
* coredep.c: Renamed to core-aout.c
* core-svr4.c: Renamed to core-regset.c
* Makefile.in (ALLDEPFILES): Account for renamings.
* corelow.c (core_file_fns): Add, points to chain of structs.
(add_core_fns): New function to build chain of structs.
(get_core_registers): Modify to search core functions chain and call
appropriate fetch_core_registers function based on core file flavour.
* gdbcore.h (fetch_core_registers): Remove declaration.
(struct core_fns): Define struct for core function info.
* i386m3-nat.c: Update comment for filename change (coredep->core-aout)
* a68v-nat.c (fetch_core_registers): Remove stub, not needed now.
* alpha-nat.c (fetch_core_registers): Make static.
(alpha_core_fns, _initialize_core_alpha): New struct and func.
* core-aout.c (fetch_core_registers): Make static
(aout_core_fns, _initialize_core_aout): New struct and func.
* core-regset.c (fetch_core_registers): Make static.
(regset_core_fns, _initialize_core_regset): New struct and func.
* core-sol2.c (fetch_core_registers): Make static.
(solaris_core_fns, _initialize_core_solaris): New struct and func.
* hp300ux-nat.c (fetch_core_registers): Make static.
(hp300ux_core_fns, _initialize_core_hp300ux): New struct and func.
* i386aix-nat.c (fetch_core_registers): Make static.
(i386aix_core_fns, _initialize_core_i386aix): New struct and func.
* i386mach-nat.c (fetch_core_registers: Make static.
(i386mach_core_fns, _initialize_core_i386mach): New struct and func.
* irix4-nat.c (fetch_core_registers): Make static.
(irix4_core_fns, _initialize_core_irix4): New struct and func.
* irix5-nat.c (fetch_core_registers):
(irix5_core_fns, _initialize_core_irix5): New struct and func.
* lynx-nat.c (fetch_core_registers): Make static.
(lynx_core_fns, _initialize_core_lynx): New struct and func.
* mips-nat.c (fetch_core_registers): Make static.
(mips_core_fns, _initialize_core_mips): New struct and func.
* ns32km3-nat.c (fetch_core_registers): Remove stub.
* rs6000-nat.c (fetch_core_registers): Make static.
(rs6000_core_fns, _initialize_core_rs6000): New struct and func.
* sparc-nat.c (fetch_core_registers): Make static.
(sparc_core_fns, _initialize_core_sparc): New struct and func.
* sun3-nat.c (fetch_core_registers):
(sun3_core_fns, _initialize_core_sun3): New struct and func.
* sun386-nat.c (fetch_core_registers): Remove stub.
* ultra3-nat.c (fetch_core_registers): Make static.
(ultra3_core_fns, _initialize_core_ultra3): New struct and func.
* config/gould/pn.mh (XDEPFILES),
config/i386/fbsd.mh (NATDEPFILES),
config/i386/i386bsd.mh (NATDEPFILES),
config/i386/i386m3.mh (XDEPFILES),
config/i386/i386sco.mh (NATDEPFILES),
config/i386/i386sco4.mh (NATDEPFILES),
config/i386/i386v.mh (NATDEPFILES),
config/i386/i386v32.mh (NATDEPFILES),
config/i386/nbsd.mh (NATDEPFILES),
config/i386/ptx.mh (XDEPFILES),
config/i386/ptx4.mh (XDEPFILES),
config/i386/symmetry.mh (NATDEPFILES),
config/m68k/3b1.mh (XDEPFILES),
config/m68k/cisco.mt (TDEPFILES),
config/m68k/delta68.mh (NATDEPFILES),
config/m68k/dpx2.mh (NATDEPFILES),
config/m68k/hp300bsd.mh (NATDEPFILES),
config/m68k/hp300hpux.mh (NATDEPFILES),
config/m68k/isi.mh (XDEPFILES),
config/m68k/news.mh (NATDEPFILES),
config/m68k/news1000.mh (XDEPFILES),
config/m88k/cxux.mh (NATDEPFILES),
config/m88k/delta88.mh (NATDEPFILES),
config/mips/littlemips.mh (XDEPFILES),
config/mips/mipsm3.mh (XDEPFILES),
config/ns32k/merlin.mh (XDEPFILES),
config/ns32k/nbsd.mh (NATDEPFILES),
config/ns32k/ns32km3.mh (NATDEPFILES),
config/pa/hppabsd.mh (NATDEPFILES),
config/pa/hppahpux.mh (NATDEPFILES),
config/romp/rtbsd.mh (XDEPFILES),
config/tahoe/tahoe.mh (XDEPFILES),
config/vax/vaxbsd.mh (XDEPFILES),
config/vax/vaxult.mh (NATDEPFILES),
config/vax/vaxult2.mh (NATDEPFILES),
Account for coredep.o to core-aout.o name change.
* config/i386/i386dgux (NATDEPFILES),
config/i386/i386sol2.mh (NATDEPFILES),
config/i386/i386v4.mh (NATDEPFILES),
config/i386/linux.mh (NATDEPFILES),
config/i386/ncr3000.mh (NATDEPFILES),
config/m68k/m68kv4.mh (NATDEPFILES),
config/m88k/delta88v4.mh (NATDEPFILES),
config/mips/mipsv4.mh (NATDEPFILES),
Account for core-svr4.o to core-regset.o name change.
1996-01-12 04:08:15 +08:00
|
|
|
|
static void
|
1992-10-16 14:05:36 +08:00
|
|
|
|
fetch_core_registers ()
|
|
|
|
|
{
|
|
|
|
|
register int regno;
|
|
|
|
|
int val;
|
|
|
|
|
char buf[4];
|
|
|
|
|
|
|
|
|
|
for (regno = 0 ; regno < NUM_REGS; regno++) {
|
|
|
|
|
if (!CANNOT_FETCH_REGISTER(regno)) {
|
1995-10-20 03:54:44 +08:00
|
|
|
|
val = bfd_seek (core_bfd, (file_ptr) register_addr (regno, 0), SEEK_SET);
|
1992-10-16 14:05:36 +08:00
|
|
|
|
if (val < 0 || (val = bfd_read (buf, sizeof buf, 1, core_bfd)) < 0) {
|
|
|
|
|
char * buffer = (char *) alloca (strlen (reg_names[regno]) + 35);
|
|
|
|
|
strcpy (buffer, "Reading core register ");
|
|
|
|
|
strcat (buffer, reg_names[regno]);
|
|
|
|
|
perror_with_name (buffer);
|
|
|
|
|
}
|
|
|
|
|
supply_register (regno, buf);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Fake any registers that are in REGISTER_NAMES, but not available to gdb */
|
|
|
|
|
registers_fetched();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
1992-10-16 18:47:34 +08:00
|
|
|
|
/*
|
|
|
|
|
* Takes a register number as defined in tm.h via REGISTER_NAMES, and maps
|
|
|
|
|
* it to an offset in a struct ptrace_user defined by AMD's BCS.
|
|
|
|
|
* That is, it defines the mapping between gdb register numbers and items in
|
|
|
|
|
* a struct ptrace_user.
|
|
|
|
|
* A register protection scheme is set up here. If a register not
|
|
|
|
|
* available to the user is specified in 'regno', then an address that
|
|
|
|
|
* will cause ptrace() to fail is returned.
|
|
|
|
|
*/
|
|
|
|
|
unsigned int
|
|
|
|
|
register_addr (regno,blockend)
|
|
|
|
|
unsigned int regno;
|
|
|
|
|
char *blockend;
|
|
|
|
|
{
|
|
|
|
|
if ((regno >= LR0_REGNUM) && (regno < LR0_REGNUM + 128)) {
|
|
|
|
|
return(offsetof(struct ptrace_user,pt_lr[regno-LR0_REGNUM]));
|
|
|
|
|
} else if ((regno >= GR96_REGNUM) && (regno < GR96_REGNUM + 32)) {
|
|
|
|
|
return(offsetof(struct ptrace_user,pt_gr[regno-GR96_REGNUM]));
|
|
|
|
|
} else {
|
|
|
|
|
switch (regno) {
|
|
|
|
|
case GR1_REGNUM: return(offsetof(struct ptrace_user,pt_gr1));
|
|
|
|
|
case CPS_REGNUM: return(offsetof(struct ptrace_user,pt_psr));
|
|
|
|
|
case NPC_REGNUM: return(offsetof(struct ptrace_user,pt_pc0));
|
|
|
|
|
case PC_REGNUM: return(offsetof(struct ptrace_user,pt_pc1));
|
|
|
|
|
case PC2_REGNUM: return(offsetof(struct ptrace_user,pt_pc2));
|
|
|
|
|
case IPC_REGNUM: return(offsetof(struct ptrace_user,pt_ipc));
|
|
|
|
|
case IPA_REGNUM: return(offsetof(struct ptrace_user,pt_ipa));
|
|
|
|
|
case IPB_REGNUM: return(offsetof(struct ptrace_user,pt_ipb));
|
|
|
|
|
case Q_REGNUM: return(offsetof(struct ptrace_user,pt_q));
|
|
|
|
|
case BP_REGNUM: return(offsetof(struct ptrace_user,pt_bp));
|
|
|
|
|
case FC_REGNUM: return(offsetof(struct ptrace_user,pt_fc));
|
|
|
|
|
default:
|
1993-11-02 06:25:23 +08:00
|
|
|
|
fprintf_filtered(gdb_stderr,"register_addr():Bad register %s (%d)\n",
|
1992-10-16 18:47:34 +08:00
|
|
|
|
reg_names[regno],regno);
|
|
|
|
|
return(0xffffffff); /* Should make ptrace() fail */
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
* coredep.c: Renamed to core-aout.c
* core-svr4.c: Renamed to core-regset.c
* Makefile.in (ALLDEPFILES): Account for renamings.
* corelow.c (core_file_fns): Add, points to chain of structs.
(add_core_fns): New function to build chain of structs.
(get_core_registers): Modify to search core functions chain and call
appropriate fetch_core_registers function based on core file flavour.
* gdbcore.h (fetch_core_registers): Remove declaration.
(struct core_fns): Define struct for core function info.
* i386m3-nat.c: Update comment for filename change (coredep->core-aout)
* a68v-nat.c (fetch_core_registers): Remove stub, not needed now.
* alpha-nat.c (fetch_core_registers): Make static.
(alpha_core_fns, _initialize_core_alpha): New struct and func.
* core-aout.c (fetch_core_registers): Make static
(aout_core_fns, _initialize_core_aout): New struct and func.
* core-regset.c (fetch_core_registers): Make static.
(regset_core_fns, _initialize_core_regset): New struct and func.
* core-sol2.c (fetch_core_registers): Make static.
(solaris_core_fns, _initialize_core_solaris): New struct and func.
* hp300ux-nat.c (fetch_core_registers): Make static.
(hp300ux_core_fns, _initialize_core_hp300ux): New struct and func.
* i386aix-nat.c (fetch_core_registers): Make static.
(i386aix_core_fns, _initialize_core_i386aix): New struct and func.
* i386mach-nat.c (fetch_core_registers: Make static.
(i386mach_core_fns, _initialize_core_i386mach): New struct and func.
* irix4-nat.c (fetch_core_registers): Make static.
(irix4_core_fns, _initialize_core_irix4): New struct and func.
* irix5-nat.c (fetch_core_registers):
(irix5_core_fns, _initialize_core_irix5): New struct and func.
* lynx-nat.c (fetch_core_registers): Make static.
(lynx_core_fns, _initialize_core_lynx): New struct and func.
* mips-nat.c (fetch_core_registers): Make static.
(mips_core_fns, _initialize_core_mips): New struct and func.
* ns32km3-nat.c (fetch_core_registers): Remove stub.
* rs6000-nat.c (fetch_core_registers): Make static.
(rs6000_core_fns, _initialize_core_rs6000): New struct and func.
* sparc-nat.c (fetch_core_registers): Make static.
(sparc_core_fns, _initialize_core_sparc): New struct and func.
* sun3-nat.c (fetch_core_registers):
(sun3_core_fns, _initialize_core_sun3): New struct and func.
* sun386-nat.c (fetch_core_registers): Remove stub.
* ultra3-nat.c (fetch_core_registers): Make static.
(ultra3_core_fns, _initialize_core_ultra3): New struct and func.
* config/gould/pn.mh (XDEPFILES),
config/i386/fbsd.mh (NATDEPFILES),
config/i386/i386bsd.mh (NATDEPFILES),
config/i386/i386m3.mh (XDEPFILES),
config/i386/i386sco.mh (NATDEPFILES),
config/i386/i386sco4.mh (NATDEPFILES),
config/i386/i386v.mh (NATDEPFILES),
config/i386/i386v32.mh (NATDEPFILES),
config/i386/nbsd.mh (NATDEPFILES),
config/i386/ptx.mh (XDEPFILES),
config/i386/ptx4.mh (XDEPFILES),
config/i386/symmetry.mh (NATDEPFILES),
config/m68k/3b1.mh (XDEPFILES),
config/m68k/cisco.mt (TDEPFILES),
config/m68k/delta68.mh (NATDEPFILES),
config/m68k/dpx2.mh (NATDEPFILES),
config/m68k/hp300bsd.mh (NATDEPFILES),
config/m68k/hp300hpux.mh (NATDEPFILES),
config/m68k/isi.mh (XDEPFILES),
config/m68k/news.mh (NATDEPFILES),
config/m68k/news1000.mh (XDEPFILES),
config/m88k/cxux.mh (NATDEPFILES),
config/m88k/delta88.mh (NATDEPFILES),
config/mips/littlemips.mh (XDEPFILES),
config/mips/mipsm3.mh (XDEPFILES),
config/ns32k/merlin.mh (XDEPFILES),
config/ns32k/nbsd.mh (NATDEPFILES),
config/ns32k/ns32km3.mh (NATDEPFILES),
config/pa/hppabsd.mh (NATDEPFILES),
config/pa/hppahpux.mh (NATDEPFILES),
config/romp/rtbsd.mh (XDEPFILES),
config/tahoe/tahoe.mh (XDEPFILES),
config/vax/vaxbsd.mh (XDEPFILES),
config/vax/vaxult.mh (NATDEPFILES),
config/vax/vaxult2.mh (NATDEPFILES),
Account for coredep.o to core-aout.o name change.
* config/i386/i386dgux (NATDEPFILES),
config/i386/i386sol2.mh (NATDEPFILES),
config/i386/i386v4.mh (NATDEPFILES),
config/i386/linux.mh (NATDEPFILES),
config/i386/ncr3000.mh (NATDEPFILES),
config/m68k/m68kv4.mh (NATDEPFILES),
config/m88k/delta88v4.mh (NATDEPFILES),
config/mips/mipsv4.mh (NATDEPFILES),
Account for core-svr4.o to core-regset.o name change.
1996-01-12 04:08:15 +08:00
|
|
|
|
|
|
|
|
|
/* Register that we are able to handle ultra3 core file formats.
|
|
|
|
|
FIXME: is this really bfd_target_unknown_flavour? */
|
|
|
|
|
|
|
|
|
|
static struct core_fns ultra3_core_fns =
|
|
|
|
|
{
|
|
|
|
|
bfd_target_unknown_flavour,
|
|
|
|
|
fetch_core_registers,
|
|
|
|
|
NULL
|
|
|
|
|
};
|
1992-10-16 18:47:34 +08:00
|
|
|
|
|
* coredep.c: Renamed to core-aout.c
* core-svr4.c: Renamed to core-regset.c
* Makefile.in (ALLDEPFILES): Account for renamings.
* corelow.c (core_file_fns): Add, points to chain of structs.
(add_core_fns): New function to build chain of structs.
(get_core_registers): Modify to search core functions chain and call
appropriate fetch_core_registers function based on core file flavour.
* gdbcore.h (fetch_core_registers): Remove declaration.
(struct core_fns): Define struct for core function info.
* i386m3-nat.c: Update comment for filename change (coredep->core-aout)
* a68v-nat.c (fetch_core_registers): Remove stub, not needed now.
* alpha-nat.c (fetch_core_registers): Make static.
(alpha_core_fns, _initialize_core_alpha): New struct and func.
* core-aout.c (fetch_core_registers): Make static
(aout_core_fns, _initialize_core_aout): New struct and func.
* core-regset.c (fetch_core_registers): Make static.
(regset_core_fns, _initialize_core_regset): New struct and func.
* core-sol2.c (fetch_core_registers): Make static.
(solaris_core_fns, _initialize_core_solaris): New struct and func.
* hp300ux-nat.c (fetch_core_registers): Make static.
(hp300ux_core_fns, _initialize_core_hp300ux): New struct and func.
* i386aix-nat.c (fetch_core_registers): Make static.
(i386aix_core_fns, _initialize_core_i386aix): New struct and func.
* i386mach-nat.c (fetch_core_registers: Make static.
(i386mach_core_fns, _initialize_core_i386mach): New struct and func.
* irix4-nat.c (fetch_core_registers): Make static.
(irix4_core_fns, _initialize_core_irix4): New struct and func.
* irix5-nat.c (fetch_core_registers):
(irix5_core_fns, _initialize_core_irix5): New struct and func.
* lynx-nat.c (fetch_core_registers): Make static.
(lynx_core_fns, _initialize_core_lynx): New struct and func.
* mips-nat.c (fetch_core_registers): Make static.
(mips_core_fns, _initialize_core_mips): New struct and func.
* ns32km3-nat.c (fetch_core_registers): Remove stub.
* rs6000-nat.c (fetch_core_registers): Make static.
(rs6000_core_fns, _initialize_core_rs6000): New struct and func.
* sparc-nat.c (fetch_core_registers): Make static.
(sparc_core_fns, _initialize_core_sparc): New struct and func.
* sun3-nat.c (fetch_core_registers):
(sun3_core_fns, _initialize_core_sun3): New struct and func.
* sun386-nat.c (fetch_core_registers): Remove stub.
* ultra3-nat.c (fetch_core_registers): Make static.
(ultra3_core_fns, _initialize_core_ultra3): New struct and func.
* config/gould/pn.mh (XDEPFILES),
config/i386/fbsd.mh (NATDEPFILES),
config/i386/i386bsd.mh (NATDEPFILES),
config/i386/i386m3.mh (XDEPFILES),
config/i386/i386sco.mh (NATDEPFILES),
config/i386/i386sco4.mh (NATDEPFILES),
config/i386/i386v.mh (NATDEPFILES),
config/i386/i386v32.mh (NATDEPFILES),
config/i386/nbsd.mh (NATDEPFILES),
config/i386/ptx.mh (XDEPFILES),
config/i386/ptx4.mh (XDEPFILES),
config/i386/symmetry.mh (NATDEPFILES),
config/m68k/3b1.mh (XDEPFILES),
config/m68k/cisco.mt (TDEPFILES),
config/m68k/delta68.mh (NATDEPFILES),
config/m68k/dpx2.mh (NATDEPFILES),
config/m68k/hp300bsd.mh (NATDEPFILES),
config/m68k/hp300hpux.mh (NATDEPFILES),
config/m68k/isi.mh (XDEPFILES),
config/m68k/news.mh (NATDEPFILES),
config/m68k/news1000.mh (XDEPFILES),
config/m88k/cxux.mh (NATDEPFILES),
config/m88k/delta88.mh (NATDEPFILES),
config/mips/littlemips.mh (XDEPFILES),
config/mips/mipsm3.mh (XDEPFILES),
config/ns32k/merlin.mh (XDEPFILES),
config/ns32k/nbsd.mh (NATDEPFILES),
config/ns32k/ns32km3.mh (NATDEPFILES),
config/pa/hppabsd.mh (NATDEPFILES),
config/pa/hppahpux.mh (NATDEPFILES),
config/romp/rtbsd.mh (XDEPFILES),
config/tahoe/tahoe.mh (XDEPFILES),
config/vax/vaxbsd.mh (XDEPFILES),
config/vax/vaxult.mh (NATDEPFILES),
config/vax/vaxult2.mh (NATDEPFILES),
Account for coredep.o to core-aout.o name change.
* config/i386/i386dgux (NATDEPFILES),
config/i386/i386sol2.mh (NATDEPFILES),
config/i386/i386v4.mh (NATDEPFILES),
config/i386/linux.mh (NATDEPFILES),
config/i386/ncr3000.mh (NATDEPFILES),
config/m68k/m68kv4.mh (NATDEPFILES),
config/m88k/delta88v4.mh (NATDEPFILES),
config/mips/mipsv4.mh (NATDEPFILES),
Account for core-svr4.o to core-regset.o name change.
1996-01-12 04:08:15 +08:00
|
|
|
|
void
|
|
|
|
|
_initialize_core_ultra3 ()
|
|
|
|
|
{
|
|
|
|
|
add_core_fns (&ultra3_core_fns);
|
|
|
|
|
}
|