This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[commit] Use register_type() instead of REGISTER_VIRTUAL_TYPE(),mostly


Hello,

This patch converts much of the core code to:
register_type(gdbarch, regnum)
from REGISTER_VIRTUAL_TYPE(). The two references, in arch-utils.c, were left alone as they get called during architecture initialization (before the regcache and register_type() is initialized).


committed,
Andrew

2003-03-01  Andrew Cagney  <cagney at redhat dot com>

	* Makefile.in (ax-gdb.o): Update dependencies.
	* ax-gdb.c: Include "regcache.h".
	(gen_expr): Use register_type instead of REGISTER_VIRTUAL_TYPE.
	* findvar.c (value_of_register): Ditto.
	* infcmd.c (default_print_registers_info): Ditto.

Index: mi/ChangeLog
2003-03-01  Andrew Cagney  <cagney at redhat dot com>

	* mi-main.c (get_register): Use register_type instead of
	REGISTER_VIRTUAL_TYPE.

Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.337
diff -u -r1.337 Makefile.in
--- Makefile.in	28 Feb 2003 20:03:16 -0000	1.337
+++ Makefile.in	1 Mar 2003 16:56:03 -0000
@@ -1530,7 +1530,8 @@
 	$(symfile_h) $(arch_utils_h) $(regcache_h) $(gdb_string_h)
 ax-gdb.o: ax-gdb.c $(defs_h) $(symtab_h) $(symfile_h) $(gdbtypes_h) \
 	$(value_h) $(expression_h) $(command_h) $(gdbcmd_h) $(frame_h) \
-	$(target_h) $(ax_h) $(ax_gdb_h) $(gdb_string_h) $(block_h)
+	$(target_h) $(ax_h) $(ax_gdb_h) $(gdb_string_h) $(block_h) \
+	$(regcache_h)
 ax-general.o: ax-general.c $(defs_h) $(ax_h) $(value_h) $(gdb_string_h)
 bcache.o: bcache.c $(defs_h) $(gdb_obstack_h) $(bcache_h) $(gdb_string_h)
 block.o: block.c $(defs_h) $(block_h) $(symtab_h) $(symfile_h)
Index: ax-gdb.c
===================================================================
RCS file: /cvs/src/src/gdb/ax-gdb.c,v
retrieving revision 1.21
diff -u -r1.21 ax-gdb.c
--- ax-gdb.c	28 Feb 2003 20:03:17 -0000	1.21
+++ ax-gdb.c	1 Mar 2003 16:56:29 -0000
@@ -34,6 +34,7 @@
 #include "ax-gdb.h"
 #include "gdb_string.h"
 #include "block.h"
+#include "regcache.h"
 
 /* To make sense of this file, you should read doc/agentexpr.texi.
    Then look at the types and enums in ax-gdb.h.  For the code itself,
@@ -1595,7 +1596,7 @@
 	(*pc) += 3;
 	value->kind = axs_lvalue_register;
 	value->u.reg = reg;
-	value->type = REGISTER_VIRTUAL_TYPE (reg);
+	value->type = register_type (current_gdbarch, reg);
       }
       break;
 
Index: findvar.c
===================================================================
RCS file: /cvs/src/src/gdb/findvar.c,v
retrieving revision 1.49
diff -u -r1.49 findvar.c
--- findvar.c	25 Feb 2003 21:36:17 -0000	1.49
+++ findvar.c	1 Mar 2003 16:56:37 -0000
@@ -288,7 +288,7 @@
 
 /* Return a `value' with the contents of (virtual or cooked) register
    REGNUM as found in the specified FRAME.  The register's type is
-   determined by REGISTER_VIRTUAL_TYPE.
+   determined by register_type().
 
    NOTE: returns NULL if register value is not available.  Caller will
    check return value or die!  */
@@ -320,13 +320,13 @@
   if (register_cached (regnum) < 0)
     return NULL;		/* register value not available */
 
-  reg_val = allocate_value (REGISTER_VIRTUAL_TYPE (regnum));
+  reg_val = allocate_value (register_type (current_gdbarch, regnum));
 
   /* Convert raw data to virtual format if necessary.  */
 
   if (REGISTER_CONVERTIBLE (regnum))
     {
-      REGISTER_CONVERT_TO_VIRTUAL (regnum, REGISTER_VIRTUAL_TYPE (regnum),
+      REGISTER_CONVERT_TO_VIRTUAL (regnum, register_type (current_gdbarch, regnum),
 				   raw_buffer, VALUE_CONTENTS_RAW (reg_val));
     }
   else if (REGISTER_RAW_SIZE (regnum) == REGISTER_VIRTUAL_SIZE (regnum))
Index: infcmd.c
===================================================================
RCS file: /cvs/src/src/gdb/infcmd.c,v
retrieving revision 1.74
diff -u -r1.74 infcmd.c
--- infcmd.c	20 Feb 2003 17:17:23 -0000	1.74
+++ infcmd.c	1 Mar 2003 16:56:57 -0000
@@ -1665,7 +1665,7 @@
       /* Convert raw data to virtual format if necessary.  */
       if (REGISTER_CONVERTIBLE (i))
 	{
-	  REGISTER_CONVERT_TO_VIRTUAL (i, REGISTER_VIRTUAL_TYPE (i),
+	  REGISTER_CONVERT_TO_VIRTUAL (i, register_type (current_gdbarch, i),
 				       raw_buffer, virtual_buffer);
 	}
       else
@@ -1676,11 +1676,11 @@
 
       /* If virtual format is floating, print it that way, and in raw
          hex.  */
-      if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (i)) == TYPE_CODE_FLT)
+      if (TYPE_CODE (register_type (current_gdbarch, i)) == TYPE_CODE_FLT)
 	{
 	  int j;
 
-	  val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0,
+	  val_print (register_type (current_gdbarch, i), virtual_buffer, 0, 0,
 		     file, 0, 1, 0, Val_pretty_default);
 
 	  fprintf_filtered (file, "\t(raw 0x");
@@ -1698,14 +1698,14 @@
       else
 	{
 	  /* Print the register in hex.  */
-	  val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0,
+	  val_print (register_type (current_gdbarch, i), virtual_buffer, 0, 0,
 		     file, 'x', 1, 0, Val_pretty_default);
           /* If not a vector register, print it also according to its
              natural format.  */
-	  if (TYPE_VECTOR (REGISTER_VIRTUAL_TYPE (i)) == 0)
+	  if (TYPE_VECTOR (register_type (current_gdbarch, i)) == 0)
 	    {
 	      fprintf_filtered (file, "\t");
-	      val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0,
+	      val_print (register_type (current_gdbarch, i), virtual_buffer, 0, 0,
 			 file, 0, 1, 0, Val_pretty_default);
 	    }
 	}
Index: mi/mi-main.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-main.c,v
retrieving revision 1.40
diff -u -r1.40 mi-main.c
--- mi/mi-main.c	6 Feb 2003 01:19:12 -0000	1.40
+++ mi/mi-main.c	1 Mar 2003 16:57:37 -0000
@@ -534,7 +534,8 @@
 
   if (REGISTER_CONVERTIBLE (regnum))
     {
-      REGISTER_CONVERT_TO_VIRTUAL (regnum, REGISTER_VIRTUAL_TYPE (regnum),
+      REGISTER_CONVERT_TO_VIRTUAL (regnum,
+				   register_type (current_gdbarch, regnum),
 				   raw_buffer, virtual_buffer);
     }
   else
@@ -559,7 +560,7 @@
     }
   else
     {
-      val_print (REGISTER_VIRTUAL_TYPE (regnum), virtual_buffer, 0, 0,
+      val_print (register_type (current_gdbarch, regnum), virtual_buffer, 0, 0,
 		 stb->stream, format, 1, 0, Val_pretty_default);
       ui_out_field_stream (uiout, "value", stb);
       ui_out_stream_delete (stb);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]