Uniquefy gdb.threads/attach-into-signal.exp
[deliverable/binutils-gdb.git] / gdb / reggroups.c
index 66b5c7867bece8f496ad52fcc2a6ce7cdc42b848..745c5ea5de89e713ad00a43be7e449dbc337a4c1 100644 (file)
@@ -1,6 +1,6 @@
 /* Register groupings for GDB, the GNU debugger.
 
-   Copyright (C) 2002-2014 Free Software Foundation, Inc.
+   Copyright (C) 2002-2015 Free Software Foundation, Inc.
 
    Contributed by Red Hat.
 
@@ -150,6 +150,35 @@ reggroup_next (struct gdbarch *gdbarch, struct reggroup *last)
   return NULL;
 }
 
+/* See reggroups.h.  */
+
+struct reggroup *
+reggroup_prev (struct gdbarch *gdbarch, struct reggroup *curr)
+{
+  struct reggroups *groups;
+  struct reggroup_el *el;
+  struct reggroup *prev;
+
+  /* Don't allow this function to be called during architecture
+     creation.  If there are no groups, use the default groups list.  */
+  groups = gdbarch_data (gdbarch, reggroups_data);
+  gdb_assert (groups != NULL);
+  if (groups->first == NULL)
+    groups = &default_groups;
+
+  prev = NULL;
+  for (el = groups->first; el != NULL; el = el->next)
+    {
+      gdb_assert (el->group != NULL);
+      if (el->group == curr)
+       return prev;
+      prev = el->group;
+    }
+  if (curr == NULL)
+    return prev;
+  return NULL;
+}
+
 /* Is REGNUM a member of REGGROUP?  */
 int
 default_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
This page took 0.023653 seconds and 4 git commands to generate.