aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbarch.h
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2003-07-22 19:49:58 +0000
committerAndrew Cagney <cagney@redhat.com>2003-07-22 19:49:58 +0000
commitaebd7893d9fccba42783b14198455757cffd2cb3 (patch)
treeb3ba2971ec0218f18d0e8a9ad9321a8c88719d27 /gdb/gdbarch.h
parente22fef83d72c23935e2bca2bc71e87e7c911a229 (diff)
downloadgdb-aebd7893d9fccba42783b14198455757cffd2cb3.zip
gdb-aebd7893d9fccba42783b14198455757cffd2cb3.tar.gz
gdb-aebd7893d9fccba42783b14198455757cffd2cb3.tar.bz2
2003-07-22 Andrew Cagney <cagney@redhat.com>
* gdbarch.c Include "gdb_obstack.h". (struct gdbarch): Add an "obstack". (alloc_gdbarch_data): Allocate the gdbarch data using GDBARCH_OBSTACK_CALLOC. (free_gdbarch_data): Delete function. (gdbarch_obstack_zalloc): New function. (gdbarch_free): Free the obstack, do not call free_gdbarch_data. Assert that the architecture is not initialized. (gdbarch_alloc): Allocate an obstack, allocate the architecture vector from the obstack. (alloc_gdbarch_data, init_gdbarch_swap): Allocate memory using the architecture obstack. (GDBARCH_OBSTACK_CALLOC, GDBARCH_OBSTACK_ZALLOC): Define. (set_gdbarch_data): Assert that the data is not initialized. (struct gdbarch_data): Delete member "free". (register_gdbarch_data): Do not initialize "free". * gdbarch.h, gdbarch.c: Re-generate.
Diffstat (limited to 'gdb/gdbarch.h')
-rw-r--r--gdb/gdbarch.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index 9de1222..7753022 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -3227,6 +3227,15 @@ extern struct gdbarch *gdbarch_alloc (const struct gdbarch_info *info, struct gd
extern void gdbarch_free (struct gdbarch *);
+/* Helper function. Allocate memory from the ``struct gdbarch''
+ obstack. The memory is freed when the corresponding architecture
+ is also freed. */
+
+extern void *gdbarch_obstack_zalloc (struct gdbarch *gdbarch, long size);
+#define GDBARCH_OBSTACK_CALLOC(GDBARCH, NR, TYPE) ((TYPE *) gdbarch_obstack_zalloc ((GDBARCH), (NR) * sizeof (TYPE)))
+#define GDBARCH_OBSTACK_ZALLOC(GDBARCH, TYPE) ((TYPE *) gdbarch_obstack_zalloc ((GDBARCH), sizeof (TYPE)))
+
+
/* Helper function. Force an update of the current architecture.
The actual architecture selected is determined by INFO, ``(gdb) set
@@ -3248,9 +3257,7 @@ extern int gdbarch_update_p (struct gdbarch_info info);
The per-architecture data-pointer is either initialized explicitly
(set_gdbarch_data()) or implicitly (by INIT() via a call to
- gdbarch_data()). FREE() is called to delete either an existing
- data-pointer overridden by set_gdbarch_data() or when the
- architecture object is being deleted.
+ gdbarch_data()). FREE() is ignored.
When a previously created architecture is re-selected, the
per-architecture data-pointer for that previous architecture is