gdb: set only inferior_ptid in sparc_{fetch,store}_inferior_registers
[binutils-gdb.git] / gdb / user-regs.c
index cb922313b0c855b616ba8228022f3245882f4548..5845eb13a5a418baf159f4442b32f28abafa6c68 100644 (file)
@@ -1,6 +1,6 @@
 /* User visible, per-frame registers, for GDB, the GNU debugger.
 
-   Copyright (C) 2002-2020 Free Software Foundation, Inc.
+   Copyright (C) 2002-2021 Free Software Foundation, Inc.
 
    Contributed by Red Hat.
 
@@ -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 = &regs->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,