* infrun.c (adjust_pc_after_break): Do not assume software single-step
[deliverable/binutils-gdb.git] / gdb / target-descriptions.c
index 7d6652d351bbf249076f110d3fc4847efbbb535f..6df4547e8bf7d8fa5e8a3ff90ba3015f4170aa26 100644 (file)
@@ -486,7 +486,10 @@ tdesc_find_register (struct gdbarch *gdbarch, int regno)
     return NULL;
 }
 
-static const char *
+/* Return the name of register REGNO, from the target description or
+   from an architecture-provided pseudo_register_name method.  */
+
+const char *
 tdesc_register_name (int regno)
 {
   struct tdesc_reg *reg = tdesc_find_register (current_gdbarch, regno);
@@ -582,8 +585,9 @@ tdesc_remote_register_number (struct gdbarch *gdbarch, int regno)
 
 /* Check whether REGNUM is a member of REGGROUP.  Registers from the
    target description may be classified as general, float, or vector.
-   Registers with no group specified go to the default reggroup
-   function and are handled by type.
+   Unlike a gdbarch register_reggroup_p method, this function will
+   return -1 if it does not know; the caller should handle registers
+   with no specified group.
 
    Arbitrary strings (other than "general", "float", and "vector")
    from the description are not used; they cause the register to be
@@ -594,21 +598,12 @@ tdesc_remote_register_number (struct gdbarch *gdbarch, int regno)
 
    The save-restore flag is also implemented here.  */
 
-static int
-tdesc_register_reggroup_p (struct gdbarch *gdbarch, int regno,
-                          struct reggroup *reggroup)
+int
+tdesc_register_in_reggroup_p (struct gdbarch *gdbarch, int regno,
+                             struct reggroup *reggroup)
 {
-  int num_regs = gdbarch_num_regs (gdbarch);
-  int num_pseudo_regs = gdbarch_num_pseudo_regs (gdbarch);
   struct tdesc_reg *reg = tdesc_find_register (gdbarch, regno);
 
-  if (reg == NULL && regno >= num_regs && regno < num_regs + num_pseudo_regs)
-    {
-      struct tdesc_arch_data *data = gdbarch_data (gdbarch, tdesc_data);
-      gdb_assert (data->pseudo_register_reggroup_p != NULL);
-      return data->pseudo_register_reggroup_p (gdbarch, regno, reggroup);
-    }
-
   if (reg != NULL && reg->group != NULL)
     {
       int general_p = 0, float_p = 0, vector_p = 0;
@@ -634,6 +629,32 @@ tdesc_register_reggroup_p (struct gdbarch *gdbarch, int regno,
       && (reggroup == save_reggroup || reggroup == restore_reggroup))
     return reg->save_restore;
 
+  return -1;
+}
+
+/* Check whether REGNUM is a member of REGGROUP.  Registers with no
+   group specified go to the default reggroup function and are handled
+   by type.  */
+
+static int
+tdesc_register_reggroup_p (struct gdbarch *gdbarch, int regno,
+                          struct reggroup *reggroup)
+{
+  int num_regs = gdbarch_num_regs (gdbarch);
+  int num_pseudo_regs = gdbarch_num_pseudo_regs (gdbarch);
+  int ret;
+
+  if (regno >= num_regs && regno < num_regs + num_pseudo_regs)
+    {
+      struct tdesc_arch_data *data = gdbarch_data (gdbarch, tdesc_data);
+      gdb_assert (data->pseudo_register_reggroup_p != NULL);
+      return data->pseudo_register_reggroup_p (gdbarch, regno, reggroup);
+    }
+
+  ret = tdesc_register_in_reggroup_p (gdbarch, regno, reggroup);
+  if (ret != -1)
+    return ret;
+
   return default_register_reggroup_p (gdbarch, regno, reggroup);
 }
 
@@ -717,7 +738,7 @@ tdesc_use_registers (struct gdbarch *gdbarch,
       htab_remove_elt (reg_hash, reg);
 
   /* Assign numbers to the remaining registers and add them to the
-     list of registers.  The new numbers are always above NUM_REGS.
+     list of registers.  The new numbers are always above gdbarch_num_regs.
      Iterate over the features, not the hash table, so that the order
      matches that in the target description.  */
 
This page took 0.024268 seconds and 4 git commands to generate.