* 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.
This commit is contained in:
Mark Kettenis 2004-05-22 15:16:22 +00:00
parent 8f5a310353
commit 9ea75c57ce
12 changed files with 84 additions and 53 deletions

View File

@ -1,3 +1,41 @@
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.

View File

@ -1056,7 +1056,7 @@ static void
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);
@ -1074,8 +1074,7 @@ amd64_regset_from_core_section (struct gdbarch *gdbarch,
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;
}

View File

@ -42,7 +42,7 @@ amd64obsd_supply_regset (const struct regset *regset,
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);
@ -63,8 +63,7 @@ amd64obsd_regset_from_core_section (struct gdbarch *gdbarch,
&& 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;
}

View File

@ -1616,7 +1616,7 @@ void
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;
@ -1638,7 +1638,7 @@ static void
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)
{
@ -1662,8 +1662,7 @@ i386_regset_from_core_section (struct gdbarch *gdbarch,
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;
}
@ -1672,8 +1671,7 @@ i386_regset_from_core_section (struct gdbarch *gdbarch,
&& 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;
}

View File

@ -64,7 +64,7 @@ i386nbsd_aout_supply_regset (const struct regset *regset,
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);
@ -86,8 +86,8 @@ i386nbsd_aout_regset_from_core_section (struct gdbarch *gdbarch,
&& 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;
}

View File

@ -119,7 +119,7 @@ i386obsd_aout_supply_regset (const struct regset *regset,
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);
@ -141,8 +141,8 @@ i386obsd_aout_regset_from_core_section (struct gdbarch *gdbarch,
&& 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;
}

View File

@ -1,4 +1,4 @@
/* Regset support functions, for GDB.
/* Manage register sets.
Copyright 2004 Free Software Foundation, Inc.
@ -21,21 +21,26 @@
#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;
}

View File

@ -1,6 +1,6 @@
/* Manage register sets.
Copyright 2003 Free Software Foundation, Inc.
Copyright 2003, 2004 Free Software Foundation, Inc.
This file is part of GDB.
@ -26,6 +26,7 @@ struct gdbarch;
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 *,
@ -36,7 +37,7 @@ 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;
@ -45,17 +46,15 @@ struct 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 */

View File

@ -54,7 +54,7 @@ sparc64fbsd_supply_gregset (const struct regset *regset,
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
@ -199,12 +199,10 @@ sparc64fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
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);

View File

@ -57,7 +57,7 @@ sparc64nbsd_supply_gregset (const struct regset *regset,
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
@ -226,12 +226,10 @@ sparc64nbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
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);

View File

@ -61,7 +61,7 @@ sparc64obsd_supply_gregset (const struct regset *regset,
{
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);
}
@ -184,8 +184,7 @@ sparc64obsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
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);

View File

@ -55,7 +55,7 @@ sparc32nbsd_supply_gregset (const struct regset *regset,
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
@ -274,12 +274,10 @@ sparc32nbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
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);