aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2003-08-04 21:12:46 +0000
committerAndrew Cagney <cagney@redhat.com>2003-08-04 21:12:46 +0000
commit116f06eabf8c6f45308bce3c98aa9296c7d82b84 (patch)
treeb0466026a6344f30b43423d417cce7a2b3434aa6
parente5e78edc1a0b374d2480bb3c3c5a16dce2a1f5ec (diff)
downloadgdb-116f06eabf8c6f45308bce3c98aa9296c7d82b84.zip
gdb-116f06eabf8c6f45308bce3c98aa9296c7d82b84.tar.gz
gdb-116f06eabf8c6f45308bce3c98aa9296c7d82b84.tar.bz2
2003-08-04 Andrew Cagney <cagney@redhat.com>
* regcache.c (xfree_regcache_descr): Delete function. (_initialize_regcache): Update call to register_gdbarch_data. (init_regcache_descr, init_legacy_regcache_descr): Use GDBARCH_OBSTACK_XALLOC and GDBARCH_OBSTACK_CALLOC.
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/regcache.c34
2 files changed, 17 insertions, 22 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 1d7dad7..45c1397 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2003-08-04 Andrew Cagney <cagney@redhat.com>
+ * regcache.c (xfree_regcache_descr): Delete function.
+ (_initialize_regcache): Update call to register_gdbarch_data.
+ (init_regcache_descr, init_legacy_regcache_descr): Use
+ GDBARCH_OBSTACK_XALLOC and GDBARCH_OBSTACK_CALLOC.
+
* remote.c (free_remote_state): Delete function.
(_initialize_remote): Update register_gdbarch_data.
(init_remote_state): Use GDBARCH_OBSTACK_XALLOC and
diff --git a/gdb/regcache.c b/gdb/regcache.c
index 2b8c33f..74b98d9 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -99,8 +99,10 @@ init_legacy_regcache_descr (struct gdbarch *gdbarch,
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
@@ -148,7 +150,7 @@ init_regcache_descr (struct gdbarch *gdbarch)
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
@@ -158,8 +160,8 @@ init_regcache_descr (struct gdbarch *gdbarch)
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))
@@ -208,8 +210,10 @@ init_regcache_descr (struct gdbarch *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]);
@@ -251,19 +255,6 @@ regcache_descr (struct gdbarch *gdbarch)
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. */
@@ -1671,8 +1662,7 @@ extern initialize_file_ftype _initialize_regcache; /* -Wmissing-prototype */
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);