offets at runtime. This currently isn't possible as some ISAs
define overlapping register regions - see the mess in
read_register_bytes() and write_register_bytes() registers. */
- descr->sizeof_register = XCALLOC (descr->nr_cooked_registers, long);
- descr->register_offset = XCALLOC (descr->nr_cooked_registers, long);
+ descr->sizeof_register
+ = GDBARCH_OBSTACK_CALLOC (gdbarch, descr->nr_cooked_registers, long);
+ descr->register_offset
+ = GDBARCH_OBSTACK_CALLOC (gdbarch, descr->nr_cooked_registers, long);
for (i = 0; i < descr->nr_cooked_registers; i++)
{
/* FIXME: cagney/2001-12-04: This code shouldn't need to use
gdb_assert (gdbarch != NULL);
/* Create an initial, zero filled, table. */
- descr = XCALLOC (1, struct regcache_descr);
+ descr = GDBARCH_OBSTACK_ZALLOC (gdbarch, struct regcache_descr);
descr->gdbarch = gdbarch;
/* Total size of the register space. The raw registers are mapped
descr->sizeof_cooked_register_valid_p = NUM_REGS + NUM_PSEUDO_REGS;
/* Fill in a table of register types. */
- descr->register_type = XCALLOC (descr->nr_cooked_registers,
- struct type *);
+ descr->register_type
+ = GDBARCH_OBSTACK_CALLOC (gdbarch, descr->nr_cooked_registers, struct type *);
for (i = 0; i < descr->nr_cooked_registers; i++)
{
if (gdbarch_register_type_p (gdbarch))
{
long offset = 0;
- descr->sizeof_register = XCALLOC (descr->nr_cooked_registers, long);
- descr->register_offset = XCALLOC (descr->nr_cooked_registers, long);
+ descr->sizeof_register
+ = GDBARCH_OBSTACK_CALLOC (gdbarch, descr->nr_cooked_registers, long);
+ descr->register_offset
+ = GDBARCH_OBSTACK_CALLOC (gdbarch, descr->nr_cooked_registers, long);
for (i = 0; i < descr->nr_cooked_registers; i++)
{
descr->sizeof_register[i] = TYPE_LENGTH (descr->register_type[i]);
return gdbarch_data (gdbarch, regcache_descr_handle);
}
-static void
-xfree_regcache_descr (struct gdbarch *gdbarch, void *ptr)
-{
- struct regcache_descr *descr = ptr;
- if (descr == NULL)
- return;
- xfree (descr->register_offset);
- xfree (descr->sizeof_register);
- descr->register_offset = NULL;
- descr->sizeof_register = NULL;
- xfree (descr);
-}
-
/* Utility functions returning useful register attributes stored in
the regcache descr. */
void
_initialize_regcache (void)
{
- regcache_descr_handle = register_gdbarch_data (init_regcache_descr,
- xfree_regcache_descr);
+ regcache_descr_handle = register_gdbarch_data (init_regcache_descr, NULL);
REGISTER_GDBARCH_SWAP (current_regcache);
register_gdbarch_swap (&deprecated_registers, sizeof (deprecated_registers), NULL);
register_gdbarch_swap (&deprecated_register_valid, sizeof (deprecated_register_valid), NULL);