summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandolph Chung <tausq@debian.org>2006-03-30 14:27:45 +0000
committerRandolph Chung <tausq@debian.org>2006-03-30 14:27:45 +0000
commit3d8dcac6802ec59fefddb85418d4236011790ef7 (patch)
tree5ae97b1501d2b7f1c7bf44be2b386094cece0429
parent29d375acb527bd5d09aa0a3e1040e632ad94319c (diff)
downloadbinutils-gdb-3d8dcac6802ec59fefddb85418d4236011790ef7.tar.gz
2005-03-30 Randolph Chung <tausq@debian.org>
* hppa-linux-tdep.c: Include regset.h. (GR_REGNUM, TR_REGNUM, greg_map): New. (hppa_linux_supply_regset, hppa_linux_supply_fpregset): New. (hppa_linux_regset, hppa_linux_fpregset): New. (hppa_linux_regset_from_core_section): New. (hppa_linux_init_abi): Set regset_from_core_section. (_initialize_hppa_linux_tdep): Register osabi handler for 64-bit Linux. * Makefile.in (hppa-linux-tdep.o): Update dependencies. * config/pa/linux.mh: Stop using core-regset.o
-rw-r--r--gdb/ChangeLog13
-rw-r--r--gdb/Makefile.in2
-rw-r--r--gdb/config/pa/linux.mh4
-rw-r--r--gdb/hppa-linux-tdep.c111
4 files changed, 127 insertions, 3 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 19609c6fd8f..2d30e2cb7ab 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,16 @@
+2005-03-30 Randolph Chung <tausq@debian.org>
+
+ * hppa-linux-tdep.c: Include regset.h.
+ (GR_REGNUM, TR_REGNUM, greg_map): New.
+ (hppa_linux_supply_regset, hppa_linux_supply_fpregset): New.
+ (hppa_linux_regset, hppa_linux_fpregset): New.
+ (hppa_linux_regset_from_core_section): New.
+ (hppa_linux_init_abi): Set regset_from_core_section.
+ (_initialize_hppa_linux_tdep): Register osabi handler for
+ 64-bit Linux.
+ * Makefile.in (hppa-linux-tdep.o): Update dependencies.
+ * config/pa/linux.mh: Stop using core-regset.o
+
2006-03-30 Randolph Chung <tausq@debian.org>
* hppa-tdep.c (hppa_find_unwind_entry_in_block): New.
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 644e9d9dd8a..a059b8b0c06 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -2033,7 +2033,7 @@ hppa-linux-nat.o: hppa-linux-nat.c $(defs_h) $(gdbcore_h) $(regcache_h) \
hppa-linux-tdep.o: hppa-linux-tdep.c $(defs_h) $(gdbcore_h) $(osabi_h) \
$(target_h) $(objfiles_h) $(solib_svr4_h) $(glibc_tdep_h) \
$(frame_unwind_h) $(trad_frame_h) $(dwarf2_frame_h) $(value_h) \
- $(hppa_tdep_h) $(elf_common_h)
+ $(hppa_tdep_h) $(elf_common_h) $(regset_h)
hppa-tdep.o: hppa-tdep.c $(defs_h) $(bfd_h) $(inferior_h) $(regcache_h) \
$(completer_h) $(osabi_h) $(gdb_assert_h) $(arch_utils_h) \
$(symtab_h) $(dis_asm_h) $(trad_frame_h) $(frame_unwind_h) \
diff --git a/gdb/config/pa/linux.mh b/gdb/config/pa/linux.mh
index b0362e49cc1..8066fff9758 100644
--- a/gdb/config/pa/linux.mh
+++ b/gdb/config/pa/linux.mh
@@ -2,7 +2,7 @@
XDEPFILES=
NAT_FILE= nm-linux.h
NATDEPFILES= inf-ptrace.o fork-child.o corelow.o gcore.o \
- core-regset.o hppa-linux-nat.o \
- proc-service.o linux-thread-db.o linux-nat.o linux-fork.o
+ hppa-linux-nat.o proc-service.o linux-thread-db.o linux-nat.o \
+ linux-fork.o
LOADLIBES = -ldl -rdynamic
diff --git a/gdb/hppa-linux-tdep.c b/gdb/hppa-linux-tdep.c
index 439a6e0f6c5..c5d23f9e02a 100644
--- a/gdb/hppa-linux-tdep.c
+++ b/gdb/hppa-linux-tdep.c
@@ -30,6 +30,7 @@
#include "trad-frame.h"
#include "dwarf2-frame.h"
#include "value.h"
+#include "regset.h"
#include "hppa-tdep.h"
#include "elf/common.h"
@@ -400,6 +401,112 @@ hppa_linux_find_global_pointer (struct value *function)
}
return 0;
}
+
+/*
+ * Registers saved in a coredump:
+ * gr0..gr31
+ * sr0..sr7
+ * iaoq0..iaoq1
+ * iasq0..iasq1
+ * sar, iir, isr, ior, ipsw
+ * cr0, cr24..cr31
+ * cr8,9,12,13
+ * cr10, cr15
+ */
+
+#define GR_REGNUM(_n) (HPPA_R0_REGNUM+_n)
+#define TR_REGNUM(_n) (HPPA_TR0_REGNUM+_n)
+static const int greg_map[] =
+ {
+ GR_REGNUM(0), GR_REGNUM(1), GR_REGNUM(2), GR_REGNUM(3),
+ GR_REGNUM(4), GR_REGNUM(5), GR_REGNUM(6), GR_REGNUM(7),
+ GR_REGNUM(8), GR_REGNUM(9), GR_REGNUM(10), GR_REGNUM(11),
+ GR_REGNUM(12), GR_REGNUM(13), GR_REGNUM(14), GR_REGNUM(15),
+ GR_REGNUM(16), GR_REGNUM(17), GR_REGNUM(18), GR_REGNUM(19),
+ GR_REGNUM(20), GR_REGNUM(21), GR_REGNUM(22), GR_REGNUM(23),
+ GR_REGNUM(24), GR_REGNUM(25), GR_REGNUM(26), GR_REGNUM(27),
+ GR_REGNUM(28), GR_REGNUM(29), GR_REGNUM(30), GR_REGNUM(31),
+
+ HPPA_SR4_REGNUM+1, HPPA_SR4_REGNUM+2, HPPA_SR4_REGNUM+3, HPPA_SR4_REGNUM+4,
+ HPPA_SR4_REGNUM, HPPA_SR4_REGNUM+5, HPPA_SR4_REGNUM+6, HPPA_SR4_REGNUM+7,
+
+ HPPA_PCOQ_HEAD_REGNUM, HPPA_PCOQ_TAIL_REGNUM,
+ HPPA_PCSQ_HEAD_REGNUM, HPPA_PCSQ_TAIL_REGNUM,
+
+ HPPA_SAR_REGNUM, HPPA_IIR_REGNUM, HPPA_ISR_REGNUM, HPPA_IOR_REGNUM,
+ HPPA_IPSW_REGNUM, HPPA_RCR_REGNUM,
+
+ TR_REGNUM(0), TR_REGNUM(1), TR_REGNUM(2), TR_REGNUM(3),
+ TR_REGNUM(4), TR_REGNUM(5), TR_REGNUM(6), TR_REGNUM(7),
+
+ HPPA_PID0_REGNUM, HPPA_PID1_REGNUM, HPPA_PID2_REGNUM, HPPA_PID3_REGNUM,
+ HPPA_CCR_REGNUM, HPPA_EIEM_REGNUM,
+ };
+
+static void
+hppa_linux_supply_regset (const struct regset *regset,
+ struct regcache *regcache,
+ int regnum, const void *regs, size_t len)
+{
+ struct gdbarch *arch = get_regcache_arch (regcache);
+ struct gdbarch_tdep *tdep = gdbarch_tdep (arch);
+ const char *buf = regs;
+ int i, offset;
+
+ offset = 0;
+ for (i = 0; i < ARRAY_SIZE (greg_map); i++)
+ {
+ if (regnum == greg_map[i] || regnum == -1)
+ regcache_raw_supply (regcache, greg_map[i], buf + offset);
+
+ offset += tdep->bytes_per_address;
+ }
+}
+
+static void
+hppa_linux_supply_fpregset (const struct regset *regset,
+ struct regcache *regcache,
+ int regnum, const void *regs, size_t len)
+{
+ const char *buf = regs;
+ int i, offset;
+
+ offset = 0;
+ for (i = 0; i < 31; i++)
+ {
+ if (regnum == HPPA_FP0_REGNUM + i || regnum == -1)
+ regcache_raw_supply (regcache, HPPA_FP0_REGNUM + i,
+ buf + offset);
+ offset += 8;
+ }
+}
+
+/* Linux register set. */
+static struct regset hppa_linux_regset =
+{
+ NULL,
+ hppa_linux_supply_regset
+};
+
+static struct regset hppa_linux_fpregset =
+{
+ NULL,
+ hppa_linux_supply_fpregset
+};
+
+static const struct regset *
+hppa_linux_regset_from_core_section (struct gdbarch *gdbarch,
+ const char *sect_name,
+ size_t sect_size)
+{
+ if (strcmp (sect_name, ".reg") == 0)
+ return &hppa_linux_regset;
+ else if (strcmp (sect_name, ".reg2") == 0)
+ return &hppa_linux_fpregset;
+
+ return NULL;
+}
+
/* Forward declarations. */
extern initialize_file_ftype _initialize_hppa_linux_tdep;
@@ -433,6 +540,9 @@ hppa_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
more work in gcc and glibc first. */
set_gdbarch_long_double_bit (gdbarch, 64);
+ set_gdbarch_regset_from_core_section
+ (gdbarch, hppa_linux_regset_from_core_section);
+
#if 0
/* Dwarf-2 unwinding support. Not yet working. */
set_gdbarch_dwarf_reg_to_regnum (gdbarch, hppa_dwarf_reg_to_regnum);
@@ -450,4 +560,5 @@ void
_initialize_hppa_linux_tdep (void)
{
gdbarch_register_osabi (bfd_arch_hppa, 0, GDB_OSABI_LINUX, hppa_linux_init_abi);
+ gdbarch_register_osabi (bfd_arch_hppa, bfd_mach_hppa20w, GDB_OSABI_LINUX, hppa_linux_init_abi);
}