aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2004-03-15 20:38:08 +0000
committerAndrew Cagney <cagney@redhat.com>2004-03-15 20:38:08 +0000
commit030f20e19e7c5d2d8d26030c83cc2387a9e04c1d (patch)
tree73dbd548ef81676f5b5b2cbe903cfcd9e5b0325c /gdb
parent3111a3fcb7ee3d17eec0e5045f7edaaaa9263dbd (diff)
downloadgdb-030f20e19e7c5d2d8d26030c83cc2387a9e04c1d.zip
gdb-030f20e19e7c5d2d8d26030c83cc2387a9e04c1d.tar.gz
gdb-030f20e19e7c5d2d8d26030c83cc2387a9e04c1d.tar.bz2
2004-03-15 Andrew Cagney <cagney@redhat.com>
* gdbarch.sh (gdbarch_data_pre_init_fytpe) (gdbarch_data_register_pre_init, gdbarch_data_post_init_fytpe) (gdbarch_data_register_post_init): Replace gdbarch_data_init_ftype and register_gdbarch_data. (deprecated_set_gdbarch_data): Rename set_gdbarch_data. (struct gdbarch_data): Replace "init" by "pre_init" and "post_init". * gdbarch.h, gdbarch.c: Re-generate. * dwarf2-frame.c (dwarf2_frame_init): Replace "gdbarch" paramter with"obstack", use OBSTACK_ZALLOC. (dwarf2_frame_ops): Delete. (dwarf2_frame_set_init_reg): Use gdbarch_data. (dwarf2_frame_init_reg): Use gdbarch_data. (_initialize_dwarf2_frame): Use gdbarch_data_register_pre_init. * solib-svr4.c (set_solib_svr4_fetch_link_map_offsets) (_initialize_svr4_solib): Update. * user-regs.c (_initialize_user_regs): Update. * reggroups.c (_initialize_reggroup): Update. * regcache.c (_initialize_regcache): Update. * mips-linux-tdep.c (_initialize_mips_linux_tdep): Update. * libunwind-frame.c (_initialize_libunwind_frame): Update. * gnu-v3-abi.c (init_gnuv3_ops): Update. * frame-unwind.c (_initialize_frame_unwind): Update. * frame-base.c (_initialize_frame_base): Update. * user-regs.c (user_reg_add): Update. * reggroups.c (reggroup_add): Update. * mips-linux-tdep.c (set_mips_linux_register_addr): Update. * libunwind-frame.c (libunwind_frame_set_descr): Update. * frame-unwind.c (frame_unwind_append_sniffer): Update. * frame-base.c (frame_base_table): Update. * remote.c (_initialize_remote): Update. * gdb_obstack.h (OBSTACK_ZALLOC, OBSTACK_CALLOC): Define.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog35
-rw-r--r--gdb/dwarf2-frame.c26
-rw-r--r--gdb/frame-base.c4
-rw-r--r--gdb/frame-unwind.c4
-rw-r--r--gdb/gdb_obstack.h6
-rw-r--r--gdb/gdbarch.c66
-rw-r--r--gdb/gdbarch.h19
-rwxr-xr-xgdb/gdbarch.sh85
-rw-r--r--gdb/gnu-v3-abi.c2
-rw-r--r--gdb/libunwind-frame.c4
-rw-r--r--gdb/mips-linux-tdep.c4
-rw-r--r--gdb/regcache.c2
-rw-r--r--gdb/reggroups.c4
-rw-r--r--gdb/remote.c2
-rw-r--r--gdb/solib-svr4.c4
-rw-r--r--gdb/user-regs.c4
16 files changed, 177 insertions, 94 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 688c02c..53c517e 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,40 @@
2004-03-15 Andrew Cagney <cagney@redhat.com>
+ * gdbarch.sh (gdbarch_data_pre_init_fytpe)
+ (gdbarch_data_register_pre_init, gdbarch_data_post_init_fytpe)
+ (gdbarch_data_register_post_init): Replace gdbarch_data_init_ftype
+ and register_gdbarch_data.
+ (deprecated_set_gdbarch_data): Rename set_gdbarch_data.
+ (struct gdbarch_data): Replace "init" by "pre_init" and
+ "post_init".
+ * gdbarch.h, gdbarch.c: Re-generate.
+ * dwarf2-frame.c (dwarf2_frame_init): Replace "gdbarch" paramter
+ with"obstack", use OBSTACK_ZALLOC.
+ (dwarf2_frame_ops): Delete.
+ (dwarf2_frame_set_init_reg): Use gdbarch_data.
+ (dwarf2_frame_init_reg): Use gdbarch_data.
+ (_initialize_dwarf2_frame): Use gdbarch_data_register_pre_init.
+ * solib-svr4.c (set_solib_svr4_fetch_link_map_offsets)
+ (_initialize_svr4_solib): Update.
+ * user-regs.c (_initialize_user_regs): Update.
+ * reggroups.c (_initialize_reggroup): Update.
+ * regcache.c (_initialize_regcache): Update.
+ * mips-linux-tdep.c (_initialize_mips_linux_tdep): Update.
+ * libunwind-frame.c (_initialize_libunwind_frame): Update.
+ * gnu-v3-abi.c (init_gnuv3_ops): Update.
+ * frame-unwind.c (_initialize_frame_unwind): Update.
+ * frame-base.c (_initialize_frame_base): Update.
+ * user-regs.c (user_reg_add): Update.
+ * reggroups.c (reggroup_add): Update.
+ * mips-linux-tdep.c (set_mips_linux_register_addr): Update.
+ * libunwind-frame.c (libunwind_frame_set_descr): Update.
+ * frame-unwind.c (frame_unwind_append_sniffer): Update.
+ * frame-base.c (frame_base_table): Update.
+ * remote.c (_initialize_remote): Update.
+ * gdb_obstack.h (OBSTACK_ZALLOC, OBSTACK_CALLOC): Define.
+
+2004-03-15 Andrew Cagney <cagney@redhat.com>
+
* cris-tdep.c (bfd_lookup_symbol): Delete unused function.
2004-03-15 Kevin Buettner <kevinb@redhat.com>
diff --git a/gdb/dwarf2-frame.c b/gdb/dwarf2-frame.c
index 8c62419..13c836e 100644
--- a/gdb/dwarf2-frame.c
+++ b/gdb/dwarf2-frame.c
@@ -509,29 +509,15 @@ dwarf2_frame_default_init_reg (struct gdbarch *gdbarch, int regnum,
/* Return a default for the architecture-specific operations. */
static void *
-dwarf2_frame_init (struct gdbarch *gdbarch)
+dwarf2_frame_init (struct obstack *obstack)
{
struct dwarf2_frame_ops *ops;
- ops = GDBARCH_OBSTACK_ZALLOC (gdbarch, struct dwarf2_frame_ops);
+ ops = OBSTACK_ZALLOC (obstack, struct dwarf2_frame_ops);
ops->init_reg = dwarf2_frame_default_init_reg;
return ops;
}
-static struct dwarf2_frame_ops *
-dwarf2_frame_ops (struct gdbarch *gdbarch)
-{
- struct dwarf2_frame_ops *ops = gdbarch_data (gdbarch, dwarf2_frame_data);
- if (ops == NULL)
- {
- /* ULGH, called during architecture initialization. Patch
- things up. */
- ops = dwarf2_frame_init (gdbarch);
- set_gdbarch_data (gdbarch, dwarf2_frame_data, ops);
- }
- return ops;
-}
-
/* Set the architecture-specific register state initialization
function for GDBARCH to INIT_REG. */
@@ -540,9 +526,8 @@ dwarf2_frame_set_init_reg (struct gdbarch *gdbarch,
void (*init_reg) (struct gdbarch *, int,
struct dwarf2_frame_state_reg *))
{
- struct dwarf2_frame_ops *ops;
+ struct dwarf2_frame_ops *ops = gdbarch_data (gdbarch, dwarf2_frame_data);
- ops = dwarf2_frame_ops (gdbarch);
ops->init_reg = init_reg;
}
@@ -552,9 +537,8 @@ static void
dwarf2_frame_init_reg (struct gdbarch *gdbarch, int regnum,
struct dwarf2_frame_state_reg *reg)
{
- struct dwarf2_frame_ops *ops;
+ struct dwarf2_frame_ops *ops = gdbarch_data (gdbarch, dwarf2_frame_data);
- ops = dwarf2_frame_ops (gdbarch);
ops->init_reg (gdbarch, regnum, reg);
}
@@ -1608,6 +1592,6 @@ void _initialize_dwarf2_frame (void);
void
_initialize_dwarf2_frame (void)
{
- dwarf2_frame_data = register_gdbarch_data (dwarf2_frame_init);
+ dwarf2_frame_data = gdbarch_data_register_pre_init (dwarf2_frame_init);
dwarf2_frame_objfile_data = register_objfile_data ();
}
diff --git a/gdb/frame-base.c b/gdb/frame-base.c
index 66a0106..e651b05 100644
--- a/gdb/frame-base.c
+++ b/gdb/frame-base.c
@@ -92,7 +92,7 @@ frame_base_table (struct gdbarch *gdbarch)
/* ULGH, called during architecture initialization. Patch
things up. */
table = frame_base_init (gdbarch);
- set_gdbarch_data (gdbarch, frame_base_data, table);
+ deprecated_set_gdbarch_data (gdbarch, frame_base_data, table);
}
return table;
}
@@ -146,5 +146,5 @@ extern initialize_file_ftype _initialize_frame_base; /* -Wmissing-prototypes */
void
_initialize_frame_base (void)
{
- frame_base_data = register_gdbarch_data (frame_base_init);
+ frame_base_data = gdbarch_data_register_post_init (frame_base_init);
}
diff --git a/gdb/frame-unwind.c b/gdb/frame-unwind.c
index 82eaf7c..2760934 100644
--- a/gdb/frame-unwind.c
+++ b/gdb/frame-unwind.c
@@ -63,7 +63,7 @@ frame_unwind_append_sniffer (struct gdbarch *gdbarch,
/* ULGH, called during architecture initialization. Patch
things up. */
table = frame_unwind_init (gdbarch);
- set_gdbarch_data (gdbarch, frame_unwind_data, table);
+ deprecated_set_gdbarch_data (gdbarch, frame_unwind_data, table);
}
append_predicate (table, sniffer);
}
@@ -95,5 +95,5 @@ extern initialize_file_ftype _initialize_frame_unwind; /* -Wmissing-prototypes *
void
_initialize_frame_unwind (void)
{
- frame_unwind_data = register_gdbarch_data (frame_unwind_init);
+ frame_unwind_data = gdbarch_data_register_post_init (frame_unwind_init);
}
diff --git a/gdb/gdb_obstack.h b/gdb/gdb_obstack.h
index 0dcfc4f..253fd19 100644
--- a/gdb/gdb_obstack.h
+++ b/gdb/gdb_obstack.h
@@ -24,6 +24,12 @@
#include "obstack.h"
+/* Utility macros - wrap obstack alloc into something more robust. */
+
+#define OBSTACK_ZALLOC(OBSTACK,TYPE) (memset (obstack_alloc ((OBSTACK), sizeof (TYPE)), 0, sizeof (TYPE)))
+
+#define OBSTACK_CALLOC(OBSTACK,NUMBER,TYPE) (memset (obstack_alloc ((OBSTACK), (NUMBER) * sizeof (TYPE)), 0, (NUMBER) * sizeof (TYPE)))
+
/* Unless explicitly specified, GDB obstacks always use xmalloc() and
xfree(). */
/* Note: ezannoni 2004-02-09: One could also specify the allocation
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index 1ee401f..7927925 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -5382,7 +5382,8 @@ struct gdbarch_data
{
unsigned index;
int init_p;
- gdbarch_data_init_ftype *init;
+ gdbarch_data_pre_init_ftype *pre_init;
+ gdbarch_data_post_init_ftype *post_init;
};
struct gdbarch_data_registration
@@ -5402,8 +5403,9 @@ struct gdbarch_data_registry gdbarch_data_registry =
0, NULL,
};
-struct gdbarch_data *
-register_gdbarch_data (gdbarch_data_init_ftype *init)
+static struct gdbarch_data *
+gdbarch_data_register (gdbarch_data_pre_init_ftype *pre_init,
+ gdbarch_data_post_init_ftype *post_init)
{
struct gdbarch_data_registration **curr;
/* Append the new registraration. */
@@ -5414,11 +5416,23 @@ register_gdbarch_data (gdbarch_data_init_ftype *init)
(*curr)->next = NULL;
(*curr)->data = XMALLOC (struct gdbarch_data);
(*curr)->data->index = gdbarch_data_registry.nr++;
- (*curr)->data->init = init;
+ (*curr)->data->pre_init = pre_init;
+ (*curr)->data->post_init = post_init;
(*curr)->data->init_p = 1;
return (*curr)->data;
}
+struct gdbarch_data *
+gdbarch_data_register_pre_init (gdbarch_data_pre_init_ftype *pre_init)
+{
+ return gdbarch_data_register (pre_init, NULL);
+}
+
+struct gdbarch_data *
+gdbarch_data_register_post_init (gdbarch_data_post_init_ftype *post_init)
+{
+ return gdbarch_data_register (NULL, post_init);
+}
/* Create/delete the gdbarch data vector. */
@@ -5434,12 +5448,13 @@ alloc_gdbarch_data (struct gdbarch *gdbarch)
data-pointer. */
void
-set_gdbarch_data (struct gdbarch *gdbarch,
- struct gdbarch_data *data,
- void *pointer)
+deprecated_set_gdbarch_data (struct gdbarch *gdbarch,
+ struct gdbarch_data *data,
+ void *pointer)
{
gdb_assert (data->index < gdbarch->nr_data);
gdb_assert (gdbarch->data[data->index] == NULL);
+ gdb_assert (data->pre_init == NULL);
gdbarch->data[data->index] = pointer;
}
@@ -5450,18 +5465,33 @@ void *
gdbarch_data (struct gdbarch *gdbarch, struct gdbarch_data *data)
{
gdb_assert (data->index < gdbarch->nr_data);
- /* The data-pointer isn't initialized, call init() to get a value but
- only if the architecture initializaiton has completed. Otherwise
- punt - hope that the caller knows what they are doing. */
- if (gdbarch->data[data->index] == NULL
- && gdbarch->initialized_p)
+ if (gdbarch->data[data->index] == NULL)
{
- /* Be careful to detect an initialization cycle. */
- gdb_assert (data->init_p);
- data->init_p = 0;
- gdb_assert (data->init != NULL);
- gdbarch->data[data->index] = data->init (gdbarch);
- data->init_p = 1;
+ /* The data-pointer isn't initialized, call init() to get a
+ value. */
+ if (data->pre_init != NULL)
+ /* Mid architecture creation: pass just the obstack, and not
+ the entire architecture, as that way it isn't possible for
+ pre-init code to refer to undefined architecture
+ fields. */
+ gdbarch->data[data->index] = data->pre_init (gdbarch->obstack);
+ else if (gdbarch->initialized_p
+ && data->post_init != NULL)
+ /* Post architecture creation: pass the entire architecture
+ (as all fields are valid), but be careful to also detect
+ recursive references. */
+ {
+ gdb_assert (data->init_p);
+ data->init_p = 0;
+ gdbarch->data[data->index] = data->post_init (gdbarch);
+ data->init_p = 1;
+ }
+ else
+ /* The architecture initialization hasn't completed - punt -
+ hope that the caller knows what they are doing. Once
+ deprecated_set_gdbarch_data has been initialized, this can be
+ changed to an internal error. */
+ return NULL;
gdb_assert (gdbarch->data[data->index] != NULL);
}
return gdbarch->data[data->index];
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index 3f01249..2280cfa 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -48,6 +48,7 @@ struct reggroup;
struct regset;
struct disassemble_info;
struct target_ops;
+struct obstack;
extern struct gdbarch *current_gdbarch;
@@ -2517,10 +2518,6 @@ extern void deprecated_current_gdbarch_select_hack (struct gdbarch *gdbarch);
for the reserved data-pointer is returned. That identifer should
be saved in a local static variable.
- The per-architecture data-pointer is either initialized explicitly
- (set_gdbarch_data()) or implicitly (by INIT() via a call to
- gdbarch_data()).
-
Memory for the per-architecture data shall be allocated using
gdbarch_obstack_zalloc. That memory will be deleted when the
corresponding architecture object is deleted.
@@ -2534,11 +2531,13 @@ extern void deprecated_current_gdbarch_select_hack (struct gdbarch *gdbarch);
struct gdbarch_data;
-typedef void *(gdbarch_data_init_ftype) (struct gdbarch *gdbarch);
-extern struct gdbarch_data *register_gdbarch_data (gdbarch_data_init_ftype *init);
-extern void set_gdbarch_data (struct gdbarch *gdbarch,
- struct gdbarch_data *data,
- void *pointer);
+typedef void *(gdbarch_data_pre_init_ftype) (struct obstack *obstack);
+extern struct gdbarch_data *gdbarch_data_register_pre_init (gdbarch_data_pre_init_ftype *init);
+typedef void *(gdbarch_data_post_init_ftype) (struct gdbarch *gdbarch);
+extern struct gdbarch_data *gdbarch_data_register_post_init (gdbarch_data_post_init_ftype *init);
+extern void deprecated_set_gdbarch_data (struct gdbarch *gdbarch,
+ struct gdbarch_data *data,
+ void *pointer);
extern void *gdbarch_data (struct gdbarch *gdbarch, struct gdbarch_data *);
@@ -2554,7 +2553,7 @@ extern void *gdbarch_data (struct gdbarch *gdbarch, struct gdbarch_data *);
Memory regions are swapped / initialized in the order that they are
registered. NULL DATA and/or INIT values can be specified.
- New code should use register_gdbarch_data(). */
+ New code should use gdbarch_data_register_*(). */
typedef void (gdbarch_swap_ftype) (void);
extern void deprecated_register_gdbarch_swap (void *data, unsigned long size, gdbarch_swap_ftype *init);
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index df3b102..f5d6b05 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -890,6 +890,7 @@ struct reggroup;
struct regset;
struct disassemble_info;
struct target_ops;
+struct obstack;
extern struct gdbarch *current_gdbarch;
@@ -1201,10 +1202,6 @@ extern void deprecated_current_gdbarch_select_hack (struct gdbarch *gdbarch);
for the reserved data-pointer is returned. That identifer should
be saved in a local static variable.
- The per-architecture data-pointer is either initialized explicitly
- (set_gdbarch_data()) or implicitly (by INIT() via a call to
- gdbarch_data()).
-
Memory for the per-architecture data shall be allocated using
gdbarch_obstack_zalloc. That memory will be deleted when the
corresponding architecture object is deleted.
@@ -1218,11 +1215,13 @@ extern void deprecated_current_gdbarch_select_hack (struct gdbarch *gdbarch);
struct gdbarch_data;
-typedef void *(gdbarch_data_init_ftype) (struct gdbarch *gdbarch);
-extern struct gdbarch_data *register_gdbarch_data (gdbarch_data_init_ftype *init);
-extern void set_gdbarch_data (struct gdbarch *gdbarch,
- struct gdbarch_data *data,
- void *pointer);
+typedef void *(gdbarch_data_pre_init_ftype) (struct obstack *obstack);
+extern struct gdbarch_data *gdbarch_data_register_pre_init (gdbarch_data_pre_init_ftype *init);
+typedef void *(gdbarch_data_post_init_ftype) (struct gdbarch *gdbarch);
+extern struct gdbarch_data *gdbarch_data_register_post_init (gdbarch_data_post_init_ftype *init);
+extern void deprecated_set_gdbarch_data (struct gdbarch *gdbarch,
+ struct gdbarch_data *data,
+ void *pointer);
extern void *gdbarch_data (struct gdbarch *gdbarch, struct gdbarch_data *);
@@ -1238,7 +1237,7 @@ extern void *gdbarch_data (struct gdbarch *gdbarch, struct gdbarch_data *);
Memory regions are swapped / initialized in the order that they are
registered. NULL DATA and/or INIT values can be specified.
- New code should use register_gdbarch_data(). */
+ New code should use gdbarch_data_register_*(). */
typedef void (gdbarch_swap_ftype) (void);
extern void deprecated_register_gdbarch_swap (void *data, unsigned long size, gdbarch_swap_ftype *init);
@@ -1811,7 +1810,8 @@ struct gdbarch_data
{
unsigned index;
int init_p;
- gdbarch_data_init_ftype *init;
+ gdbarch_data_pre_init_ftype *pre_init;
+ gdbarch_data_post_init_ftype *post_init;
};
struct gdbarch_data_registration
@@ -1831,8 +1831,9 @@ struct gdbarch_data_registry gdbarch_data_registry =
0, NULL,
};
-struct gdbarch_data *
-register_gdbarch_data (gdbarch_data_init_ftype *init)
+static struct gdbarch_data *
+gdbarch_data_register (gdbarch_data_pre_init_ftype *pre_init,
+ gdbarch_data_post_init_ftype *post_init)
{
struct gdbarch_data_registration **curr;
/* Append the new registraration. */
@@ -1843,11 +1844,23 @@ register_gdbarch_data (gdbarch_data_init_ftype *init)
(*curr)->next = NULL;
(*curr)->data = XMALLOC (struct gdbarch_data);
(*curr)->data->index = gdbarch_data_registry.nr++;
- (*curr)->data->init = init;
+ (*curr)->data->pre_init = pre_init;
+ (*curr)->data->post_init = post_init;
(*curr)->data->init_p = 1;
return (*curr)->data;
}
+struct gdbarch_data *
+gdbarch_data_register_pre_init (gdbarch_data_pre_init_ftype *pre_init)
+{
+ return gdbarch_data_register (pre_init, NULL);
+}
+
+struct gdbarch_data *
+gdbarch_data_register_post_init (gdbarch_data_post_init_ftype *post_init)
+{
+ return gdbarch_data_register (NULL, post_init);
+}
/* Create/delete the gdbarch data vector. */
@@ -1863,12 +1876,13 @@ alloc_gdbarch_data (struct gdbarch *gdbarch)
data-pointer. */
void
-set_gdbarch_data (struct gdbarch *gdbarch,
- struct gdbarch_data *data,
- void *pointer)
+deprecated_set_gdbarch_data (struct gdbarch *gdbarch,
+ struct gdbarch_data *data,
+ void *pointer)
{
gdb_assert (data->index < gdbarch->nr_data);
gdb_assert (gdbarch->data[data->index] == NULL);
+ gdb_assert (data->pre_init == NULL);
gdbarch->data[data->index] = pointer;
}
@@ -1879,18 +1893,33 @@ void *
gdbarch_data (struct gdbarch *gdbarch, struct gdbarch_data *data)
{
gdb_assert (data->index < gdbarch->nr_data);
- /* The data-pointer isn't initialized, call init() to get a value but
- only if the architecture initializaiton has completed. Otherwise
- punt - hope that the caller knows what they are doing. */
- if (gdbarch->data[data->index] == NULL
- && gdbarch->initialized_p)
+ if (gdbarch->data[data->index] == NULL)
{
- /* Be careful to detect an initialization cycle. */
- gdb_assert (data->init_p);
- data->init_p = 0;
- gdb_assert (data->init != NULL);
- gdbarch->data[data->index] = data->init (gdbarch);
- data->init_p = 1;
+ /* The data-pointer isn't initialized, call init() to get a
+ value. */
+ if (data->pre_init != NULL)
+ /* Mid architecture creation: pass just the obstack, and not
+ the entire architecture, as that way it isn't possible for
+ pre-init code to refer to undefined architecture
+ fields. */
+ gdbarch->data[data->index] = data->pre_init (gdbarch->obstack);
+ else if (gdbarch->initialized_p
+ && data->post_init != NULL)
+ /* Post architecture creation: pass the entire architecture
+ (as all fields are valid), but be careful to also detect
+ recursive references. */
+ {
+ gdb_assert (data->init_p);
+ data->init_p = 0;
+ gdbarch->data[data->index] = data->post_init (gdbarch);
+ data->init_p = 1;
+ }
+ else
+ /* The architecture initialization hasn't completed - punt -
+ hope that the caller knows what they are doing. Once
+ deprecated_set_gdbarch_data has been initialized, this can be
+ changed to an internal error. */
+ return NULL;
gdb_assert (gdbarch->data[data->index] != NULL);
}
return gdbarch->data[data->index];
diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c
index 0fbdd6e..195af26 100644
--- a/gdb/gnu-v3-abi.c
+++ b/gdb/gnu-v3-abi.c
@@ -422,7 +422,7 @@ gnuv3_baseclass_offset (struct type *type, int index, char *valaddr,
static void
init_gnuv3_ops (void)
{
- vtable_type_gdbarch_data = register_gdbarch_data (build_gdb_vtable_type);
+ vtable_type_gdbarch_data = gdbarch_data_register_post_init (build_gdb_vtable_type);
gnu_v3_abi_ops.shortname = "gnu-v3";
gnu_v3_abi_ops.longname = "GNU G++ Version 3 ABI";
diff --git a/gdb/libunwind-frame.c b/gdb/libunwind-frame.c
index bf0c36d..d7e8dbc 100644
--- a/gdb/libunwind-frame.c
+++ b/gdb/libunwind-frame.c
@@ -111,7 +111,7 @@ libunwind_frame_set_descr (struct gdbarch *gdbarch, struct libunwind_descr *desc
{
/* First time here. Must initialize data area. */
arch_descr = libunwind_descr_init (gdbarch);
- set_gdbarch_data (gdbarch, libunwind_descr_handle, arch_descr);
+ deprecated_set_gdbarch_data (gdbarch, libunwind_descr_handle, arch_descr);
}
/* Copy new descriptor info into arch descriptor. */
@@ -381,7 +381,7 @@ void _initialize_libunwind_frame (void);
void
_initialize_libunwind_frame (void)
{
- libunwind_descr_handle = register_gdbarch_data (libunwind_descr_init);
+ libunwind_descr_handle = gdbarch_data_register_post_init (libunwind_descr_init);
libunwind_initialized = libunwind_load ();
}
diff --git a/gdb/mips-linux-tdep.c b/gdb/mips-linux-tdep.c
index cc8ae5f..7e59eb1 100644
--- a/gdb/mips-linux-tdep.c
+++ b/gdb/mips-linux-tdep.c
@@ -668,7 +668,7 @@ static void
set_mips_linux_register_addr (struct gdbarch *gdbarch,
CORE_ADDR (*register_addr_ptr) (int, CORE_ADDR))
{
- set_gdbarch_data (gdbarch, register_addr_data, register_addr_ptr);
+ deprecated_set_gdbarch_data (gdbarch, register_addr_data, register_addr_ptr);
}
static void *
@@ -844,7 +844,7 @@ _initialize_mips_linux_tdep (void)
const struct bfd_arch_info *arch_info;
register_addr_data =
- register_gdbarch_data (init_register_addr_data);
+ gdbarch_data_register_post_init (init_register_addr_data);
for (arch_info = bfd_lookup_arch (bfd_arch_mips, 0);
arch_info != NULL;
diff --git a/gdb/regcache.c b/gdb/regcache.c
index 154fc5e..c455e46 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -1705,7 +1705,7 @@ extern initialize_file_ftype _initialize_regcache; /* -Wmissing-prototype */
void
_initialize_regcache (void)
{
- regcache_descr_handle = register_gdbarch_data (init_regcache_descr);
+ regcache_descr_handle = gdbarch_data_register_post_init (init_regcache_descr);
DEPRECATED_REGISTER_GDBARCH_SWAP (current_regcache);
DEPRECATED_REGISTER_GDBARCH_SWAP (deprecated_registers);
DEPRECATED_REGISTER_GDBARCH_SWAP (deprecated_register_valid);
diff --git a/gdb/reggroups.c b/gdb/reggroups.c
index 7dd0562..c20f886 100644
--- a/gdb/reggroups.c
+++ b/gdb/reggroups.c
@@ -109,7 +109,7 @@ reggroup_add (struct gdbarch *gdbarch, struct reggroup *group)
/* ULGH, called during architecture initialization. Patch
things up. */
groups = reggroups_init (gdbarch);
- set_gdbarch_data (gdbarch, reggroups_data, groups);
+ deprecated_set_gdbarch_data (gdbarch, reggroups_data, groups);
}
add_group (groups, group,
GDBARCH_OBSTACK_ZALLOC (gdbarch, struct reggroup_el));
@@ -268,7 +268,7 @@ extern initialize_file_ftype _initialize_reggroup; /* -Wmissing-prototypes */
void
_initialize_reggroup (void)
{
- reggroups_data = register_gdbarch_data (reggroups_init);
+ reggroups_data = gdbarch_data_register_post_init (reggroups_init);
/* The pre-defined list of groups. */
add_group (&default_groups, general_reggroup, XMALLOC (struct reggroup_el));
diff --git a/gdb/remote.c b/gdb/remote.c
index 29bbbc8..a5cb219 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -5456,7 +5456,7 @@ _initialize_remote (void)
struct cmd_list_element *tmpcmd;
/* architecture specific data */
- remote_gdbarch_data_handle = register_gdbarch_data (init_remote_state);
+ remote_gdbarch_data_handle = gdbarch_data_register_post_init (init_remote_state);
/* Old tacky stuff. NOTE: This comes after the remote protocol so
that the remote protocol has been initialized. */
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
index 020a55c..abf2948 100644
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -1486,7 +1486,7 @@ void
set_solib_svr4_fetch_link_map_offsets (struct gdbarch *gdbarch,
struct link_map_offsets *(*flmo) (void))
{
- set_gdbarch_data (gdbarch, fetch_link_map_offsets_gdbarch_data, flmo);
+ deprecated_set_gdbarch_data (gdbarch, fetch_link_map_offsets_gdbarch_data, flmo);
}
/* Initialize the architecture-specific link_map_offsets fetcher.
@@ -1584,7 +1584,7 @@ void
_initialize_svr4_solib (void)
{
fetch_link_map_offsets_gdbarch_data =
- register_gdbarch_data (init_fetch_link_map_offsets);
+ gdbarch_data_register_post_init (init_fetch_link_map_offsets);
svr4_so_ops.relocate_section_addresses = svr4_relocate_section_addresses;
svr4_so_ops.free_so = svr4_free_so;
diff --git a/gdb/user-regs.c b/gdb/user-regs.c
index 9de177f..b611d60 100644
--- a/gdb/user-regs.c
+++ b/gdb/user-regs.c
@@ -110,7 +110,7 @@ user_reg_add (struct gdbarch *gdbarch, const char *name,
/* ULGH, called during architecture initialization. Patch
things up. */
regs = user_regs_init (gdbarch);
- set_gdbarch_data (gdbarch, user_regs_data, regs);
+ deprecated_set_gdbarch_data (gdbarch, user_regs_data, regs);
}
append_user_reg (regs, name, read,
GDBARCH_OBSTACK_ZALLOC (gdbarch, struct user_reg));
@@ -207,5 +207,5 @@ extern initialize_file_ftype _initialize_user_regs; /* -Wmissing-prototypes */
void
_initialize_user_regs (void)
{
- user_regs_data = register_gdbarch_data (user_regs_init);
+ user_regs_data = gdbarch_data_register_post_init (user_regs_init);
}