Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <ac131313@redhat.com>
To: gdb-patches@sources.redhat.com
Subject: [patch/rfc; rfa:doco] Add reggroups and their maint commands
Date: Tue, 22 Oct 2002 17:41:00 -0000	[thread overview]
Message-ID: <3DB5F04A.2090005@redhat.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 2394 bytes --]

Hello,

This patch pulls the reggroup framework in from my sysregs branch and 
adds it to GDB.  The reggroups framework makes it possible for an 
architecture to group the ISAs registers into a number of different 
categories.  Some groups are user-level, some are internal.  For instance:

User:
vector - vector registers
float - floating-point registers

Internal:
restore - registers to restore after performing an inferior function call

It makes the following changes:

- adds maintenance commands for displaying the register / groups and 
includes documentation.

(gdb) maint print register-groups
  Name         Nr  Rel Offset    Size  Type            Groups
  eax           0    0      0       4  int 
general,all,save,restore
  ecx           1    1      4       4  int 
general,all,save,restore
  edx           2    2      8       4  int 
general,all,save,restore
  ebx           3    3     12       4  int 
general,all,save,restore
  esp           4    4     16       4  *1 
general,all,save,restore
  ebp           5    5     20       4  *1 
general,all,save,restore
  esi           6    6     24       4  int 
general,all,save,restore
...
(gdb) maint print reggroups
  Group      Type
  general    user
  float      user
  system     user
  vector     user
  all        user
  save       internal
  restore    internal

- adds the files reggroups.[hc] which implement the `struct reggroup' 
object and reggroups() method.

- adds the architecture method:
	register_reggroup_p(gdbarch, regnum, reggroup)
to identify a register's group membership (provides a default).

Follow-on patches will modify varios parts of core GDB so that the 
mechanism is used vis:

- modify the default ``info registers'', ``info vector'' and ``info 
float'' and ``info all-registers'' commands so that reggroups are used 
to determine which registers should be displayed.

- modify the i386 to better specify the register groups (so that ``info 
vector'' displays all the SSE/MMX registers for instance.

- modify the regcache save/restore code so that it uses reggroups when 
determining which registers should be saved/restored across an inferior 
function call

Comments.

Eli, now does the revised doco look?  You've seen ``maint print 
reggroups'' before, but ``maint print register-groups'' is new.

I'll look to commit it next week.

The full internals doco is still work-in-progress :-(

Andrew

[-- Attachment #2: diffs --]
[-- Type: text/plain, Size: 21420 bytes --]

Index: ChangeLog
2002-10-22  Andrew Cagney  <cagney@redhat.com>

	* reggroups.h, reggroups.c: New files.
	* regcache.c: Include "reggroups.h".
	(enum regcache_dump_what): Add `regcache_dump_groups'.
	(regcache_dump): Contract size of the "Type" column.  When
	specified, dump the register's groups.
	(maintenance_print_register_groups): New function.
	(_initialize_regcache): Add command `maint print register-groups'.
	* Makefile.in (COMMON_OBS): Add reggroups.o
	(SFILES): Add reggroups.c.
	(reggroups_h): Define.
	(regcache.o, gdbarch.o): Update dependencies.
	(reggroups.o): Specify dependencies.
	* gdbarch.sh (register_reggroup_p): Add pure multi-arch method.
	Add opaque declaration for `struct reggroup' in generated .h file.
	Include "reggroups.h" in generated .c file.
	gdbarch.h, gdbarch.c: Re-generate.

Index: doc/ChangeLog
2002-10-22  Andrew Cagney  <cagney@redhat.com>

	* gdb.texinfo (Maintenance Commands): Document `maint print
	reggroups' and `maint print register-groups'.
	* gdbint.texinfo (Target Architecture Definition): Document
	register_reggroup_p.

Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.271
diff -u -r1.271 Makefile.in
--- Makefile.in	20 Oct 2002 20:27:19 -0000	1.271
+++ Makefile.in	23 Oct 2002 00:34:10 -0000
@@ -550,7 +550,7 @@
 	nlmread.c \
 	objfiles.c osabi.c \
 	p-exp.y p-lang.c p-typeprint.c p-valprint.c parse.c printcmd.c \
-	regcache.c remote.c \
+	regcache.c reggroups.c remote.c \
 	scm-exp.c scm-lang.c scm-valprint.c serial.c ser-unix.c source.c \
 	stabsread.c stack.c std-regs.c symfile.c symmisc.c symtab.c \
 	target.c thread.c top.c tracepoint.c typeprint.c \
@@ -698,6 +698,7 @@
 ppcnbsd_tdep_h = ppcnbsd-tdep.h
 proc_utils_h = proc-utils.h
 regcache_h = regcache.h
+reggroups_h = reggroups.h
 remote_utils_h = remote-utils.h $(target_h)
 remote_h = remote.h
 scm_lang_h = scm-lang.h $(scm_tags_h)
@@ -854,7 +855,8 @@
 	nlmread.o serial.o mdebugread.o top.o utils.o \
 	ui-file.o \
 	frame.o doublest.o \
-	gnu-v2-abi.o gnu-v3-abi.o hpacc-abi.o cp-abi.o cp-support.o
+	gnu-v2-abi.o gnu-v3-abi.o hpacc-abi.o cp-abi.o cp-support.o \
+	reggroups.o
 
 OBS = $(COMMON_OBS) $(ANNOTATE_OBS)
 
@@ -1685,7 +1687,7 @@
 	$(gdb_string_h) $(symtab_h) $(frame_h) $(inferior_h) $(breakpoint_h) \
 	$(gdb_wait_h) $(gdbcore_h) $(gdbcmd_h) $(target_h) $(gdbthread_h) \
 	$(annotate_h) $(symfile_h) $(value_h) $(symcat_h) $(floatformat_h) \
-	$(gdb_assert_h) $(gdb_string_h) $(gdb_events_h)
+	$(gdb_assert_h) $(gdb_string_h) $(gdb_events_h) $(reggroups_h)
 gdbtypes.o: gdbtypes.c $(defs_h) $(gdb_string_h) $(bfd_h) $(symtab_h) \
 	$(symfile_h) $(objfiles_h) $(gdbtypes_h) $(expression_h) \
 	$(language_h) $(target_h) $(value_h) $(demangle_h) $(complaints_h) \
@@ -2003,8 +2005,10 @@
 ptx4-nat.o: ptx4-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) $(regcache_h) \
 	$(gregset_h)
 regcache.o: regcache.c $(defs_h) $(inferior_h) $(target_h) $(gdbarch_h) \
-	$(gdbcmd_h) $(regcache_h) $(gdb_assert_h) $(gdb_string_h) \
-	$(gdbcmd_h)
+	$(gdbcmd_h) $(regcache_h) $(reggroups_h) $(gdb_assert_h) \
+	$(gdb_string_h) $(gdbcmd_h)
+reggroups.o: reggroups.c $(defs_h) $(reggroups_h) $(gdbtypes_h) \
+	$(gdb_assert_h) $(regcache_h) $(command_h) $(gdbcmd_h)
 remote-array.o: remote-array.c $(defs_h) $(gdbcore_h) $(target_h) \
 	$(gdb_string_h) $(command_h) $(serial_h) $(monitor_h) \
 	$(remote_utils_h) $(inferior_h) $(version_h) $(regcache_h)
Index: gdbarch.sh
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.sh,v
retrieving revision 1.165
diff -u -r1.165 gdbarch.sh
--- gdbarch.sh	16 Oct 2002 20:50:21 -0000	1.165
+++ gdbarch.sh	23 Oct 2002 00:34:18 -0000
@@ -667,6 +667,8 @@
 F:2:ADDRESS_CLASS_TYPE_FLAGS:int:address_class_type_flags:int byte_size, int dwarf2_addr_class:byte_size, dwarf2_addr_class
 F:2:ADDRESS_CLASS_TYPE_FLAGS_TO_NAME:char *:address_class_type_flags_to_name:int type_flags:type_flags
 F:2:ADDRESS_CLASS_NAME_TO_TYPE_FLAGS:int:address_class_name_to_type_flags:char *name, int *type_flags_ptr:name, type_flags_ptr
+# Is a register in a group
+m:::int:register_reggroup_p:int regnum, struct reggroup *reggroup:regnum, reggroup:::default_register_reggroup_p
 EOF
 }
 
@@ -778,6 +780,7 @@
 struct objfile;
 struct minimal_symbol;
 struct regcache;
+struct reggroup;
 
 extern struct gdbarch *current_gdbarch;
 
@@ -1253,6 +1256,7 @@
 #include "gdb_assert.h"
 #include "gdb_string.h"
 #include "gdb-events.h"
+#include "reggroups.h"
 
 /* Static function declarations */
 
Index: regcache.c
===================================================================
RCS file: /cvs/src/src/gdb/regcache.c,v
retrieving revision 1.58
diff -u -r1.58 regcache.c
--- regcache.c	25 Aug 2002 23:44:30 -0000	1.58
+++ regcache.c	23 Oct 2002 00:34:19 -0000
@@ -26,6 +26,7 @@
 #include "gdbarch.h"
 #include "gdbcmd.h"
 #include "regcache.h"
+#include "reggroups.h"
 #include "gdb_assert.h"
 #include "gdb_string.h"
 #include "gdbcmd.h"		/* For maintenanceprintlist.  */
@@ -1479,7 +1480,7 @@
 
 enum regcache_dump_what
 {
-  regcache_dump_none, regcache_dump_raw, regcache_dump_cooked
+  regcache_dump_none, regcache_dump_raw, regcache_dump_cooked, regcache_dump_groups
 };
 
 static void
@@ -1487,6 +1488,8 @@
 	       enum regcache_dump_what what_to_dump)
 {
   struct cleanup *cleanups = make_cleanup (null_cleanup, NULL);
+  struct gdbarch *gdbarch = regcache->descr->gdbarch;
+  struct reggroup *const *groups = reggroups (gdbarch);
   int regnum;
   int footnote_nr = 0;
   int footnote_register_size = 0;
@@ -1593,27 +1596,32 @@
 	}
 
       /* Type.  */
-      if (regnum < 0)
-	fprintf_unfiltered (file, " %-20s", "Type");
-      else
-	{
-	  static const char blt[] = "builtin_type";
-	  const char *t = TYPE_NAME (register_type (regcache->descr->gdbarch,
-						    regnum));
-	  if (t == NULL)
-	    {
-	      char *n;
-	      if (!footnote_register_type_name_null)
-		footnote_register_type_name_null = ++footnote_nr;
-	      xasprintf (&n, "*%d", footnote_register_type_name_null);
-	      make_cleanup (xfree, n);
-	      t = n;
-	    }
-	  /* Chop a leading builtin_type.  */
-	  if (strncmp (t, blt, strlen (blt)) == 0)
-	    t += strlen (blt);
-	  fprintf_unfiltered (file, " %-20s", t);
-	}
+      {
+	const char *t;
+	if (regnum < 0)
+	  t = "Type";
+	else
+	  {
+	    static const char blt[] = "builtin_type";
+	    t = TYPE_NAME (register_type (regcache->descr->gdbarch, regnum));
+	    if (t == NULL)
+	      {
+		char *n;
+		if (!footnote_register_type_name_null)
+		  footnote_register_type_name_null = ++footnote_nr;
+		xasprintf (&n, "*%d", footnote_register_type_name_null);
+		make_cleanup (xfree, n);
+		t = n;
+	      }
+	    /* Chop a leading builtin_type.  */
+	    if (strncmp (t, blt, strlen (blt)) == 0)
+	      t += strlen (blt);
+	  }
+	fprintf_unfiltered (file, " %-15s", t);
+      }
+
+      /* Leading space always present.  */
+      fprintf_unfiltered (file, " ");
 
       /* Value, raw.  */
       if (what_to_dump == regcache_dump_raw)
@@ -1647,6 +1655,26 @@
 	    }
 	}
 
+      /* Group members.  */
+      if (what_to_dump == regcache_dump_groups)
+	{
+	  if (regnum < 0)
+	    fprintf_unfiltered (file, "Groups");
+	  else
+	    {
+	      int i;
+	      const char *sep = "";
+	      for (i = 0; groups[i] != NULL; i++)
+		{
+		  if (gdbarch_register_reggroup_p (gdbarch, regnum, groups[i]))
+		    {
+		      fprintf_unfiltered (file, "%s%s", sep, reggroup_name (groups[i]));
+		      sep = ",";
+		    }
+		}
+	    }
+	}
+
       fprintf_unfiltered (file, "\n");
     }
 
@@ -1696,6 +1724,12 @@
   regcache_print (args, regcache_dump_cooked);
 }
 
+static void
+maintenance_print_register_groups (char *args, int from_tty)
+{
+  regcache_print (args, regcache_dump_groups);
+}
+
 void
 _initialize_regcache (void)
 {
@@ -1726,6 +1760,11 @@
   add_cmd ("cooked-registers", class_maintenance,
 	   maintenance_print_cooked_registers,
 	   "Print the internal register configuration including cooked values.\
+Takes an optional file parameter.",
+	   &maintenanceprintlist);
+  add_cmd ("register-groups", class_maintenance,
+	   maintenance_print_register_groups,
+	   "Print the internal register configuration including each register's group.\
 Takes an optional file parameter.",
 	   &maintenanceprintlist);
 
Index: reggroups.c
===================================================================
RCS file: reggroups.c
diff -N reggroups.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ reggroups.c	23 Oct 2002 00:34:19 -0000
@@ -0,0 +1,268 @@
+/* Register groupings for GDB, the GNU debugger.
+
+   Copyright 2002 Free Software Foundation, Inc.
+
+   Contributed by Red Hat.
+
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include "defs.h"
+#include "reggroups.h"
+#include "gdbtypes.h"
+#include "gdb_assert.h"
+#include "regcache.h"
+#include "command.h"
+#include "gdbcmd.h"		/* For maintenanceprintlist.  */
+
+/* Individual register groups.  */
+
+struct reggroup
+{
+  const char *name;
+  enum reggroup_type type;
+};
+
+struct reggroup *
+reggroup_new (const char *name, enum reggroup_type type)
+{
+  struct reggroup *group = XMALLOC (struct reggroup);
+  group->name = name;
+  group->type = type;
+  return group;
+}
+
+/* Register group attributes.  */
+
+const char *
+reggroup_name (struct reggroup *group)
+{
+  return group->name;
+}
+
+enum reggroup_type
+reggroup_type (struct reggroup *group)
+{
+  return group->type;
+}
+
+/* All the groups for a given architecture.  */
+
+struct reggroups
+{
+  int nr_group;
+  struct reggroup **group;
+};
+
+static struct gdbarch_data *reggroups_data;
+
+static void *
+reggroups_init (struct gdbarch *gdbarch)
+{
+  struct reggroups *groups = XMALLOC (struct reggroups);
+  groups->nr_group = 0;
+  groups->group = NULL;
+  return groups;
+}
+
+static void
+reggroups_free (struct gdbarch *gdbarch, void *data)
+{
+  struct reggroups *groups = data;
+  xfree (groups->group);
+  xfree (groups);
+}
+
+/* Add a register group (with attribute values) to the pre-defined
+   list.  This function can be called during architecture
+   initialization and hence needs to handle NULL architecture groups.  */
+
+static void
+add_group (struct reggroups *groups, struct reggroup *group)
+{
+  gdb_assert (group != NULL);
+  groups->nr_group++;
+  groups->group = xrealloc (groups->group, (sizeof (struct reggroup *)
+					    * (groups->nr_group + 1)));
+  groups->group[groups->nr_group - 1] = group;
+  groups->group[groups->nr_group] = NULL;
+}
+
+void
+reggroup_add (struct gdbarch *gdbarch, struct reggroup *group)
+{
+  struct reggroups *groups = gdbarch_data (gdbarch, reggroups_data);
+  if (groups == NULL)
+    {
+      /* ULGH, called during architecture initialization.  Patch
+         things up.  */
+      groups = reggroups_init (gdbarch);
+      set_gdbarch_data (gdbarch, reggroups_data, groups);
+    }
+  add_group (groups, group);
+}
+
+/* The register groups for the current architecture.  Mumble something
+   about the lifetime of the buffer....  */
+
+static struct reggroups *default_groups;
+
+struct reggroup * const*
+reggroups (struct gdbarch *gdbarch)
+{
+  struct reggroups *groups = gdbarch_data (gdbarch, reggroups_data);
+  /* Don't allow this function to be called during architecture
+     creation.  */
+  gdb_assert (groups != NULL);
+  if (groups->group == NULL)
+    return default_groups->group;
+  else
+    return groups->group;
+}
+
+/* Is REGNUM a member of REGGROUP?  */
+int
+default_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
+			     struct reggroup *group)
+{
+  int vector_p;
+  int float_p;
+  int raw_p;
+  if (REGISTER_NAME (regnum) == NULL
+      || *REGISTER_NAME (regnum) == '\0')
+    return 0;
+  if (group == all_reggroup)
+    return 1;
+  vector_p = TYPE_VECTOR (register_type (gdbarch, regnum));
+  float_p = TYPE_CODE (register_type (gdbarch, regnum)) == TYPE_CODE_FLT;
+  raw_p = regnum < gdbarch_num_regs (gdbarch);
+  if (group == float_reggroup)
+    return float_p;
+  if (group == vector_reggroup)
+    return vector_p;
+  if (group == general_reggroup)
+    return (!vector_p && !float_p);
+  if (group == save_reggroup || group == restore_reggroup)
+    return raw_p;
+  return 0;   
+}
+
+/* Dump out a table of register groups for the current architecture.  */
+
+static void
+reggroups_dump (struct gdbarch *gdbarch, struct ui_file *file)
+{
+  struct reggroup *const *groups = reggroups (gdbarch);
+  int i = -1;
+  do
+    {
+      /* Group name.  */
+      {
+	const char *name;
+	if (i < 0)
+	  name = "Group";
+	else
+	  name = reggroup_name (groups[i]);
+	fprintf_unfiltered (file, " %-10s", name);
+      }
+      
+      /* Group type.  */
+      {
+	const char *type;
+	if (i < 0)
+	  type = "Type";
+	else
+	  {
+	    switch (reggroup_type (groups[i]))
+	      {
+	      case USER_REGGROUP:
+		type = "user";
+		break;
+	      case INTERNAL_REGGROUP:
+		type = "internal";
+		break;
+	      default:
+		internal_error (__FILE__, __LINE__, "bad switch");
+	      }
+	  }
+	fprintf_unfiltered (file, " %-10s", type);
+      }
+
+      /* Note: If you change this, be sure to also update the
+         documentation.  */
+      
+      fprintf_unfiltered (file, "\n");
+      i++;
+    }
+  while (groups[i] != NULL);
+}
+
+static void
+maintenance_print_reggroups (char *args, int from_tty)
+{
+  if (args == NULL)
+    reggroups_dump (current_gdbarch, gdb_stdout);
+  else
+    {
+      struct ui_file *file = gdb_fopen (args, "w");
+      if (file == NULL)
+	perror_with_name ("maintenance print reggroups");
+      reggroups_dump (current_gdbarch, file);    
+      ui_file_delete (file);
+    }
+}
+
+/* Pre-defined register groups.  */
+static struct reggroup general_group = { "general", USER_REGGROUP };
+static struct reggroup float_group = { "float", USER_REGGROUP };
+static struct reggroup system_group = { "system", USER_REGGROUP };
+static struct reggroup vector_group = { "vector", USER_REGGROUP };
+static struct reggroup all_group = { "all", USER_REGGROUP };
+static struct reggroup save_group = { "save", INTERNAL_REGGROUP };
+static struct reggroup restore_group = { "restore", INTERNAL_REGGROUP };
+
+struct reggroup *const general_reggroup = &general_group;
+struct reggroup *const float_reggroup = &float_group;
+struct reggroup *const system_reggroup = &system_group;
+struct reggroup *const vector_reggroup = &vector_group;
+struct reggroup *const all_reggroup = &all_group;
+struct reggroup *const save_reggroup = &save_group;
+struct reggroup *const restore_reggroup = &restore_group;
+
+void
+_initialize_reggroup (void)
+{
+  reggroups_data = register_gdbarch_data (reggroups_init, reggroups_free);
+
+  /* The pre-defined list of groups.  */
+  default_groups = reggroups_init (NULL);
+  add_group (default_groups, general_reggroup);
+  add_group (default_groups, float_reggroup);
+  add_group (default_groups, system_reggroup);
+  add_group (default_groups, vector_reggroup);
+  add_group (default_groups, all_reggroup);
+  add_group (default_groups, save_reggroup);
+  add_group (default_groups, restore_reggroup);
+
+
+  add_cmd ("reggroups", class_maintenance,
+	   maintenance_print_reggroups, "\
+Print the internal register group names.\n\
+Takes an optional file parameter.",
+	   &maintenanceprintlist);
+
+}
Index: reggroups.h
===================================================================
RCS file: reggroups.h
diff -N reggroups.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ reggroups.h	23 Oct 2002 00:34:19 -0000
@@ -0,0 +1,61 @@
+/* Register groupings for GDB, the GNU debugger.
+
+   Copyright 2002 Free Software Foundation, Inc.
+
+   Contributed by Red Hat.
+
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifndef REGGROUPS_H
+#define REGGROUPS_H
+
+struct gdbarch;
+struct reggroup;
+
+enum reggroup_type { USER_REGGROUP, INTERNAL_REGGROUP };
+
+/* Pre-defined, user visible, register groups.  */
+extern struct reggroup *const general_reggroup;
+extern struct reggroup *const float_reggroup;
+extern struct reggroup *const system_reggroup;
+extern struct reggroup *const vector_reggroup;
+extern struct reggroup *const all_reggroup;
+
+/* Pre-defined, internal, register groups.  */
+extern struct reggroup *const save_reggroup;
+extern struct reggroup *const restore_reggroup;
+
+/* Create a new local register group.  */
+extern struct reggroup *reggroup_new (const char *name,
+				      enum reggroup_type type);
+
+/* Add a register group (with attribute values) to the pre-defined list.  */
+extern void reggroup_add (struct gdbarch *gdbarch, struct reggroup *group);
+
+/* Register group attributes.  */
+extern const char *reggroup_name (struct reggroup *reggroup);
+extern enum reggroup_type reggroup_type (struct reggroup *reggroup);
+
+/* The register groups for the current architecture.  */
+extern struct reggroup *const *reggroups (struct gdbarch *gdbarch);
+
+/* Is REGNUM a member of REGGROUP?  */
+extern int default_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
+					struct reggroup *reggroup);
+
+#endif
Index: doc/gdb.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
retrieving revision 1.131
diff -u -r1.131 gdb.texinfo
--- doc/gdb.texinfo	11 Oct 2002 16:13:15 -0000	1.131
+++ doc/gdb.texinfo	23 Oct 2002 00:34:27 -0000
@@ -14814,17 +14814,39 @@
 @kindex maint print registers
 @kindex maint print raw-registers
 @kindex maint print cooked-registers
+@kindex maint print register-groups
 @item maint print registers
 @itemx maint print raw-registers
 @itemx maint print cooked-registers
+@itemx maint print register-groups
 Print @value{GDBN}'s internal register data structures.
 
 The command @samp{maint print raw-registers} includes the contents of
-the raw register cache; and the command @samp{maint print
-cooked-registers} includes the (cooked) value of all registers.
-@xref{Registers,, Registers, gdbint, @value{GDBN} Internals}.
+the raw register cache; the command @samp{maint print cooked-registers}
+includes the (cooked) value of all registers; and the command
+@samp{maint print register-groups} includes the groups that each
+register is a member of.  @xref{Registers,, Registers, gdbint,
+@value{GDBN} Internals}.
 
 Takes an optional file parameter.
+
+@kindex maint print reggroups
+@item maint print reggroups
+Print @value{GDBN}'s internal register group data structures.
+
+Takes an optional file parameter.
+
+@smallexample
+(gdb) @kbd{maint print reggroups}
+ Group      Type      
+ general    user      
+ float      user      
+ all        user      
+ vector     user      
+ system     user      
+ save       internal  
+ restore    internal  
+@end smallexample
 
 @end table
 
Index: doc/gdbint.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdbint.texinfo,v
retrieving revision 1.106
diff -u -r1.106 gdbint.texinfo
--- doc/gdbint.texinfo	18 Oct 2002 18:50:43 -0000	1.106
+++ doc/gdbint.texinfo	23 Oct 2002 00:34:31 -0000
@@ -3578,6 +3578,26 @@
 virtual type.
 @xref{Target Architecture Definition, , Raw and Virtual Register Representations}.
 
+@item register_reggroup_p (@var{gdbarch}, @var{regnum}, @var{reggroup})
+@findex register_reggroup_p
+Return non-zero if register @var{regnum} is a member of the register group @var{reggroup}.
+
+By default, registers are grouped as follows:
+
+@table @samp
+@item float_reggroup
+Any register with a valid name and a floating-point type.
+@item vector_reggroup
+Any register with a valid name and a vector type.
+@item general_reggroup
+Any register with a valid name and a type other than vector or
+floating-point.  @samp{float_reggroup}.
+@item save_reggroup
+@itemx restore_reggroup
+@itemx all_reggroup
+Any register with a valid name.
+@end table
+
 @item REGISTER_VIRTUAL_SIZE (@var{reg})
 @findex REGISTER_VIRTUAL_SIZE
 Return the virtual size of @var{reg}; defaults to the size of the

             reply	other threads:[~2002-10-23  0:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-22 17:41 Andrew Cagney [this message]
2002-10-22 23:11 ` Eli Zaretskii
2003-01-29 16:11   ` Andrew Cagney
2002-11-02  7:16 ` Andrew Cagney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3DB5F04A.2090005@redhat.com \
    --to=ac131313@redhat.com \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox