This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[PATCH] Core file regset support for AMD64
- From: Mark Kettenis <kettenis at chello dot nl>
- To: gdb-patches at sources dot redhat dot com
- Date: Sat, 11 Oct 2003 16:20:12 +0200 (CEST)
- Subject: [PATCH] Core file regset support for AMD64
This adds an implementation of the regset_from_core_section method for
AMD64.
Note that neither this patch, nor the previous one, actually enables
the use of this code.
Checked in,
Mark
Index: ChangeLog
from Mark Kettenis <kettenis@gnu.org>
* x86-64-tdep.c (x86_64_regset_from_core_section): New function.
(x86_64_init_abi): Initialize regset_from_core_section if
appropriate.
Index: x86-64-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/x86-64-tdep.c,v
retrieving revision 1.99
diff -u -p -r1.99 x86-64-tdep.c
--- x86-64-tdep.c 5 Oct 2003 22:54:10 -0000 1.99
+++ x86-64-tdep.c 11 Oct 2003 14:13:14 -0000
@@ -1220,6 +1220,31 @@ x86_64_supply_fpregset (const struct reg
x86_64_supply_fxsave (regcache, regnum, fpregs);
}
+/* Return the appropriate register set for the core section identified
+ by SECT_NAME and SECT_SIZE. */
+
+static const struct regset *
+x86_64_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, ".reg2") == 0 && sect_size == tdep->sizeof_fpregset)
+ {
+ if (tdep->fpregset == NULL)
+ {
+ tdep->fpregset = XMALLOC (struct regset);
+ tdep->fpregset->descr = tdep;
+ tdep->fpregset->supply_regset = x86_64_supply_fpregset;
+ }
+
+ return tdep->fpregset;
+ }
+
+ return i386_regset_from_core_section (gdbarch, sect_name, sect_size);
+}
+
+
void
x86_64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
@@ -1297,6 +1322,11 @@ x86_64_init_abi (struct gdbarch_info inf
frame_unwind_append_sniffer (gdbarch, x86_64_sigtramp_frame_sniffer);
frame_unwind_append_sniffer (gdbarch, x86_64_frame_sniffer);
frame_base_set_default (gdbarch, &x86_64_frame_base);
+
+ /* If we have a register mapping, enable the generic core file support. */
+ if (tdep->gregset_reg_offset)
+ set_gdbarch_regset_from_core_section (gdbarch,
+ x86_64_regset_from_core_section);
}