aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog16
-rw-r--r--gdb/config/powerpc/linux.mh4
-rw-r--r--gdb/config/powerpc/linux.mt2
-rw-r--r--gdb/ppc-linux-nat.c23
-rw-r--r--gdb/ppc-linux-tdep.c83
-rw-r--r--gdb/ppc-tdep.h2
6 files changed, 106 insertions, 24 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 48dc32f..a3d2047 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,21 @@
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.
2002-07-30 Andrew Cagney <ac131313@redhat.com>
diff --git a/gdb/config/powerpc/linux.mh b/gdb/config/powerpc/linux.mh
index 0e3c2a6..d0a2104 100644
--- a/gdb/config/powerpc/linux.mh
+++ b/gdb/config/powerpc/linux.mh
@@ -4,8 +4,8 @@ XM_FILE= xm-linux.h
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
diff --git a/gdb/config/powerpc/linux.mt b/gdb/config/powerpc/linux.mt
index a1d08c2..1fb6fd8 100644
--- a/gdb/config/powerpc/linux.mt
+++ b/gdb/config/powerpc/linux.mt
@@ -1,6 +1,6 @@
# 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
diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c
index 25616c0..721e05f 100644
--- a/gdb/ppc-linux-nat.c
+++ b/gdb/ppc-linux-nat.c
@@ -475,21 +475,7 @@ store_inferior_registers (int regno)
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
@@ -525,12 +511,7 @@ fill_gregset (gdb_gregset_t *gregsetp, int regno)
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
diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c
index 1a88d40..6adfe29 100644
--- a/gdb/ppc-linux-tdep.c
+++ b/gdb/ppc-linux-tdep.c
@@ -600,6 +600,88 @@ ppc_linux_svr4_fetch_link_map_offsets (void)
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)
@@ -639,4 +721,5 @@ _initialize_ppc_linux_tdep (void)
{
gdbarch_register_osabi (bfd_arch_powerpc, GDB_OSABI_LINUX,
ppc_linux_init_abi);
+ add_core_fns (&ppc_linux_regset_core_fns);
}
diff --git a/gdb/ppc-tdep.h b/gdb/ppc-tdep.h
index 2f40742..3bd741d 100644
--- a/gdb/ppc-tdep.h
+++ b/gdb/ppc-tdep.h
@@ -39,6 +39,8 @@ CORE_ADDR ppc_sysv_abi_push_arguments (int, struct value **, CORE_ADDR, int,
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... */