Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <cagney@gnu.org>
To: gdb-patches@sources.redhat.com
Subject: [commit/value] Merge VALUE_REGNO and VALUE_FRAME_REGNUM
Date: Sat, 13 Nov 2004 00:56:00 -0000	[thread overview]
Message-ID: <41955B3F.5090203@gnu.org> (raw)

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

The're doing the same thing.  This reduces them down to a single macro, 
committed.

I'll be following up with a similar patch for lval_register and 
lval_reg_frame_relative.

Andrew

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

2004-11-12  Andrew Cagney  <cagney@gnu.org>

	Merge VALUE_REGNO and VALUE_FRAME_REGNUM into VALUE_REGNUM.
	* value.h (VALUE_REGNO, VALUE_FRAME_REGNUM): Delete.
	(VALUE_REGNUM): Define.
	(struct value): Delete location.regnum, rename "regno" to
	"regnum".
	* value.c, valops.c, valarith.c, findvar.c: Update.

Index: findvar.c
===================================================================
RCS file: /cvs/src/src/gdb/findvar.c,v
retrieving revision 1.79
diff -p -u -r1.79 findvar.c
--- findvar.c	12 Nov 2004 21:45:06 -0000	1.79
+++ findvar.c	13 Nov 2004 00:52:04 -0000
@@ -286,7 +286,7 @@ value_of_register (int regnum, struct fr
 	  register_size (current_gdbarch, regnum));
   VALUE_LVAL (reg_val) = lval;
   VALUE_ADDRESS (reg_val) = addr;
-  VALUE_REGNO (reg_val) = regnum;
+  VALUE_REGNUM (reg_val) = regnum;
   VALUE_OPTIMIZED_OUT (reg_val) = optim;
   return reg_val;
 }
@@ -622,7 +622,7 @@ value_from_register (struct type *type, 
          We'll just attribute the value to the original register.  */
       VALUE_LVAL (v) = lval_register;
       VALUE_ADDRESS (v) = regnum;
-      VALUE_REGNO (v) = regnum;
+      VALUE_REGNUM (v) = regnum;
     }
   else if (CONVERT_REGISTER_P (regnum, type))
     {
@@ -636,7 +636,7 @@ value_from_register (struct type *type, 
       REGISTER_TO_VALUE (frame, regnum, type, VALUE_CONTENTS_RAW (v));
       VALUE_LVAL (v) = lval_reg_frame_relative;
       VALUE_FRAME_ID (v) = get_frame_id (frame);
-      VALUE_FRAME_REGNUM (v) = regnum;
+      VALUE_REGNUM (v) = regnum;
     }
   else
     {
@@ -696,7 +696,7 @@ value_from_register (struct type *type, 
 	{
 	  VALUE_LVAL (v) = lval_reg_frame_relative;
 	  VALUE_FRAME_ID (v) = get_frame_id (frame);
-	  VALUE_FRAME_REGNUM (v) = regnum;
+	  VALUE_REGNUM (v) = regnum;
 	}
       else if (mem_stor)
 	{
@@ -707,7 +707,7 @@ value_from_register (struct type *type, 
 	{
 	  VALUE_LVAL (v) = lval_register;
 	  VALUE_ADDRESS (v) = first_addr;
-	  VALUE_REGNO (v) = first_realnum;
+	  VALUE_REGNUM (v) = first_realnum;
 	}
       else
 	internal_error (__FILE__, __LINE__,
@@ -764,21 +764,21 @@ locate_var_value (struct symbol *var, st
   switch (VALUE_LVAL (lazy_value))
     {
     case lval_register:
-	gdb_assert (REGISTER_NAME (VALUE_REGNO (lazy_value)) != NULL
-	            && *REGISTER_NAME (VALUE_REGNO (lazy_value)) != '\0');
+      gdb_assert (REGISTER_NAME (VALUE_REGNUM (lazy_value)) != NULL
+		  && *REGISTER_NAME (VALUE_REGNUM (lazy_value)) != '\0');
       error("Address requested for identifier "
 	    "\"%s\" which is in register $%s",
             SYMBOL_PRINT_NAME (var), 
-	    REGISTER_NAME (VALUE_REGNO (lazy_value)));
+	    REGISTER_NAME (VALUE_REGNUM (lazy_value)));
       break;
 
     case lval_reg_frame_relative:
-	gdb_assert (REGISTER_NAME (VALUE_FRAME_REGNUM (lazy_value)) != NULL
-	            && *REGISTER_NAME (VALUE_FRAME_REGNUM (lazy_value)) != '\0');
+      gdb_assert (REGISTER_NAME (VALUE_REGNUM (lazy_value)) != NULL
+		  && *REGISTER_NAME (VALUE_REGNUM (lazy_value)) != '\0');
       error("Address requested for identifier "
 	    "\"%s\" which is in frame register $%s",
             SYMBOL_PRINT_NAME (var), 
-	    REGISTER_NAME (VALUE_FRAME_REGNUM (lazy_value)));
+	    REGISTER_NAME (VALUE_REGNUM (lazy_value)));
       break;
 
     default:
Index: valarith.c
===================================================================
RCS file: /cvs/src/src/gdb/valarith.c,v
retrieving revision 1.28
diff -p -u -r1.28 valarith.c
--- valarith.c	12 Nov 2004 21:45:07 -0000	1.28
+++ valarith.c	13 Nov 2004 00:52:04 -0000
@@ -277,7 +277,7 @@ value_subscripted_rvalue (struct value *
   else
     VALUE_LVAL (v) = VALUE_LVAL (array);
   VALUE_ADDRESS (v) = VALUE_ADDRESS (array);
-  VALUE_REGNO (v) = VALUE_REGNO (array);
+  VALUE_REGNUM (v) = VALUE_REGNUM (array);
   v->offset = value_offset (array) + elt_offs;
   return v;
 }
Index: valops.c
===================================================================
RCS file: /cvs/src/src/gdb/valops.c,v
retrieving revision 1.135
diff -p -u -r1.135 valops.c
--- valops.c	12 Nov 2004 21:45:07 -0000	1.135
+++ valops.c	13 Nov 2004 00:52:04 -0000
@@ -606,23 +606,23 @@ value_assign (struct value *toval, struc
 	if (VALUE_LVAL (toval) == lval_register)
 	  {
 	    frame = get_current_frame ();
-	    value_reg = VALUE_REGNO (toval);
+	    value_reg = VALUE_REGNUM (toval);
 	  }
 	else
 	  {
 	    frame = frame_find_by_id (VALUE_FRAME_ID (toval));
-	    value_reg = VALUE_FRAME_REGNUM (toval);
+	    value_reg = VALUE_REGNUM (toval);
 	  }
 
 	if (!frame)
 	  error ("Value being assigned to is no longer active.");
 	
 	if (VALUE_LVAL (toval) == lval_reg_frame_relative
-	    && CONVERT_REGISTER_P (VALUE_FRAME_REGNUM (toval), type))
+	    && CONVERT_REGISTER_P (VALUE_REGNUM (toval), type))
 	  {
 	    /* If TOVAL is a special machine register requiring
 	       conversion of program values to a special raw format.  */
-	    VALUE_TO_REGISTER (frame, VALUE_FRAME_REGNUM (toval),
+	    VALUE_TO_REGISTER (frame, VALUE_REGNUM (toval),
 			       type, VALUE_CONTENTS (fromval));
 	  }
 	else
Index: value.c
===================================================================
RCS file: /cvs/src/src/gdb/value.c,v
retrieving revision 1.3
diff -p -u -r1.3 value.c
--- value.c	12 Nov 2004 21:45:07 -0000	1.3
+++ value.c	13 Nov 2004 00:52:04 -0000
@@ -94,7 +94,7 @@ allocate_value (struct type *type)
   val->offset = 0;
   val->bitpos = 0;
   val->bitsize = 0;
-  VALUE_REGNO (val) = -1;
+  VALUE_REGNUM (val) = -1;
   VALUE_LAZY (val) = 0;
   VALUE_OPTIMIZED_OUT (val) = 0;
   VALUE_EMBEDDED_OFFSET (val) = 0;
@@ -248,7 +248,7 @@ value_copy (struct value *arg)
   val->bitpos = arg->bitpos;
   val->bitsize = arg->bitsize;
   VALUE_FRAME_ID (val) = VALUE_FRAME_ID (arg);
-  VALUE_REGNO (val) = VALUE_REGNO (arg);
+  VALUE_REGNUM (val) = VALUE_REGNUM (arg);
   VALUE_LAZY (val) = VALUE_LAZY (arg);
   VALUE_OPTIMIZED_OUT (val) = VALUE_OPTIMIZED_OUT (arg);
   VALUE_EMBEDDED_OFFSET (val) = VALUE_EMBEDDED_OFFSET (arg);
@@ -963,7 +963,7 @@ value_primitive_field (struct value *arg
   if (VALUE_LVAL (arg1) == lval_internalvar)
     VALUE_LVAL (v) = lval_internalvar_component;
   VALUE_ADDRESS (v) = VALUE_ADDRESS (arg1);
-  VALUE_REGNO (v) = VALUE_REGNO (arg1);
+  VALUE_REGNUM (v) = VALUE_REGNUM (arg1);
 /*  VALUE_OFFSET (v) = VALUE_OFFSET (arg1) + offset
    + TYPE_FIELD_BITPOS (arg_type, fieldno) / 8; */
   return v;
Index: value.h
===================================================================
RCS file: /cvs/src/src/gdb/value.h,v
retrieving revision 1.59
diff -p -u -r1.59 value.h
--- value.h	12 Nov 2004 21:45:07 -0000	1.59
+++ value.h	13 Nov 2004 00:52:04 -0000
@@ -58,9 +58,6 @@ struct value
 
     /* Pointer to internal variable.  */
     struct internalvar *internalvar;
-
-    /* Number of register.  Only used with lval_reg_frame_relative.  */
-    int regnum;
   } location;
 
   /* Describes offset of a value within lval of a structure in bytes.
@@ -139,7 +136,7 @@ struct value
     struct value *next;
 
     /* Register number if the value is from a register.  */
-    short regno;
+    short regnum;
 
     /* If zero, contents of this value are in the contents field.  If
        nonzero, contents are in inferior memory at address in the
@@ -218,9 +215,8 @@ extern int value_fetch_lazy (struct valu
 #define VALUE_LVAL(val) (val)->lval
 #define VALUE_ADDRESS(val) (val)->location.address
 #define VALUE_INTERNALVAR(val) (val)->location.internalvar
-#define VALUE_FRAME_REGNUM(val) ((val)->location.regnum)
 #define VALUE_FRAME_ID(val) ((val)->frame_id)
-#define VALUE_REGNO(val) (val)->regno
+#define VALUE_REGNUM(val) (val)->regnum
 #define VALUE_OPTIMIZED_OUT(val) ((val)->optimized_out)
 #define VALUE_EMBEDDED_OFFSET(val) ((val)->embedded_offset)
 #define VALUE_POINTED_TO_OFFSET(val) ((val)->pointed_to_offset)

             reply	other threads:[~2004-11-13  0:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-13  0:56 Andrew Cagney [this message]
2004-11-13  1:01 ` Randolph Chung
2004-11-13  1:44   ` Andrew Cagney
2004-11-13  1:52     ` 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=41955B3F.5090203@gnu.org \
    --to=cagney@gnu.org \
    --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