aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@gnu.org>2003-10-11 13:50:25 +0000
committerMark Kettenis <kettenis@gnu.org>2003-10-11 13:50:25 +0000
commit8446b36a38e57d7fb96c4c2a962b8765d70f248b (patch)
treed078966425187569e41495811bd9498373d2ec9f
parent8edc77b9b48e63d0bb26c517e3c815d6fdc73dc1 (diff)
downloadgdb-8446b36a38e57d7fb96c4c2a962b8765d70f248b.zip
gdb-8446b36a38e57d7fb96c4c2a962b8765d70f248b.tar.gz
gdb-8446b36a38e57d7fb96c4c2a962b8765d70f248b.tar.bz2
* i386-tdep.c (i386_regset_from_core_section): New function.
(i386_gdbarch_init): Initialize regset_from_core_section if appropriate. * i386-tdep.h (i386_regset_from_core_section): New declaration.
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/i386-tdep.c41
-rw-r--r--gdb/i386-tdep.h6
3 files changed, 52 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 3c9e082..c391bf3 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2003-10-11 Mark Kettenis <kettenis@gnu.org>
+ * i386-tdep.c (i386_regset_from_core_section): New function.
+ (i386_gdbarch_init): Initialize regset_from_core_section if
+ appropriate.
+ * i386-tdep.h (i386_regset_from_core_section): New declaration.
+
* i386-tdep.h (struct regset): Declare opaque.
* gdbarch.sh (regset_from_core_section): New method.
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index d2baa75..21721de 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -1587,6 +1587,40 @@ i386_supply_fpregset (const struct regset *regset, struct regcache *regcache,
gdb_assert (len == tdep->sizeof_fpregset);
i387_supply_fsave (regcache, regnum, fpregs);
}
+
+/* Return the appropriate register set for the core section identified
+ by SECT_NAME and SECT_SIZE. */
+
+const struct regset *
+i386_regset_from_core_section (struct gdbarch *gdbarch,
+ const char *sect_name, size_t sect_size)
+{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
+ if (strcmp (sect_name, ".reg") == 0 && sect_size == tdep->sizeof_gregset)
+ {
+ if (tdep->gregset == NULL)
+ {
+ tdep->gregset = XMALLOC (struct regset);
+ tdep->gregset->descr = tdep;
+ tdep->gregset->supply_regset = i386_supply_gregset;
+ }
+ return tdep->gregset;
+ }
+
+ if (strcmp (sect_name, ".reg2") == 0 && sect_size == tdep->sizeof_fpregset)
+ {
+ if (tdep->fpregset == NULL)
+ {
+ tdep->fpregset = XMALLOC (struct regset);
+ tdep->fpregset->descr = tdep;
+ tdep->fpregset->supply_regset = i386_supply_fpregset;
+ }
+ return tdep->fpregset;
+ }
+
+ return NULL;
+}
#ifdef STATIC_TRANSFORM_NAME
@@ -1977,6 +2011,13 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
frame_unwind_append_sniffer (gdbarch, i386_sigtramp_frame_sniffer);
frame_unwind_append_sniffer (gdbarch, i386_frame_sniffer);
+ /* If we have a register mapping, enable the generic core file
+ support, unless it has already been enabled. */
+ if (tdep->gregset_reg_offset
+ && !gdbarch_regset_from_core_section_p (gdbarch))
+ set_gdbarch_regset_from_core_section (gdbarch,
+ i386_regset_from_core_section);
+
/* Unless support for MMX has been disabled, make %mm0 the first
pseudo-register. */
if (tdep->mm0_regnum == 0)
diff --git a/gdb/i386-tdep.h b/gdb/i386-tdep.h
index b430950..59668d6 100644
--- a/gdb/i386-tdep.h
+++ b/gdb/i386-tdep.h
@@ -189,6 +189,12 @@ extern char const *i386_register_name (int reg);
extern int i386_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
struct reggroup *group);
+/* Return the appropriate register set for the core section identified
+ by SECT_NAME and SECT_SIZE. */
+extern const struct regset *
+ i386_regset_from_core_section (struct gdbarch *gdbarch,
+ const char *sect_name, size_t sect_size);
+
/* Initialize a basic ELF architecture variant. */
extern void i386_elf_init_abi (struct gdbarch_info, struct gdbarch *);