(ELF_FPREGSET_SIZE, ELF_GREGSET_SIZE): New enums.
(fetch_core_registers, ppc_linux_supply_gregset)
(ppc_linux_supply_fpregset): New functions.
(ppc_linux_regset_core_fns): New.
(_initialize_ppc_linux_tdep): Call add_core_fns.
* ppc-tdep.h: Add prototypes for ppc_linux_supply_fpregset
and ppc_linux_supply_gregset.
* ppc-linux-nat.c (supply_gregset): Call ppc_linux_supply_gregset.
(supply_fpregset): Call ppc_linux_supply_fpregset.
* config/powerpc/linux.mh (NATDEPFILES): Remove core-regset.o and
corelow.o.
* config/powerpc/linux.mt (TDEPFILES): Add corelow.o.
+2002-07-30 Daniel Jacobowitz <drow@mvista.com>
+
+ * ppc-linux-tdep.c (ELF_NGREG, ELF_NFPREG, ELF_NVRREG)
+ (ELF_FPREGSET_SIZE, ELF_GREGSET_SIZE): New enums.
+ (fetch_core_registers, ppc_linux_supply_gregset)
+ (ppc_linux_supply_fpregset): New functions.
+ (ppc_linux_regset_core_fns): New.
+ (_initialize_ppc_linux_tdep): Call add_core_fns.
+ * ppc-tdep.h: Add prototypes for ppc_linux_supply_fpregset
+ and ppc_linux_supply_gregset.
+ * ppc-linux-nat.c (supply_gregset): Call ppc_linux_supply_gregset.
+ (supply_fpregset): Call ppc_linux_supply_fpregset.
+ * config/powerpc/linux.mh (NATDEPFILES): Remove core-regset.o and
+ corelow.o.
+ * config/powerpc/linux.mt (TDEPFILES): Add corelow.o.
+
2002-07-30 Daniel Jacobowitz <drow@mvista.com>
* symtab.c (lookup_symbol): Demangle before lowercasing.
XM_CLIBS=
NAT_FILE= nm-linux.h
-NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o linux-proc.o \
- core-regset.o ppc-linux-nat.o proc-service.o thread-db.o lin-lwp.o \
+NATDEPFILES= infptrace.o inftarg.o fork-child.o linux-proc.o \
+ ppc-linux-nat.o proc-service.o thread-db.o lin-lwp.o \
gcore.o
LOADLIBES = -ldl -rdynamic
# Target: Motorola PPC on Linux
TDEPFILES= rs6000-tdep.o ppc-linux-tdep.o ppc-sysv-tdep.o solib.o \
- solib-svr4.o solib-legacy.o
+ solib-svr4.o solib-legacy.o corelow.o
TM_FILE= tm-linux.h
SIM_OBS = remote-sim.o
void
supply_gregset (gdb_gregset_t *gregsetp)
{
- int regi;
- register elf_greg_t *regp = (elf_greg_t *) gregsetp;
- struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
-
- for (regi = 0; regi < 32; regi++)
- supply_register (regi, (char *) (regp + regi));
-
- supply_register (PC_REGNUM, (char *) (regp + PT_NIP));
- supply_register (tdep->ppc_lr_regnum, (char *) (regp + PT_LNK));
- supply_register (tdep->ppc_cr_regnum, (char *) (regp + PT_CCR));
- supply_register (tdep->ppc_xer_regnum, (char *) (regp + PT_XER));
- supply_register (tdep->ppc_ctr_regnum, (char *) (regp + PT_CTR));
- if (tdep->ppc_mq_regnum != -1)
- supply_register (tdep->ppc_mq_regnum, (char *) (regp + PT_MQ));
- supply_register (tdep->ppc_ps_regnum, (char *) (regp + PT_MSR));
+ ppc_linux_supply_gregset ((char *) gregsetp);
}
void
void
supply_fpregset (gdb_fpregset_t * fpregsetp)
{
- int regi;
- struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
-
- for (regi = 0; regi < 32; regi++)
- supply_register (FP0_REGNUM + regi, (char *) (*fpregsetp + regi));
- supply_register (tdep->ppc_fpscr_regnum, (char *) (*fpregsetp + 32));
+ ppc_linux_supply_fpregset ((char *) fpregsetp);
}
/* Given a pointer to a floating point register set in /proc format
return lmp;
}
+enum {
+ ELF_NGREG = 48,
+ ELF_NFPREG = 33,
+ ELF_NVRREG = 33
+};
+
+enum {
+ ELF_GREGSET_SIZE = (ELF_NGREG * 4),
+ ELF_FPREGSET_SIZE = (ELF_NFPREG * 8)
+};
+
+void
+ppc_linux_supply_gregset (char *buf)
+{
+ int regi;
+ struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+
+ for (regi = 0; regi < 32; regi++)
+ supply_register (regi, buf + 4 * regi);
+
+ supply_register (PC_REGNUM, buf + 4 * PPC_LINUX_PT_NIP);
+ supply_register (tdep->ppc_lr_regnum, buf + 4 * PPC_LINUX_PT_LNK);
+ supply_register (tdep->ppc_cr_regnum, buf + 4 * PPC_LINUX_PT_CCR);
+ supply_register (tdep->ppc_xer_regnum, buf + 4 * PPC_LINUX_PT_XER);
+ supply_register (tdep->ppc_ctr_regnum, buf + 4 * PPC_LINUX_PT_CTR);
+ if (tdep->ppc_mq_regnum != -1)
+ supply_register (tdep->ppc_mq_regnum, buf + 4 * PPC_LINUX_PT_MQ);
+ supply_register (tdep->ppc_ps_regnum, buf + 4 * PPC_LINUX_PT_MSR);
+}
+
+void
+ppc_linux_supply_fpregset (char *buf)
+{
+ int regi;
+ struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+
+ for (regi = 0; regi < 32; regi++)
+ supply_register (FP0_REGNUM + regi, buf + 8 * regi);
+
+ /* The FPSCR is stored in the low order word of the last doubleword in the
+ fpregset. */
+ supply_register (tdep->ppc_fpscr_regnum, buf + 8 * 32 + 4);
+}
+
+/*
+ Use a local version of this function to get the correct types for regsets.
+*/
+
+static void
+fetch_core_registers (char *core_reg_sect,
+ unsigned core_reg_size,
+ int which,
+ CORE_ADDR reg_addr)
+{
+ if (which == 0)
+ {
+ if (core_reg_size == ELF_GREGSET_SIZE)
+ ppc_linux_supply_gregset (core_reg_sect);
+ else
+ warning ("wrong size gregset struct in core file");
+ }
+ else if (which == 2)
+ {
+ if (core_reg_size == ELF_FPREGSET_SIZE)
+ ppc_linux_supply_fpregset (core_reg_sect);
+ else
+ warning ("wrong size fpregset struct in core file");
+ }
+}
+
+/* Register that we are able to handle ELF file formats using standard
+ procfs "regset" structures. */
+
+static struct core_fns ppc_linux_regset_core_fns =
+{
+ bfd_target_elf_flavour, /* core_flavour */
+ default_check_format, /* check_format */
+ default_core_sniffer, /* core_sniffer */
+ fetch_core_registers, /* core_read_registers */
+ NULL /* next */
+};
+
static void
ppc_linux_init_abi (struct gdbarch_info info,
struct gdbarch *gdbarch)
{
gdbarch_register_osabi (bfd_arch_powerpc, GDB_OSABI_LINUX,
ppc_linux_init_abi);
+ add_core_fns (&ppc_linux_regset_core_fns);
}
CORE_ADDR);
int ppc_linux_memory_remove_breakpoint (CORE_ADDR addr, char *contents_cache);
struct link_map_offsets *ppc_linux_svr4_fetch_link_map_offsets (void);
+void ppc_linux_supply_gregset (char *buf);
+void ppc_linux_supply_fpregset (char *buf);
/* From rs6000-tdep.c... */