From: Mark Kettenis Date: Sat, 11 Oct 2003 14:19:11 +0000 (+0000) Subject: * x86-64-tdep.c (x86_64_regset_from_core_section): New function. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c6b33596909ddd557a49fe34816b2a887e228d10;p=binutils-gdb.git * x86-64-tdep.c (x86_64_regset_from_core_section): New function. (x86_64_init_abi): Initialize regset_from_core_section if appropriate. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index c391bf31644..20e05f37741 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,9 @@ 2003-10-11 Mark Kettenis + * x86-64-tdep.c (x86_64_regset_from_core_section): New function. + (x86_64_init_abi): Initialize regset_from_core_section if + appropriate. + * i386-tdep.c (i386_regset_from_core_section): New function. (i386_gdbarch_init): Initialize regset_from_core_section if appropriate. diff --git a/gdb/x86-64-tdep.c b/gdb/x86-64-tdep.c index 8290023df68..351b11512c3 100644 --- a/gdb/x86-64-tdep.c +++ b/gdb/x86-64-tdep.c @@ -1220,6 +1220,31 @@ x86_64_supply_fpregset (const struct regset *regset, struct regcache *regcache, 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 info, struct gdbarch *gdbarch) 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); }