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 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.
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;
}
&& 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;
}
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;
}
&& 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;
}
&& 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;
}
&& 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;
}
struct regset *
-regset_xmalloc (const void *descr,
- supply_regset_ftype *supply_regset,
- collect_regset_ftype *collect_regset)
+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;
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,
- supply_regset_ftype *supply_regset,
- collect_regset_ftype *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 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);
{
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);
{
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);
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);