summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2003-08-04 20:52:27 +0000
committerAndrew Cagney <cagney@redhat.com>2003-08-04 20:52:27 +0000
commitcb09a4fe015691dcad68624b1670cdbbae17ee90 (patch)
tree9d19192cfa09041f374533e892fd9136167c8744
parent08b3302f7a158fc2d72da815d117fd776a28e526 (diff)
downloadgdb-cb09a4fe015691dcad68624b1670cdbbae17ee90.tar.gz
2003-08-04 Andrew Cagney <cagney@redhat.com>
* remote.c (free_remote_state): Delete function. (_initialize_remote): Update register_gdbarch_data. (init_remote_state): Use GDBARCH_OBSTACK_XALLOC and GDBARCH_OBSTACK_CALLOC instead of xmalloc / xcalloc.
-rw-r--r--gdb/ChangeLog7
-rw-r--r--gdb/remote.c16
2 files changed, 11 insertions, 12 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 32fe0d9129e..1d7dad7abc9 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,12 @@
2003-08-04 Andrew Cagney <cagney@redhat.com>
+ * remote.c (free_remote_state): Delete function.
+ (_initialize_remote): Update register_gdbarch_data.
+ (init_remote_state): Use GDBARCH_OBSTACK_XALLOC and
+ GDBARCH_OBSTACK_CALLOC instead of xmalloc / xcalloc.
+
+2003-08-04 Andrew Cagney <cagney@redhat.com>
+
* reggroups.c (struct reggroup_el): Define.
(struct reggroups): Delete field "nr_group". Replace array
"group" with a "first" to "last" linked list.
diff --git a/gdb/remote.c b/gdb/remote.c
index e6c4fbc4490..0da3fecff8a 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -256,7 +256,7 @@ static void *
init_remote_state (struct gdbarch *gdbarch)
{
int regnum;
- struct remote_state *rs = xmalloc (sizeof (struct remote_state));
+ struct remote_state *rs = GDBARCH_OBSTACK_ZALLOC (gdbarch, struct remote_state);
if (DEPRECATED_REGISTER_BYTES != 0)
rs->sizeof_g_packet = DEPRECATED_REGISTER_BYTES;
@@ -264,7 +264,8 @@ init_remote_state (struct gdbarch *gdbarch)
rs->sizeof_g_packet = 0;
/* Assume a 1:1 regnum<->pnum table. */
- rs->regs = xcalloc (NUM_REGS + NUM_PSEUDO_REGS, sizeof (struct packet_reg));
+ rs->regs = GDBARCH_OBSTACK_CALLOC (gdbarch, NUM_REGS + NUM_PSEUDO_REGS,
+ struct packet_reg);
for (regnum = 0; regnum < NUM_REGS + NUM_PSEUDO_REGS; regnum++)
{
struct packet_reg *r = &rs->regs[regnum];
@@ -303,14 +304,6 @@ init_remote_state (struct gdbarch *gdbarch)
return rs;
}
-static void
-free_remote_state (struct gdbarch *gdbarch, void *pointer)
-{
- struct remote_state *data = pointer;
- xfree (data->regs);
- xfree (data);
-}
-
static struct packet_reg *
packet_reg_from_regnum (struct remote_state *rs, long regnum)
{
@@ -6063,8 +6056,7 @@ _initialize_remote (void)
struct cmd_list_element *tmpcmd;
/* architecture specific data */
- remote_gdbarch_data_handle = register_gdbarch_data (init_remote_state,
- free_remote_state);
+ remote_gdbarch_data_handle = register_gdbarch_data (init_remote_state, NULL);
/* Old tacky stuff. NOTE: This comes after the remote protocol so
that the remote protocol has been initialized. */