]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[ARM] Small refactoring of arm gdbarch initialization
authorLuis Machado <luis.machado@linaro.org>
Mon, 4 Oct 2021 12:34:50 +0000 (09:34 -0300)
committerLuis Machado <luis.machado@linaro.org>
Mon, 11 Oct 2021 19:03:48 +0000 (16:03 -0300)
This is in preparation to MVE support, where we will define another
pseudo register. We need to define the pseudo register numbers *after*
accounting for all the registers in the XML description, so move
the call to tdesc_use_registers up.

If we don't do it, GDB's register count won't consider registers contained
in the XML but ignored by GDB, throwing the register numbering off.

gdb/arm-tdep.c

index ab6999ae2094757de4bbfb4f566f31e4d234357c..2a6bfb1b3f770ae743e1124e14be0491f25cecac 100644 (file)
@@ -9470,6 +9470,17 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
       set_gdbarch_long_double_format (gdbarch, floatformats_ieee_double);
     }
 
+  if (tdesc_data != nullptr)
+    {
+      set_tdesc_pseudo_register_name (gdbarch, arm_register_name);
+
+      tdesc_use_registers (gdbarch, tdesc, std::move (tdesc_data));
+
+      /* Override tdesc_register_type to adjust the types of VFP
+        registers for NEON.  */
+      set_gdbarch_register_type (gdbarch, arm_register_type);
+    }
+
   if (have_vfp_pseudos)
     {
       /* NOTE: These are the only pseudo registers used by
@@ -9484,17 +9495,6 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
       set_gdbarch_pseudo_register_write (gdbarch, arm_pseudo_write);
     }
 
-  if (tdesc_data != nullptr)
-    {
-      set_tdesc_pseudo_register_name (gdbarch, arm_register_name);
-
-      tdesc_use_registers (gdbarch, tdesc, std::move (tdesc_data));
-
-      /* Override tdesc_register_type to adjust the types of VFP
-        registers for NEON.  */
-      set_gdbarch_register_type (gdbarch, arm_register_type);
-    }
-
   /* Add standard register aliases.  We add aliases even for those
      names which are used by the current architecture - it's simpler,
      and does no harm, since nothing ever lists user registers.  */