convex-xdep.c
copying.awk
copying.c
+core-aout.c
+core-regset.c
core-sol2.c
-core-svr4.c
corefile.c
-coredep.c
corelow.c
cp-valprint.c
cpu32bug-rom.c
+Wed Jan 10 11:25:37 1996 Fred Fish <fnf@cygnus.com>
+
+ * 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.
+
Wed Jan 10 16:08:49 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
* configure.in, configure: Recognize rs6000-*-aix4*.
a29k-tdep.c a68v-nat.c alpha-nat.c alpha-tdep.c \
altos-xdep.c arm-convert.s \
arm-tdep.c arm-xdep.c coff-solib.c \
- convex-tdep.c \
- convex-xdep.c core-sol2.c core-svr4.c coredep.c corelow.c dcache.c \
- delta68-nat.c dpx2-nat.c dstread.c exec.c fork-child.c \
+ convex-tdep.c convex-xdep.c \
+ core-sol2.c core-regset.c core-aout.c corelow.c \
+ dcache.c delta68-nat.c dpx2-nat.c dstread.c exec.c fork-child.c \
go32-xdep.c gould-tdep.c gould-xdep.c h8300-tdep.c h8500-tdep.c \
hp300ux-nat.c hppa-tdep.c hppab-nat.c hppah-nat.c \
hpread.c \
copying.o: copying.c $(defs_h) $(gdbcmd_h)
+core-aout.o: core-aout.c $(defs_h) $(gdbcore_h) $(value_h) $(inferior_h)
+
core-sol2.o: core-sol2.c $(command_h) $(defs_h) $(gdbcore_h) \
$(inferior_h) target.h
-core-svr4.o: core-svr4.c $(command_h) $(defs_h) $(gdbcore_h) \
+core-regset.o: core-regset.c $(command_h) $(defs_h) $(gdbcore_h) \
$(inferior_h) target.h
corefile.o: corefile.c $(dis-asm_h) $(defs_h) $(gdbcmd_h) $(gdbcore_h) \
$(inferior_h) target.h language.h
-coredep.o: coredep.c $(defs_h) $(gdbcore_h) $(value_h) $(inferior_h)
-
corelow.o: corelow.c $(command_h) $(defs_h) $(gdbcore_h) $(inferior_h) \
target.h thread.h
Perhaps "i source" should take an argument like that of "list".
-See if coredep.c's fetch_core_registers can be used on more machines.
+See if core-aout.c's fetch_core_registers can be used on more machines.
E.g. MIPS (mips-xdep.c).
unpack_double() does not handle IEEE float on the target unless the host
(PTRACE_ARG3_TYPE) &inferior_control_registers,
ptrace_$control_set_m68k);
}
-
-/* Apollos don't dump cores */
-void
-fetch_core_registers (core_reg_sect, core_reg_size, which)
- char *core_reg_sect;
- unsigned core_reg_size;
- int which;
-{
-}
Original upage address X is at location core_reg_sect+x+reg_addr.
*/
-void
+static void
fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
char *core_reg_sect;
unsigned core_reg_size;
}
}
#endif
+
+\f
+/* Register that we are able to handle alpha core file formats. */
+
+static struct core_fns alpha_core_fns =
+{
+ bfd_target_aout_flavour,
+ fetch_core_registers,
+ NULL
+};
+
+void
+_initialize_core_alpha ()
+{
+ add_core_fns (&alpha_core_fns);
+}
XDEPFILES=
NAT_FILE= nm-i386bsd.h
-NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o coredep.o i386b-nat.o
+NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o core-aout.o i386b-nat.o
XM_CLIBS= -lsocket -lnsl
NAT_FILE= nm-i386v4.h
-NATDEPFILES= corelow.o core-svr4.o solib.o procfs.o fork-child.o i386v4-nat.o
+NATDEPFILES= corelow.o core-regset.o solib.o procfs.o fork-child.o i386v4-nat.o
# SVR4 comes standard with terminfo, and in some implementations, the
# old termcap descriptions are incomplete. So ensure that we use the
# Host: Intel 386 running Mach3
-XDEPFILES= i387-tdep.o coredep.o
+XDEPFILES= i387-tdep.o core-aout.o
NATDEPFILES= i386m3-nat.o m3-nat.o fork-child.o
NAT_CLIBS= -lmachid -lnetname -lmach
XM_FILE= xm-i386m3.h
XM_CLIBS= -lPW
NAT_FILE= nm-i386v.h
-NATDEPFILES= infptrace.o inftarg.o fork-child.o coredep.o corelow.o i386v-nat.o
+NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o core-aout.o i386v-nat.o
# Host: Intel 386 running NetBSD
XDEPFILES=
-NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o coredep.o i386b-nat.o
+NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o core-aout.o i386b-nat.o
XM_FILE= xm-nbsd.h
NAT_FILE= nm-nbsd.h
# Host: Sequent Symmetry running ptx 1.3, with Weitek 1167 or i387
XM_FILE= xm-ptx.h
-XDEPFILES= inftarg.o fork-child.o symm-nat.o corelow.o coredep.o
+XDEPFILES= inftarg.o fork-child.o symm-nat.o corelow.o core-aout.o
XM_CLIBS= -lPW -lseq
NAT_FILE= nm-symmetry.h
# Host: Sequent Symmetry running ptx 1.3, with Weitek 1167 or i387
XM_FILE= xm-ptx4.h
-XDEPFILES= inftarg.o fork-child.o symm-nat.o corelow.o coredep.o solib.o core-svr4.o
+XDEPFILES= inftarg.o fork-child.o symm-nat.o corelow.o core-aout.o solib.o core-regset.o
XM_CLIBS= -lseq
NAT_FILE= nm-ptx4.h
XDEPFILES=
XM_FILE= xm-symmetry.h
NAT_FILE= nm-symmetry.h
-NATDEPFILES= inftarg.o fork-child.o coredep.o corelow.o symm-nat.o
+NATDEPFILES= inftarg.o fork-child.o corelow.o core-aout.o symm-nat.o
# know what works and what fails on the 3B1.
#PINSN_CC= cc
-XDEPFILES= infptrace.o inftarg.o fork-child.o coredep.o corelow.o
+XDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o core-aout.o
XM_FILE= xm-3b1.h
XM_FILE= xm-delta68.h
NAT_FILE= nm-delta68.h
-NATDEPFILES= infptrace.o inftarg.o fork-child.o coredep.o corelow.o delta68-nat.o
+NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o core-aout.o delta68-nat.o
XDEPFILES=
NAT_FILE= nm-dpx2.h
-NATDEPFILES= infptrace.o coredep.o corelow.o inftarg.o dpx2-nat.o fork-child.o
+NATDEPFILES= infptrace.o corelow.o core-aout.o inftarg.o dpx2-nat.o fork-child.o
TERMCAP=-lcurses
XDEPFILES=
NAT_FILE= nm-hp300bsd.h
-NATDEPFILES= infptrace.o inftarg.o fork-child.o coredep.o corelow.o
+NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o core-aout.o
XM_FILE= xm-hp300hpux.h
NAT_FILE= nm-hp300hpux.h
-NATDEPFILES= infptrace.o inftarg.o fork-child.o hp300ux-nat.o coredep.o corelow.o
+NATDEPFILES= infptrace.o inftarg.o fork-child.o hp300ux-nat.o corelow.o core-aout.o
# Host: ISI Optimum V (3.05) under 4.3bsd.
# corelow.o commented out because core dumps are broken on this machine,
# as of GDB 4.8, according to lam@tfs.com
-XDEPFILES= infptrace.o inftarg.o fork-child.o coredep.o isi-xdep.o
+XDEPFILES= infptrace.o inftarg.o fork-child.o core-aout.o isi-xdep.o
XM_FILE= xm-isi.h
XDEPFILES=
NAT_FILE= nm-sysv4.h
-NATDEPFILES= corelow.o core-svr4.o solib.o procfs.o fork-child.o
+NATDEPFILES= corelow.o core-regset.o solib.o procfs.o fork-child.o
# SVR4 comes standard with terminfo, and in some implementations, the
# old termcap descriptions are incomplete. So ensure that we use the
XDEPFILES= news-xdep.o
XM_FILE= xm-news.h
NAT_FILE= nm-news.h
-NATDEPFILES= inftarg.o fork-child.o coredep.o corelow.o infptrace.o
+NATDEPFILES= inftarg.o fork-child.o corelow.o core-aout.o infptrace.o
# Host: Sony news series 1000 (68030) running NewsOS version 3.
-XDEPFILES= infptrace.o inftarg.o fork-child.o coredep.o corelow.o news-xdep.o
+XDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o core-aout.o news-xdep.o
XM_FILE= xm-news1000.h
XDEPFILES=
NAT_FILE= nm-cxux.h
-NATDEPFILES= infptrace.o inftarg.o fork-child.o cxux-nat.o corelow.o coredep.o
+NATDEPFILES= infptrace.o inftarg.o fork-child.o cxux-nat.o corelow.o core-aout.o
MMALLOC=
MMALLOC_DISABLE= -DNO_MMALLOC
XDEPFILES=
NAT_FILE= nm-m88k.h
-NATDEPFILES= infptrace.o inftarg.o fork-child.o m88k-nat.o \
- corelow.o coredep.o
+NATDEPFILES= infptrace.o inftarg.o fork-child.o m88k-nat.o corelow.o core-aout.o
XDEPFILES=
NAT_FILE= nm-delta88v4.h
-NATDEPFILES= fork-child.o m88k-nat.o corelow.o \
- core-svr4.o procfs.o solib.o
+NATDEPFILES= fork-child.o m88k-nat.o corelow.o core-regset.o procfs.o solib.o
# Host: Little-endian MIPS machine such as DECstation.
-XDEPFILES= infptrace.o inftarg.o fork-child.o coredep.o corelow.o
+XDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o core-aout.o
XM_FILE= xm-mips.h
# Host: Little endian MIPS machine such as pmax
# running Mach 3.0 operating system
-XDEPFILES= coredep.o
+XDEPFILES= core-aout.o
NATDEPFILES= mipsm3-nat.o m3-nat.o
XM_FILE= xm-mipsm3.h
NAT_FILE= ../nm-m3.h
# Host: Mips running SVR4
XM_FILE= xm-mipsv4.h
NAT_FILE= ../nm-sysv4.h
-NATDEPFILES= fork-child.o procfs.o mipsv4-nat.o corelow.o core-svr4.o solib.o
+NATDEPFILES= fork-child.o procfs.o mipsv4-nat.o corelow.o core-regset.o solib.o
# Host: Merlin running utek 2.1
-XDEPFILES= infptrace.o inftarg.o fork-child.o coredep.o corelow.o
+XDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o core-aout.o
XM_FILE= xm-merlin.h
# FIXME: M_INSTALL is gone from the gdb makefile. If anyone cares
# Host: PC532 running NetBSD
XM_FILE= xm-nbsd.h
NAT_FILE= nm-nbsd.h
-NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o coredep.o ns32k-nat.o
+NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o core-aout.o ns32k-nat.o
# Host: ns32k running Mach3
XDEPFILES=
-NATDEPFILES= m3-nat.o ns32km3-nat.o fork-child.o coredep.o corelow.o
+NATDEPFILES= m3-nat.o ns32km3-nat.o fork-child.o corelow.o core-aout.o
NAT_CLIBS= -L/usr/mach/lib -lnetname -lmachid -lmach
XM_FILE= xm-ns32km3.h
NAT_FILE= nm-m3.h
XDEPFILES= ser-tcp.o
XM_FILE= xm-hppab.h
NAT_FILE= nm-hppab.h
-NATDEPFILES= hppab-nat.o coredep.o corelow.o inftarg.o fork-child.o somread.o infptrace.o hpread.o somsolib.o
+NATDEPFILES= hppab-nat.o corelow.o core-aout.o inftarg.o fork-child.o somread.o infptrace.o hpread.o somsolib.o
GDBSERVER_DEPFILES= low-hppabsd.o
XDEPFILES= ser-tcp.o
NAT_FILE= nm-hppah.h
-NATDEPFILES= hppah-nat.o coredep.o corelow.o inftarg.o fork-child.o somread.o infptrace.o hpread.o somsolib.o
+NATDEPFILES= hppah-nat.o corelow.o core-aout.o inftarg.o fork-child.o somread.o infptrace.o hpread.o somsolib.o
HOST_IPC=-DBSD_IPC -DPOSIX_WAIT
#msg (but see comments in Makefile.dist about compiling with gcc).
XM_FILE= xm-vaxbsd.h
-XDEPFILES= infptrace.o inftarg.o fork-child.o coredep.o corelow.o
+XDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o core-aout.o
NAT_FILE= nm-vax.h
XDEPFILES=
NAT_FILE= nm-vax.h
-NATDEPFILES= infptrace.o inftarg.o fork-child.o coredep.o corelow.o
+NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o core-aout.o
XDEPFILES=
NAT_FILE= nm-vax.h
-NATDEPFILES= infptrace.o inftarg.o fork-child.o coredep.o corelow.o
+NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o core-aout.o
--- /dev/null
+/* Extract registers from a "standard" core file, for GDB.
+ Copyright (C) 1988-1995 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. */
+
+/* Typically used on systems that have a.out format executables.
+ corefile.c is supposed to contain the more machine-independent
+ aspects of reading registers from core files, while this file is
+ more machine specific. */
+
+#include "defs.h"
+#include <sys/types.h>
+#include <sys/param.h>
+#include "gdbcore.h"
+#include "value.h" /* For supply_register. */
+#include "inferior.h" /* For ARCH_NUM_REGS. */
+
+/* These are needed on various systems to expand REGISTER_U_ADDR. */
+#ifndef USG
+#include <sys/dir.h>
+#include <sys/file.h>
+#include "gdb_stat.h"
+#include <sys/user.h>
+#ifndef NO_PTRACE_H
+# ifdef PTRACE_IN_WRONG_PLACE
+# include <ptrace.h>
+# else /* !PTRACE_IN_WRONG_PLACE */
+# include <sys/ptrace.h>
+# endif /* !PTRACE_IN_WRONG_PLACE */
+#endif /* NO_PTRACE_H */
+#endif
+
+#ifndef CORE_REGISTER_ADDR
+#define CORE_REGISTER_ADDR(regno, regptr) register_addr(regno, regptr)
+#endif /* CORE_REGISTER_ADDR */
+
+#ifdef NEED_SYS_CORE_H
+#include <sys/core.h>
+#endif
+
+/* Extract the register values out of the core file and store
+ them where `read_register' will find them.
+
+ CORE_REG_SECT points to the register values themselves, read into memory.
+ CORE_REG_SIZE is the size of that area.
+ WHICH says which set of registers we are handling (0 = int, 2 = float
+ on machines where they are discontiguous).
+ REG_ADDR is the offset from u.u_ar0 to the register values relative to
+ core_reg_sect. This is used with old-fashioned core files to
+ locate the registers in a large upage-plus-stack ".reg" section.
+ Original upage address X is at location core_reg_sect+x+reg_addr.
+ */
+
+static void
+fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
+ char *core_reg_sect;
+ unsigned core_reg_size;
+ int which;
+ unsigned reg_addr;
+{
+ register int regno;
+ register unsigned int addr;
+ int bad_reg = -1;
+ register reg_ptr = -reg_addr; /* Original u.u_ar0 is -reg_addr. */
+ int numregs = ARCH_NUM_REGS;
+
+ /* If u.u_ar0 was an absolute address in the core file, relativize it now,
+ so we can use it as an offset into core_reg_sect. When we're done,
+ "register 0" will be at core_reg_sect+reg_ptr, and we can use
+ CORE_REGISTER_ADDR to offset to the other registers. If this is a modern
+ core file without a upage, reg_ptr will be zero and this is all a big
+ NOP. */
+ if (reg_ptr > core_reg_size)
+ reg_ptr -= KERNEL_U_ADDR;
+
+ for (regno = 0; regno < numregs; regno++)
+ {
+ addr = CORE_REGISTER_ADDR (regno, reg_ptr);
+ if (addr >= core_reg_size) {
+ if (bad_reg < 0)
+ bad_reg = regno;
+ } else {
+ supply_register (regno, core_reg_sect + addr);
+ }
+ }
+ if (bad_reg >= 0)
+ {
+ error ("Register %s not found in core file.", reg_names[bad_reg]);
+ }
+}
+
+
+#ifdef REGISTER_U_ADDR
+
+/* Return the address in the core dump or inferior of register REGNO.
+ BLOCKEND is the address of the end of the user structure. */
+
+unsigned int
+register_addr (regno, blockend)
+ int regno;
+ int blockend;
+{
+ int addr;
+
+ if (regno < 0 || regno >= ARCH_NUM_REGS)
+ error ("Invalid register number %d.", regno);
+
+ REGISTER_U_ADDR (addr, blockend, regno);
+
+ return addr;
+}
+
+#endif /* REGISTER_U_ADDR */
+
+\f
+/* Register that we are able to handle aout (trad-core) file formats. */
+
+static struct core_fns aout_core_fns =
+{
+ bfd_target_unknown_flavour,
+ fetch_core_registers,
+ NULL
+};
+
+void
+_initialize_core_aout ()
+{
+ add_core_fns (&aout_core_fns);
+}
--- /dev/null
+/* Machine independent GDB support for core files on systems using "regsets".
+ Copyright 1993-1996 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. */
+
+
+/* N O T E S
+
+This file is used by most systems that implement /proc. For these systems,
+the general registers are laid out the same way in both the core file and
+the gregset_p structure. The current exception to this is Irix-4.*, where
+the gregset_p structure is split up into two pieces in the core file.
+
+The general register and floating point register sets are manipulated by
+separate ioctl's. This file makes the assumption that if FP0_REGNUM is
+defined, then support for the floating point register set is desired,
+regardless of whether or not the actual target has floating point hardware.
+
+ */
+
+#include "defs.h"
+
+#include <time.h>
+#include <sys/procfs.h>
+#include <fcntl.h>
+#include <errno.h>
+#include "gdb_string.h"
+
+#include "inferior.h"
+#include "target.h"
+#include "command.h"
+#include "gdbcore.h"
+
+/*
+
+GLOBAL FUNCTION
+
+ fetch_core_registers -- fetch current registers from core file
+
+SYNOPSIS
+
+ void fetch_core_registers (char *core_reg_sect,
+ unsigned core_reg_size,
+ int which, unsigned in reg_addr)
+
+DESCRIPTION
+
+ Read the values of either the general register set (WHICH equals 0)
+ or the floating point register set (WHICH equals 2) from the core
+ file data (pointed to by CORE_REG_SECT), and update gdb's idea of
+ their current values. The CORE_REG_SIZE parameter is ignored.
+
+NOTES
+
+ Use the indicated sizes to validate the gregset and fpregset
+ structures.
+*/
+
+static void
+fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
+ char *core_reg_sect;
+ unsigned core_reg_size;
+ int which;
+ unsigned int reg_addr; /* Unused in this version */
+{
+ gregset_t gregset;
+ fpregset_t fpregset;
+
+ if (which == 0)
+ {
+ if (core_reg_size != sizeof (gregset))
+ {
+ warning ("wrong size gregset struct in core file");
+ }
+ else
+ {
+ memcpy ((char *) &gregset, core_reg_sect, sizeof (gregset));
+ supply_gregset (&gregset);
+ }
+ }
+ else if (which == 2)
+ {
+ if (core_reg_size != sizeof (fpregset))
+ {
+ warning ("wrong size fpregset struct in core file");
+ }
+ else
+ {
+ memcpy ((char *) &fpregset, core_reg_sect, sizeof (fpregset));
+#if defined (FP0_REGNUM)
+ supply_fpregset (&fpregset);
+#endif
+ }
+ }
+}
+
+\f
+/* Register that we are able to handle ELF file formats using standard
+ procfs "regset" structures. */
+
+static struct core_fns regset_core_fns =
+{
+ bfd_target_elf_flavour,
+ fetch_core_registers,
+ NULL
+};
+
+void
+_initialize_core_regset ()
+{
+ add_core_fns (®set_core_fns);
+}
an ELF executable and cores generated by programs that were
run under BCP (the part of Solaris which allows it to run SunOS4
a.out files).
- This file combines the core register fetching from core-svr4.c
+ This file combines the core register fetching from core-regset.c
and sparc-nat.c to be able to read both flavours. */
#include "defs.h"
#include "command.h"
#include "gdbcore.h"
-void
+static void
fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
char *core_reg_sect;
unsigned core_reg_size;
}
}
}
+
+\f
+/* Register that we are able to handle solaris core file formats. */
+
+static struct core_fns solaris_core_fns =
+{
+ bfd_target_elf_flavour,
+ fetch_core_registers,
+ NULL
+};
+
+void
+_initialize_core_solaris ()
+{
+ add_core_fns (&solaris_core_fns);
+}
-/* Machine independent support for SVR4 core files for GDB.
- Copyright 1993 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. */
-
-
-/* N O T E S
-
-This version of fetch_core_registers() is used by most systems that
-implement /proc. For these systems, the general registers are laid out
-the same way in both the core file and the gregset_p structure. The
-current exception to this is Irix-4.*, where the gregset_p structure is
-split up into two pieces in the core file.
-
-The general register and floating point register sets are manipulated by
-separate ioctl's. This file makes the assumption that if FP0_REGNUM is
-defined, then support for the floating point register set is desired,
-regardless of whether or not the actual target has floating point hardware.
-
- */
-
-#include "defs.h"
-
-#include <time.h>
-#include <sys/procfs.h>
-#include <fcntl.h>
-#include <errno.h>
-#include "gdb_string.h"
-
-#include "inferior.h"
-#include "target.h"
-#include "command.h"
-#include "gdbcore.h"
-
-/*
-
-GLOBAL FUNCTION
-
- fetch_core_registers -- fetch current registers from core file data
-
-SYNOPSIS
-
- void fetch_core_registers (char *core_reg_sect, unsigned core_reg_size,
- int which, unsigned in reg_addr)
-
-DESCRIPTION
-
- Read the values of either the general register set (WHICH equals 0)
- or the floating point register set (WHICH equals 2) from the core
- file data (pointed to by CORE_REG_SECT), and update gdb's idea of
- their current values. The CORE_REG_SIZE parameter is ignored.
-
-NOTES
-
- Use the indicated sizes to validate the gregset and fpregset
- structures.
-*/
-
-void
-fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
- char *core_reg_sect;
- unsigned core_reg_size;
- int which;
- unsigned int reg_addr; /* Unused in this version */
-{
- gregset_t gregset;
- fpregset_t fpregset;
-
- if (which == 0)
- {
- if (core_reg_size != sizeof (gregset))
- {
- warning ("wrong size gregset struct in core file");
- }
- else
- {
- memcpy ((char *) &gregset, core_reg_sect, sizeof (gregset));
- supply_gregset (&gregset);
- }
- }
- else if (which == 2)
- {
- if (core_reg_size != sizeof (fpregset))
- {
- warning ("wrong size fpregset struct in core file");
- }
- else
- {
- memcpy ((char *) &fpregset, core_reg_sect, sizeof (fpregset));
-#if defined (FP0_REGNUM)
- supply_fpregset (&fpregset);
-#endif
- }
- }
-}
+++ /dev/null
-/* Extract registers from a "standard" core file, for GDB.
- Copyright (C) 1988-1991 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. */
-
-/* corefile.c is supposed to be the more machine-independent aspects of this;
- this file is more machine-specific. */
-
-#include "defs.h"
-#include <sys/types.h>
-#include <sys/param.h>
-#include "gdbcore.h"
-#include "value.h" /* For supply_register. */
-#include "inferior.h" /* For ARCH_NUM_REGS. */
-
-/* These are needed on various systems to expand REGISTER_U_ADDR. */
-#ifndef USG
-#include <sys/dir.h>
-#include <sys/file.h>
-#include "gdb_stat.h"
-#include <sys/user.h>
-#ifndef NO_PTRACE_H
-# ifdef PTRACE_IN_WRONG_PLACE
-# include <ptrace.h>
-# else /* !PTRACE_IN_WRONG_PLACE */
-# include <sys/ptrace.h>
-# endif /* !PTRACE_IN_WRONG_PLACE */
-#endif /* NO_PTRACE_H */
-#endif
-
-#ifndef CORE_REGISTER_ADDR
-#define CORE_REGISTER_ADDR(regno, regptr) register_addr(regno, regptr)
-#endif /* CORE_REGISTER_ADDR */
-
-#ifdef NEED_SYS_CORE_H
-#include <sys/core.h>
-#endif
-
-/* Extract the register values out of the core file and store
- them where `read_register' will find them.
-
- CORE_REG_SECT points to the register values themselves, read into memory.
- CORE_REG_SIZE is the size of that area.
- WHICH says which set of registers we are handling (0 = int, 2 = float
- on machines where they are discontiguous).
- REG_ADDR is the offset from u.u_ar0 to the register values relative to
- core_reg_sect. This is used with old-fashioned core files to
- locate the registers in a large upage-plus-stack ".reg" section.
- Original upage address X is at location core_reg_sect+x+reg_addr.
- */
-
-void
-fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
- char *core_reg_sect;
- unsigned core_reg_size;
- int which;
- unsigned reg_addr;
-{
- register int regno;
- register unsigned int addr;
- int bad_reg = -1;
- register reg_ptr = -reg_addr; /* Original u.u_ar0 is -reg_addr. */
- int numregs = ARCH_NUM_REGS;
-
- /* If u.u_ar0 was an absolute address in the core file, relativize it now,
- so we can use it as an offset into core_reg_sect. When we're done,
- "register 0" will be at core_reg_sect+reg_ptr, and we can use
- CORE_REGISTER_ADDR to offset to the other registers. If this is a modern
- core file without a upage, reg_ptr will be zero and this is all a big
- NOP. */
- if (reg_ptr > core_reg_size)
- reg_ptr -= KERNEL_U_ADDR;
-
- for (regno = 0; regno < numregs; regno++)
- {
- addr = CORE_REGISTER_ADDR (regno, reg_ptr);
- if (addr >= core_reg_size) {
- if (bad_reg < 0)
- bad_reg = regno;
- } else {
- supply_register (regno, core_reg_sect + addr);
- }
- }
- if (bad_reg >= 0)
- {
- error ("Register %s not found in core file.", reg_names[bad_reg]);
- }
-}
-
-
-#ifdef REGISTER_U_ADDR
-
-/* Return the address in the core dump or inferior of register REGNO.
- BLOCKEND is the address of the end of the user structure. */
-
-unsigned int
-register_addr (regno, blockend)
- int regno;
- int blockend;
-{
- int addr;
-
- if (regno < 0 || regno >= ARCH_NUM_REGS)
- error ("Invalid register number %d.", regno);
-
- REGISTER_U_ADDR (addr, blockend, regno);
-
- return addr;
-}
-
-#endif /* REGISTER_U_ADDR */
#include "gdbcore.h"
#include "thread.h"
+/* List of all available core_fns. On gdb startup, each core file register
+ reader calls add_core_fns() to register information on each core format it
+ is prepared to read. */
+
+static struct core_fns *core_file_fns = NULL;
+
static void core_files_info PARAMS ((struct target_ops *));
#ifdef SOLIB_ADD
static void get_core_registers PARAMS ((int));
+/* Link a new core_fns into the global core_file_fns list. Called on gdb
+ startup by the _initialize routine in each core file register reader, to
+ register information about each format the the reader is prepared to
+ handle. */
+
+void
+add_core_fns (cf)
+ struct core_fns *cf;
+{
+ cf -> next = core_file_fns;
+ core_file_fns = cf;
+}
+
+
/* Discard all vestiges of any previous core file and mark data and stack
spaces as empty. */
unsigned size;
char *the_regs;
char secname[10];
+ enum bfd_flavour our_flavour = bfd_get_flavour (core_bfd);
+ struct core_fns *cf;
+
+ if (core_file_fns == NULL)
+ {
+ fprintf_filtered (gdb_stderr,
+ "Can't fetch registers from this type of core file\n");
+ return;
+ }
/* Thread support. If inferior_pid is non-zero, then we have found a core
file with threads (or multiple processes). In that case, we need to
goto cant;
size = bfd_section_size (core_bfd, reg_sec);
the_regs = alloca (size);
- if (bfd_get_section_contents (core_bfd, reg_sec, the_regs, (file_ptr)0, size))
+ /* Look for the core functions that match this flavor. Default to the
+ first one if nothing matches. */
+ for (cf = core_file_fns; cf != NULL; cf = cf -> next)
+ {
+ if (our_flavour == cf -> core_flavour)
+ {
+ break;
+ }
+ }
+ if (cf == NULL)
+ {
+ cf = core_file_fns;
+ }
+ if (cf != NULL &&
+ bfd_get_section_contents (core_bfd, reg_sec, the_regs, (file_ptr)0, size) &&
+ cf -> core_read_registers != NULL)
{
- fetch_core_registers (the_regs, size, 0,
- (unsigned) bfd_section_vma (abfd,reg_sec));
+ (cf -> core_read_registers (the_regs, size, 0,
+ (unsigned) bfd_section_vma (abfd,reg_sec)));
}
else
{
{
size = bfd_section_size (core_bfd, reg_sec);
the_regs = alloca (size);
- if (bfd_get_section_contents (core_bfd, reg_sec, the_regs, (file_ptr)0,
- size))
+ if (cf != NULL &&
+ bfd_get_section_contents (core_bfd, reg_sec, the_regs, (file_ptr)0, size) &&
+ cf -> core_read_registers != NULL)
{
- fetch_core_registers (the_regs, size, 2,
- (unsigned) bfd_section_vma (abfd,reg_sec));
+ (cf -> core_read_registers (the_regs, size, 2,
+ (unsigned) bfd_section_vma (abfd,reg_sec)));
}
else
{
+Wed Jan 10 14:16:37 1996 Fred Fish <fnf@fishpond.amigalib.com>
+
+ * gdbint.texinfo (Native): Document name change, coredep.c to
+ core-aout.c.
+
Wed Dec 13 12:35:28 1995 Ian Lance Taylor <ian@cygnus.com>
* stabs.texinfo (Include Files): Document the values the SunOS4
#define e_PC e_regs[PC]
#endif /* HPUX_VERSION_5 */
-void
+static void
fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
char *core_reg_sect;
unsigned int core_reg_size;
{
return 4096;
}
+
+\f
+/* Register that we are able to handle hp300ux core file formats.
+ FIXME: is this really bfd_target_unknown_flavour? */
+
+static struct core_fns hp300ux_core_fns =
+{
+ bfd_target_unknown_flavour,
+ fetch_core_registers,
+ NULL
+};
+
+void
+_initialize_core_hp300ux ()
+{
+ add_core_fns (&hp300ux_core_fns);
+}
CD_DS, CD_ES, CD_FS, CD_GS,
};
-void
+static void
fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
char *core_reg_sect;
unsigned core_reg_size;
fprintf_unfiltered (gdb_stderr, "Couldn't read float regs from core file\n");
}
}
+
+\f
+/* Register that we are able to handle i386aix core file formats.
+ FIXME: is this really bfd_target_unknown_flavour? */
+
+static struct core_fns i386aix_core_fns =
+{
+ bfd_target_unknown_flavour,
+ fetch_core_registers,
+ NULL
+};
+
+void
+_initialize_core_i386aix ()
+{
+ add_core_fns (&i386aix_core_fns);
+}
* core file. If your UX does something else, adapt the routine
* below to return the offset to the given register.
*
- * Called by coredep.c(fetch_core_registers)
+ * Called by core-aout.c(fetch_core_registers)
*/
unsigned int
/* Work with core files, for GDB. */
-void
+static void
fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
char *core_reg_sect;
unsigned core_reg_size;
break;
}
}
+
+\f
+/* Register that we are able to handle i386mach core file formats.
+ FIXME: is this really bfd_target_unknown_flavour? */
+
+static struct core_fns i386mach_core_fns =
+{
+ bfd_target_unknown_flavour,
+ fetch_core_registers,
+ NULL
+};
+
+void
+_initialize_core_i386mach ()
+{
+ add_core_fns (&i386mach_core_fns);
+}
return 1;
}
-void
+static void
fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
char *core_reg_sect;
unsigned core_reg_size;
memcpy ((char *)registers, core_reg_sect, core_reg_size);
}
+
+\f
+/* Register that we are able to handle irix4 core file formats.
+ FIXME: is this really bfd_target_unknown_flavour? */
+
+static struct core_fns irix4_core_fns =
+{
+ bfd_target_unknown_flavour,
+ fetch_core_registers,
+ NULL
+};
+
+void
+_initialize_core_irix4 ()
+{
+ add_core_fns (&irix4_core_fns);
+}
return 1;
}
-void
+static void
fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
char *core_reg_sect;
unsigned core_reg_size;
&setlist),
&showlist);
}
+
+\f
+/* Register that we are able to handle irix5 core file formats.
+ This really is bfd_target_unknown_flavour */
+
+static struct core_fns irix5_core_fns =
+{
+ bfd_target_unknown_flavour,
+ fetch_core_registers,
+ NULL
+};
+
+void
+_initialize_core_irix5 ()
+{
+ add_core_fns (&irix5_core_fns);
+}
Original upage address X is at location core_reg_sect+x+reg_addr.
*/
-void
+static void
fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
char *core_reg_sect;
unsigned core_reg_size;
fetch_inferior_registers (I0_REGNUM);
#endif
}
+
+\f
+/* Register that we are able to handle lynx core file formats.
+ FIXME: is this really bfd_target_unknown_flavour? */
+
+static struct core_fns lynx_core_fns =
+{
+ bfd_target_unknown_flavour,
+ fetch_core_registers,
+ NULL
+};
+
+void
+_initialize_core_lynx ()
+{
+ add_core_fns (&lynx_core_fns);
+}
Original upage address X is at location core_reg_sect+x+reg_addr.
*/
-void
+static void
fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
char *core_reg_sect;
unsigned core_reg_size;
return addr;
}
+
+\f
+/* Register that we are able to handle mips core file formats.
+ FIXME: is this really bfd_target_unknown_flavour? */
+
+static struct core_fns mips_core_fns =
+{
+ bfd_target_unknown_flavour,
+ fetch_core_registers,
+ NULL
+};
+
+void
+_initialize_core_mips ()
+{
+ add_core_fns (&mips_core_fns);
+}
®isters[REGISTER_BYTE (regnum)], \
count*REGISTER_SIZE)
\f
-/* 4.4 bfd support function */
-/* jtv@hut.fi: UNIMPLEMENTED!!!!! */
-
-void
-fetch_core_registers (core_regs, core_reg_size, which)
- char *core_regs;
- unsigned int core_reg_size;
- int which;
-{
- error ("Unimplemented routine fetch_core_registers called");
-}
-\f
/*
* Fetch inferiors registers for gdb.
* REGNO specifies which (as gdb views it) register, -1 for all.
target_remove_breakpoint (DUMMY_INSN_ADDR, shadow_contents);
}
-void
+static void
fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
char *core_reg_sect;
unsigned core_reg_size;
return (sizeof (struct user));
}
+\f
+/* Register that we are able to handle rs6000 core file formats. */
+
+static struct core_fns rs6000_core_fns =
+{
+ bfd_target_coff_flavour,
+ fetch_core_registers,
+ NULL
+};
+
+void
+_initialize_core_rs6000 ()
+{
+ add_core_fns (&rs6000_core_fns);
+}
}
-void
+static void
fetch_core_registers (core_reg_sect, core_reg_size, which, ignore)
char *core_reg_sect;
unsigned core_reg_size;
{
return (sizeof (struct user));
}
+
+\f
+/* Register that we are able to handle sparc core file formats.
+ FIXME: is this really bfd_target_unknown_flavour? */
+
+static struct core_fns sparc_core_fns =
+{
+ bfd_target_unknown_flavour,
+ fetch_core_registers,
+ NULL
+};
+
+void
+_initialize_core_sparc ()
+{
+ add_core_fns (&sparc_core_fns);
+}
/* All of this stuff is only relevant if both host and target are sun3. */
/* Machine-dependent code for pulling registers out of a Sun-3 core file. */
-void
+static void
fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
char *core_reg_sect;
unsigned core_reg_size;
fprintf_unfiltered (gdb_stderr, "Couldn't read float regs from core file\n");
}
}
+
+\f
+/* Register that we are able to handle sun3 core file formats.
+ FIXME: is this really bfd_target_unknown_flavour? */
+
+static struct core_fns sun3_core_fns =
+{
+ bfd_target_unknown_flavour,
+ fetch_core_registers,
+ NULL
+};
+
+void
+_initialize_core_sun3 ()
+{
+ add_core_fns (&sun3_core_fns);
+}
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-#if defined (GDB_TARGET_IS_SUN386)
-
#include "defs.h"
#include "frame.h"
#include "inferior.h"
asm ("fstpt (%eax)");
asm ("fwait");
}
-#else /* Not sun386 target. */
-
-/* These functions shouldn't be called when we're cross-debugging. */
-
-/* ARGSUSED */
-void
-fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
- char *core_reg_sect;
- unsigned core_reg_size;
- int which;
- unsigned int reg_addr; /* Unused in this version */
-{
-}
-
-#endif /* Not sun386 target. */
void
fetch_inferior_registers (regno)
ptrace (PTRACE_SETFPREGS, inferior_pid,
(PTRACE_ARG3_TYPE) &inferior_fp_registers);
}
-
* struct ptrace_user is the first thing in the core file
*/
-void
+static void
fetch_core_registers ()
{
register int regno;
}
}
+\f
+/* 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
+};
+void
+_initialize_core_ultra3 ()
+{
+ add_core_fns (&ultra3_core_fns);
+}