diff options
author | Andrew Burgess <andrew.burgess@embecosm.com> | 2020-06-08 14:06:08 +0100 |
---|---|---|
committer | Andrew Burgess <andrew.burgess@embecosm.com> | 2020-07-06 15:06:04 +0100 |
commit | 3bc98c0c832f5bdca364e083f92be687dbf494cc (patch) | |
tree | 1d49e95a06e01e11c336f57c28b0d925a6bdd89b /gdb/user-regs.c | |
parent | d8cc8af6a1787f9c2eafc62a36ac86cf4d08c89c (diff) | |
download | gdb-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/user-regs.c')
-rw-r--r-- | gdb/user-regs.c | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/gdb/user-regs.c b/gdb/user-regs.c index cb92231..d461f85 100644 --- a/gdb/user-regs.c +++ b/gdb/user-regs.c @@ -98,16 +98,15 @@ user_reg_add_builtin (const char *name, user_reg_read_ftype *xread, static struct gdbarch_data *user_regs_data; static void * -user_regs_init (struct gdbarch *gdbarch) +user_regs_init (struct obstack *obstack) { struct user_reg *reg; - struct gdb_user_regs *regs - = GDBARCH_OBSTACK_ZALLOC (gdbarch, struct gdb_user_regs); + struct gdb_user_regs *regs = OBSTACK_ZALLOC (obstack, struct gdb_user_regs); regs->last = ®s->first; for (reg = builtin_user_regs.first; reg != NULL; reg = reg->next) append_user_reg (regs, reg->name, reg->xread, reg->baton, - GDBARCH_OBSTACK_ZALLOC (gdbarch, struct user_reg)); + OBSTACK_ZALLOC (obstack, struct user_reg)); return regs; } @@ -117,14 +116,7 @@ user_reg_add (struct gdbarch *gdbarch, const char *name, { struct gdb_user_regs *regs = (struct gdb_user_regs *) gdbarch_data (gdbarch, user_regs_data); - - if (regs == NULL) - { - /* ULGH, called during architecture initialization. Patch - things up. */ - regs = (struct gdb_user_regs *) user_regs_init (gdbarch); - deprecated_set_gdbarch_data (gdbarch, user_regs_data, regs); - } + gdb_assert (regs != NULL); append_user_reg (regs, name, xread, baton, GDBARCH_OBSTACK_ZALLOC (gdbarch, struct user_reg)); } @@ -240,7 +232,7 @@ void _initialize_user_regs (); void _initialize_user_regs () { - user_regs_data = gdbarch_data_register_post_init (user_regs_init); + user_regs_data = gdbarch_data_register_pre_init (user_regs_init); add_cmd ("user-registers", class_maintenance, maintenance_print_user_registers, |