+2004-05-22 Mark Kettenis <kettenis@gnu.org>
+
+ * regset.c: Tweak comment.
+ (regset_alloc): Remove descr argument. Use GDBARCH_OBSTACK_ZALLOC
+ macro.
+ * regset.h: Update copyright year.
+ (struct regset): Remove `descr' member, add `gdbarch' member.
+ (regset_alloc): Adjust prototype and comment.
+ * i386-tdep.c (i386_supply_gregset): Get TDEP from REGSET->arch.
+ (i386_supply_fpregset): Likewise.
+ (i386_regset_from_core_section): Update call to regset_alloc.
+ * i386obsd-tdep.c (i386obsd_aout_supply_regset): Get TDEP from
+ REGSET->arch.
+ (i386obsd_aout_regset_from_core_section): Update call to
+ regset_alloc.
+ * i386nbsd-tdep.c (i386nbsd_aout_supply_regset): Get TDEP from
+ REGSET->arch.
+ (i386nbsd_aout_regset_from_core_section): Update call to
+ regset_alloc.
+ * amd64-tdep.c (amd64_supply_fpregset): Get TDEP from
+ REGSET->arch.
+ (amd64_regset_from_core_section): Update call to regset_alloc.
+ * amd64obsd-tdep.c (amd64obsd_supply_regset): Get TDEP from
+ REGSET->arch.
+ (amd64obsd_regset_from_core_section): Update call to regset_alloc.
+ * sparcnbsd-tdep.c (sparc32nbsd_supply_gregset): Directly pass
+ &sparc32nbsd_gregset in sparc32_supply_gregset call.
+ (sparc32nbsd_init_abi): Update call to regset_alloc.
+ * sparc64obsd-tdep.c (sparc64obsd_supply_gregset): Directly pass
+ &sparc64obsd_core_gregset in sparc64_supply_gregset call.
+ (sparc64obsd_init_abi): Update call to regset_alloc.
+ * sparc64nbsd-tdep.c (sparc64nbsd_supply_gregset): Directly pass
+ &sparc64nbsd_gregset in sparc64_supply_gregset call.
+ (sparc64nbsd_init_abi): Update call to regset_alloc.
+ * sparc64fbsd-tdep.c (sparc64fbsd_supply_gregset): Directly pass
+ &sparc64fbsd_gregset in sparc64_supply_gregset call.
+ (sparc64fbsd_init_abi): Update call to regset_alloc.
+
2004-05-22 Jim Blandy <jimb@redhat.com>
* ppc-tdep.h (spe_register_p): New declaration.
amd64_supply_fpregset (const struct regset *regset, struct regcache *regcache,
int regnum, const void *fpregs, size_t len)
{
- const struct gdbarch_tdep *tdep = regset->descr;
+ const struct gdbarch_tdep *tdep = gdbarch_tdep (regset->arch);
gdb_assert (len == tdep->sizeof_fpregset);
amd64_supply_fxsave (regcache, regnum, fpregs);
if (strcmp (sect_name, ".reg2") == 0 && sect_size == tdep->sizeof_fpregset)
{
if (tdep->fpregset == NULL)
- tdep->fpregset = regset_alloc (gdbarch, tdep,
- amd64_supply_fpregset, NULL);
+ tdep->fpregset = regset_alloc (gdbarch, amd64_supply_fpregset, NULL);
return tdep->fpregset;
}
struct regcache *regcache, int regnum,
const void *regs, size_t len)
{
- const struct gdbarch_tdep *tdep = regset->descr;
+ const struct gdbarch_tdep *tdep = gdbarch_tdep (regset->arch);
gdb_assert (len >= tdep->sizeof_gregset + I387_SIZEOF_FXSAVE);
&& sect_size >= tdep->sizeof_gregset + I387_SIZEOF_FXSAVE)
{
if (tdep->gregset == NULL)
- tdep->gregset = regset_alloc (gdbarch, tdep,
- amd64obsd_supply_regset, NULL);
+ tdep->gregset = regset_alloc (gdbarch, amd64obsd_supply_regset, NULL);
return tdep->gregset;
}
i386_supply_gregset (const struct regset *regset, struct regcache *regcache,
int regnum, const void *gregs, size_t len)
{
- const struct gdbarch_tdep *tdep = regset->descr;
+ const struct gdbarch_tdep *tdep = gdbarch_tdep (regset->arch);
const char *regs = gregs;
int i;
i386_supply_fpregset (const struct regset *regset, struct regcache *regcache,
int regnum, const void *fpregs, size_t len)
{
- const struct gdbarch_tdep *tdep = regset->descr;
+ const struct gdbarch_tdep *tdep = gdbarch_tdep (regset->arch);
if (len == I387_SIZEOF_FXSAVE)
{
if (strcmp (sect_name, ".reg") == 0 && sect_size == tdep->sizeof_gregset)
{
if (tdep->gregset == NULL)
- tdep->gregset = regset_alloc (gdbarch, tdep,
- i386_supply_gregset, NULL);
+ tdep->gregset = regset_alloc (gdbarch, i386_supply_gregset, NULL);
return tdep->gregset;
}
&& sect_size == I387_SIZEOF_FXSAVE))
{
if (tdep->fpregset == NULL)
- tdep->fpregset = regset_alloc (gdbarch, tdep,
- i386_supply_fpregset, NULL);
+ tdep->fpregset = regset_alloc (gdbarch, i386_supply_fpregset, NULL);
return tdep->fpregset;
}
struct regcache *regcache, int regnum,
const void *regs, size_t len)
{
- const struct gdbarch_tdep *tdep = regset->descr;
+ const struct gdbarch_tdep *tdep = gdbarch_tdep (regset->arch);
gdb_assert (len >= tdep->sizeof_gregset + I387_SIZEOF_FSAVE);
&& sect_size >= tdep->sizeof_gregset + I387_SIZEOF_FSAVE)
{
if (tdep->gregset == NULL)
- tdep->gregset = regset_alloc (gdbarch, tdep,
- i386nbsd_aout_supply_regset, NULL);
+ tdep->gregset =
+ regset_alloc (gdbarch, i386nbsd_aout_supply_regset, NULL);
return tdep->gregset;
}
struct regcache *regcache, int regnum,
const void *regs, size_t len)
{
- const struct gdbarch_tdep *tdep = regset->descr;
+ const struct gdbarch_tdep *tdep = gdbarch_tdep (regset->arch);
gdb_assert (len >= tdep->sizeof_gregset + I387_SIZEOF_FSAVE);
&& sect_size >= tdep->sizeof_gregset + I387_SIZEOF_FSAVE)
{
if (tdep->gregset == NULL)
- tdep->gregset = regset_alloc (gdbarch, tdep,
- i386obsd_aout_supply_regset, NULL);
+ tdep->gregset =
+ regset_alloc (gdbarch, i386obsd_aout_supply_regset, NULL);
return tdep->gregset;
}
-/* Regset support functions, for GDB.
+/* Manage register sets.
Copyright 2004 Free Software Foundation, Inc.
#include "defs.h"
#include "regset.h"
+
#include "gdb_assert.h"
+/* Allocate a fresh 'struct regset' whose supply_regset function is
+ SUPPLY_REGSET, and whose collect_regset function is COLLECT_REGSET.
+ If the regset has no collect_regset function, pass NULL for
+ COLLECT_REGSET.
+
+ The object returned is allocated on ARCH's obstack. */
struct regset *
regset_alloc (struct gdbarch *arch,
- const void *descr,
supply_regset_ftype *supply_regset,
collect_regset_ftype *collect_regset)
{
- struct regset *r
- = (struct regset *) gdbarch_obstack_zalloc (arch, sizeof (*r));
+ struct regset *regset = GDBARCH_OBSTACK_ZALLOC (arch, struct regset);
- r->descr = descr;
- r->supply_regset = supply_regset;
- r->collect_regset = collect_regset;
+ regset->arch = arch;
+ regset->supply_regset = supply_regset;
+ regset->collect_regset = collect_regset;
- return r;
+ return regset;
}
/* Manage register sets.
- Copyright 2003 Free Software Foundation, Inc.
+ Copyright 2003, 2004 Free Software Foundation, Inc.
This file is part of GDB.
struct regcache;
/* Data structure describing a register set. */
+
typedef void (supply_regset_ftype) (const struct regset *, struct regcache *,
int, const void *, size_t);
typedef void (collect_regset_ftype) (const struct regset *,
{
/* Data pointer for private use by the methods below, presumably
providing some sort of description of the register set. */
- const void *descr;
+ struct gdbarch *arch;
/* Function supplying values in a register set to a register cache. */
supply_regset_ftype *supply_regset;
collect_regset_ftype *collect_regset;
};
-
-/* Allocate a fresh 'struct regset' whose descr is DESCR, whose
- supply_regset function is SUPPLY_REGSET, and whose collect_regset
- function is COLLECT_REGSET. If the regset has no collect function,
- pass NULL for COLLECT_REGSET.
+/* Allocate a fresh 'struct regset' whose supply_regset function is
+ SUPPLY_REGSET, and whose collect_regset function is COLLECT_REGSET.
+ If the regset has no collect_regset function, pass NULL for
+ COLLECT_REGSET.
The object returned is allocated on ARCH's obstack. */
+
extern struct regset *regset_alloc (struct gdbarch *arch,
- const void *descr,
supply_regset_ftype *supply_regset,
collect_regset_ftype *collect_regset);
-
#endif /* regset.h */
struct regcache *regcache,
int regnum, const void *gregs, size_t len)
{
- sparc64_supply_gregset (regset->descr, regcache, regnum, gregs);
+ sparc64_supply_gregset (&sparc64fbsd_gregset, regcache, regnum, gregs);
}
static void
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
- tdep->gregset = regset_alloc (gdbarch, &sparc64fbsd_gregset,
- sparc64fbsd_supply_gregset, NULL);
+ tdep->gregset = regset_alloc (gdbarch, sparc64fbsd_supply_gregset, NULL);
tdep->sizeof_gregset = 256;
- tdep->fpregset = regset_alloc (gdbarch, NULL,
- sparc64fbsd_supply_fpregset, NULL);
+ tdep->fpregset = regset_alloc (gdbarch, sparc64fbsd_supply_fpregset, NULL);
tdep->sizeof_fpregset = 272;
frame_unwind_append_sniffer (gdbarch, sparc64fbsd_sigtramp_frame_sniffer);
struct regcache *regcache,
int regnum, const void *gregs, size_t len)
{
- sparc64_supply_gregset (regset->descr, regcache, regnum, gregs);
+ sparc64_supply_gregset (&sparc64nbsd_gregset, regcache, regnum, gregs);
}
static void
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
- tdep->gregset = regset_alloc (gdbarch, &sparc64nbsd_gregset,
- sparc64nbsd_supply_gregset, NULL);
+ tdep->gregset = regset_alloc (gdbarch, sparc64nbsd_supply_gregset, NULL);
tdep->sizeof_gregset = 160;
- tdep->fpregset = regset_alloc (gdbarch, NULL,
- sparc64nbsd_supply_fpregset, NULL);
+ tdep->fpregset = regset_alloc (gdbarch, sparc64nbsd_supply_fpregset, NULL);
tdep->sizeof_fpregset = 272;
frame_unwind_append_sniffer (gdbarch, sparc64nbsd_sigtramp_frame_sniffer);
{
const char *regs = gregs;
- sparc64_supply_gregset (regset->descr, regcache, regnum, regs);
+ sparc64_supply_gregset (&sparc64obsd_core_gregset, regcache, regnum, regs);
sparc64_supply_fpregset (regcache, regnum, regs + 288);
}
\f
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
- tdep->gregset = regset_alloc (gdbarch, &sparc64obsd_core_gregset,
- sparc64obsd_supply_gregset, NULL);
+ tdep->gregset = regset_alloc (gdbarch, sparc64obsd_supply_gregset, NULL);
tdep->sizeof_gregset = 832;
frame_unwind_append_sniffer (gdbarch, sparc64obsd_sigtramp_frame_sniffer);
struct regcache *regcache,
int regnum, const void *gregs, size_t len)
{
- sparc32_supply_gregset (regset->descr, regcache, regnum, gregs);
+ sparc32_supply_gregset (&sparc32nbsd_gregset, regcache, regnum, gregs);
/* Traditional NetBSD core files don't use multiple register sets.
Instead, the general-purpose and floating-point registers are
set_gdbarch_long_double_bit (gdbarch, 64);
set_gdbarch_long_double_format (gdbarch, &floatformat_ieee_double_big);
- tdep->gregset = regset_alloc (gdbarch, &sparc32nbsd_gregset,
- sparc32nbsd_supply_gregset, NULL);
+ tdep->gregset = regset_alloc (gdbarch, sparc32nbsd_supply_gregset, NULL);
tdep->sizeof_gregset = 20 * 4;
- tdep->fpregset = regset_alloc (gdbarch, NULL,
- sparc32nbsd_supply_fpregset, NULL);
+ tdep->fpregset = regset_alloc (gdbarch, sparc32nbsd_supply_fpregset, NULL);
tdep->sizeof_fpregset = 33 * 4;
frame_unwind_append_sniffer (gdbarch, sparc32nbsd_sigtramp_frame_sniffer);