Allocate regset structures in the gdbarch's obstack, not using

xmalloc.
* regset.c (regset_alloc): Renamed from regset_xmalloc.
Add 'arch' argument.  Allocate the regset on arch's obstack, not
using xmalloc.
* regset.h (regset_alloc): Update declaration.
* am64-tdep.c (amd64_regset_from_core_section): Update call; pass
gdbarch argument.
* amd64obsd-tdep.c (amd64obsd_regset_from_core_section): Same.
* i386-tdep.c (i386_regset_from_core_section): Same.
* i386nbsd-tdep.c (i386nbsd_aout_regset_from_core_section): Same.
* i386obsd-tdep.c (i386obsd_aout_regset_from_core_section): Same.
* sparc64fbsd-tdep.c (sparc64fbsd_init_abi): Same.
* sparc64nbsd-tdep.c (sparc64nbsd_init_abi): Same.
* sparc64obsd-tdep.c (sparc64obsd_init_abi): Same.
* sparcnbsd-tdep.c (sparc32nbsd_init_abi): Same.
This commit is contained in:
Jim Blandy 2004-05-21 22:15:10 +00:00
parent 6bd3dfaaa2
commit 617a4cbacf
12 changed files with 56 additions and 28 deletions

View file

@ -1,3 +1,22 @@
2004-05-21 Jim Blandy <jimb@redhat.com>
Allocate regset structures in the gdbarch's obstack, not using
xmalloc.
* regset.c (regset_alloc): Renamed from regset_xmalloc.
Add 'arch' argument. Allocate the regset on arch's obstack, not
using xmalloc.
* regset.h (regset_alloc): Update declaration.
* am64-tdep.c (amd64_regset_from_core_section): Update call; pass
gdbarch argument.
* amd64obsd-tdep.c (amd64obsd_regset_from_core_section): Same.
* i386-tdep.c (i386_regset_from_core_section): Same.
* i386nbsd-tdep.c (i386nbsd_aout_regset_from_core_section): Same.
* i386obsd-tdep.c (i386obsd_aout_regset_from_core_section): Same.
* sparc64fbsd-tdep.c (sparc64fbsd_init_abi): Same.
* sparc64nbsd-tdep.c (sparc64nbsd_init_abi): Same.
* sparc64obsd-tdep.c (sparc64obsd_init_abi): Same.
* sparcnbsd-tdep.c (sparc32nbsd_init_abi): Same.
2004-05-21 Joel Brobecker <brobecker@gnat.com>
* config/djgpp/fnchange.lst: Undo previous change, was useless.

View file

@ -1074,7 +1074,8 @@ 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_xmalloc (tdep, amd64_supply_fpregset, NULL);
tdep->fpregset = regset_alloc (gdbarch, tdep,
amd64_supply_fpregset, NULL);
return tdep->fpregset;
}

View file

@ -63,7 +63,8 @@ amd64obsd_regset_from_core_section (struct gdbarch *gdbarch,
&& sect_size >= tdep->sizeof_gregset + I387_SIZEOF_FXSAVE)
{
if (tdep->gregset == NULL)
tdep->gregset = regset_xmalloc (tdep, amd64obsd_supply_regset, NULL);
tdep->gregset = regset_alloc (gdbarch, tdep,
amd64obsd_supply_regset, NULL);
return tdep->gregset;
}

View file

@ -1662,7 +1662,8 @@ 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_xmalloc (tdep, i386_supply_gregset, NULL);
tdep->gregset = regset_alloc (gdbarch, tdep,
i386_supply_gregset, NULL);
return tdep->gregset;
}
@ -1671,7 +1672,8 @@ i386_regset_from_core_section (struct gdbarch *gdbarch,
&& sect_size == I387_SIZEOF_FXSAVE))
{
if (tdep->fpregset == NULL)
tdep->fpregset = regset_xmalloc (tdep, i386_supply_fpregset, NULL);
tdep->fpregset = regset_alloc (gdbarch, tdep,
i386_supply_fpregset, NULL);
return tdep->fpregset;
}

View file

@ -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_xmalloc (tdep, i386nbsd_aout_supply_regset, NULL);
tdep->gregset = regset_alloc (gdbarch, tdep,
i386nbsd_aout_supply_regset, NULL);
return tdep->gregset;
}

View file

@ -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_xmalloc (tdep, i386obsd_aout_supply_regset, NULL);
tdep->gregset = regset_alloc (gdbarch, tdep,
i386obsd_aout_supply_regset, NULL);
return tdep->gregset;
}

View file

@ -25,11 +25,13 @@
struct regset *
regset_xmalloc (const void *descr,
regset_alloc (struct gdbarch *arch,
const void *descr,
supply_regset_ftype *supply_regset,
collect_regset_ftype *collect_regset)
{
struct regset *r = (struct regset *) xmalloc (sizeof (*r));
struct regset *r
= (struct regset *) gdbarch_obstack_zalloc (arch, sizeof (*r));
r->descr = descr;
r->supply_regset = supply_regset;

View file

@ -51,8 +51,9 @@ struct regset
function is COLLECT_REGSET. If the regset has no collect function,
pass NULL for COLLECT_REGSET.
The object returned is allocated using xmalloc. */
extern struct regset *regset_xmalloc (const void *descr,
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);

View file

@ -199,11 +199,12 @@ sparc64fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
tdep->gregset
= regset_xmalloc (&sparc64fbsd_gregset, sparc64fbsd_supply_gregset, NULL);
tdep->gregset = regset_alloc (gdbarch, &sparc64fbsd_gregset,
sparc64fbsd_supply_gregset, NULL);
tdep->sizeof_gregset = 256;
tdep->fpregset = regset_xmalloc (NULL, sparc64fbsd_supply_fpregset, NULL);
tdep->fpregset = regset_alloc (gdbarch, NULL,
sparc64fbsd_supply_fpregset, NULL);
tdep->sizeof_fpregset = 272;
frame_unwind_append_sniffer (gdbarch, sparc64fbsd_sigtramp_frame_sniffer);

View file

@ -226,11 +226,12 @@ sparc64nbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
tdep->gregset
= regset_xmalloc (&sparc64nbsd_gregset, sparc64nbsd_supply_gregset, NULL);
tdep->gregset = regset_alloc (gdbarch, &sparc64nbsd_gregset,
sparc64nbsd_supply_gregset, NULL);
tdep->sizeof_gregset = 160;
tdep->fpregset = regset_xmalloc (NULL, sparc64nbsd_supply_fpregset, NULL);
tdep->fpregset = regset_alloc (gdbarch, NULL,
sparc64nbsd_supply_fpregset, NULL);
tdep->sizeof_fpregset = 272;
frame_unwind_append_sniffer (gdbarch, sparc64nbsd_sigtramp_frame_sniffer);

View file

@ -184,9 +184,8 @@ sparc64obsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
tdep->gregset = regset_xmalloc (&sparc64obsd_core_gregset,
sparc64obsd_supply_gregset,
NULL);
tdep->gregset = regset_alloc (gdbarch, &sparc64obsd_core_gregset,
sparc64obsd_supply_gregset, NULL);
tdep->sizeof_gregset = 832;
frame_unwind_append_sniffer (gdbarch, sparc64obsd_sigtramp_frame_sniffer);

View file

@ -274,11 +274,12 @@ 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_xmalloc (&sparc32nbsd_gregset, sparc32nbsd_supply_gregset, NULL);
tdep->gregset = regset_alloc (gdbarch, &sparc32nbsd_gregset,
sparc32nbsd_supply_gregset, NULL);
tdep->sizeof_gregset = 20 * 4;
tdep->fpregset = regset_xmalloc (NULL, sparc32nbsd_supply_fpregset, NULL);
tdep->fpregset = regset_alloc (gdbarch, NULL,
sparc32nbsd_supply_fpregset, NULL);
tdep->sizeof_fpregset = 33 * 4;
frame_unwind_append_sniffer (gdbarch, sparc32nbsd_sigtramp_frame_sniffer);