summaryrefslogtreecommitdiff
path: root/gdb/gdbarch.h
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2001-02-07 02:17:48 +0000
committerAndrew Cagney <cagney@redhat.com>2001-02-07 02:17:48 +0000
commit9516075289baef0ac756ce3e25247b3071f910a7 (patch)
tree98a0ced535025cf5de16a8a48a34cdd5c450ab48 /gdb/gdbarch.h
parent175aa013d9cb17845fabac4f14b2e4d15aec1f6d (diff)
downloadbinutils-gdb-9516075289baef0ac756ce3e25247b3071f910a7.tar.gz
Addd set_gdbarch_data() method. Update register_gdbarch_data() interface.
Diffstat (limited to 'gdb/gdbarch.h')
-rw-r--r--gdb/gdbarch.h35
1 files changed, 23 insertions, 12 deletions
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index af225fc1d3f..9db0ae38bc2 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -1610,29 +1610,40 @@ extern int gdbarch_update_p (struct gdbarch_info info);
Reserve space for a per-architecture data-pointer. An identifier
for the reserved data-pointer is returned. That identifer should
- be saved in a local static.
+ be saved in a local static variable.
- When a new architecture is selected, INIT() is called. When a
- previous architecture is re-selected, the per-architecture
- data-pointer for that previous architecture is restored (INIT() is
- not called).
+ The per-architecture data-pointer can be initialized in one of two
+ ways: The value can be set explicitly using a call to
+ set_gdbarch_data(); the value can be set implicitly using the value
+ returned by a non-NULL INIT() callback. INIT(), when non-NULL is
+ called after the basic architecture vector has been created.
- INIT() shall return the initial value for the per-architecture
- data-pointer for the current architecture.
+ When a previously created architecture is re-selected, the
+ per-architecture data-pointer for that previous architecture is
+ restored. INIT() is not called.
+
+ During initialization, multiple assignments of the data-pointer are
+ allowed, non-NULL values are deleted by calling FREE(). If the
+ architecture is deleted using gdbarch_free() all non-NULL data
+ pointers are also deleted using FREE().
Multiple registrarants for any architecture are allowed (and
strongly encouraged). */
-typedef void *(gdbarch_data_ftype) (void);
-extern struct gdbarch_data *register_gdbarch_data (gdbarch_data_ftype *init);
+struct gdbarch_data;
-/* Return the value of the per-architecture data-pointer for the
- current architecture. */
+typedef void *(gdbarch_data_init_ftype) (struct gdbarch *gdbarch);
+typedef void (gdbarch_data_free_ftype) (struct gdbarch *gdbarch,
+ void *pointer);
+extern struct gdbarch_data *register_gdbarch_data (gdbarch_data_init_ftype *init,
+ gdbarch_data_free_ftype *free);
+extern void set_gdbarch_data (struct gdbarch *gdbarch,
+ struct gdbarch_data *data,
+ void *pointer);
extern void *gdbarch_data (struct gdbarch_data*);
-
/* Register per-architecture memory region.
Provide a memory-region swap mechanism. Per-architecture memory