aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbarch.c
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2020-06-08 14:06:08 +0100
committerAndrew Burgess <andrew.burgess@embecosm.com>2020-07-06 15:06:04 +0100
commit3bc98c0c832f5bdca364e083f92be687dbf494cc (patch)
tree1d49e95a06e01e11c336f57c28b0d925a6bdd89b /gdb/gdbarch.c
parentd8cc8af6a1787f9c2eafc62a36ac86cf4d08c89c (diff)
downloadgdb-3bc98c0c832f5bdca364e083f92be687dbf494cc.zip
gdb-3bc98c0c832f5bdca364e083f92be687dbf494cc.tar.gz
gdb-3bc98c0c832f5bdca364e083f92be687dbf494cc.tar.bz2
gdb: Remove deprecated_set_gdbarch_data
There are currently two remaining uses of deprecated_set_gdbarch_data, both of which are needed because during gdbarch initialisation we call gdbarch_data for a data field that is registered using: gdbarch_data_register_post_init (....) However, in both of these cases, the only thing that the call back needs from the gdbarch struct is its obstack. Given this there is nothing stopping us changing the post-init hooks into pre-init hooks. The pre-init hooks don't get passed the full gdbarch, they only get passed its obstack. The IA64 change is completely untested. The user-regs change has been tested a little by locally adding some user-regs to the x86-64 target, and also by running the RISC-V tests, which do use user-regs. gdb/ChangeLog: * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (deprecated_set_gdbarch_data): Delete. (gdbarch_data): Use internal_error for the case where deprecated_set_gdbarch_data was originally needed. * ia64-libunwind-tdep.c (libunwind_descr_init): Update parameters, and use passed in obstack. (libunwind_frame_set_descr): Should no longer get back NULL from gdbarch_data. (_initialize_libunwind_frame): Register as a pre-init gdbarch data type. * user-regs.c (user_regs_init): Update parameters, and use passed in obstack. (user_reg_add): Should no longer get back NULL from gdbarch_data. (_initialize_user_regs): Register as a pre-init gdbarch data type.
Diffstat (limited to 'gdb/gdbarch.c')
-rw-r--r--gdb/gdbarch.c22
1 files changed, 3 insertions, 19 deletions
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index 6d1bb0d..21ee840 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -5208,20 +5208,6 @@ alloc_gdbarch_data (struct gdbarch *gdbarch)
gdbarch->data = GDBARCH_OBSTACK_CALLOC (gdbarch, gdbarch->nr_data, void *);
}
-/* Initialize the current value of the specified per-architecture
- data-pointer. */
-
-void
-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;
-}
-
/* Return the current value of the specified per-architecture
data-pointer. */
@@ -5251,11 +5237,9 @@ gdbarch_data (struct gdbarch *gdbarch, struct gdbarch_data *data)
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;
+ internal_error (__FILE__, __LINE__,
+ _("gdbarch post-init data field can only be used "
+ "after gdbarch is fully initialised"));
gdb_assert (gdbarch->data[data->index] != NULL);
}
return gdbarch->data[data->index];