+2020-07-06 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * 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.
+
2020-07-06 Tom de Vries <tdevries@suse.de>
* buildsym.c (buildsym_compunit::end_symtab_with_blockvector): Handle
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. */
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];
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 *);
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 *);
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. */
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];
}
static void *
-libunwind_descr_init (struct gdbarch *gdbarch)
+libunwind_descr_init (struct obstack *obstack)
{
struct libunwind_descr *descr
- = GDBARCH_OBSTACK_ZALLOC (gdbarch, struct libunwind_descr);
+ = OBSTACK_ZALLOC (obstack, struct libunwind_descr);
return descr;
}
arch_descr = ((struct libunwind_descr *)
gdbarch_data (gdbarch, libunwind_descr_handle));
-
- if (arch_descr == NULL)
- {
- /* First time here. Must initialize data area. */
- arch_descr = (struct libunwind_descr *) libunwind_descr_init (gdbarch);
- deprecated_set_gdbarch_data (gdbarch,
- libunwind_descr_handle, arch_descr);
- }
+ gdb_assert (arch_descr != NULL);
/* Copy new descriptor info into arch descriptor. */
arch_descr->gdb2uw = descr->gdb2uw;
_initialize_libunwind_frame ()
{
libunwind_descr_handle
- = gdbarch_data_register_post_init (libunwind_descr_init);
+ = gdbarch_data_register_pre_init (libunwind_descr_init);
libunwind_initialized = libunwind_load ();
}
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;
}
{
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));
}
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,