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] Merge lval_reg_frame_relative into lval_register


They each describe the same thing - a register in a frame.

Tested in PPC, cross build using gdb_mbuild.sh.

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

	* defs.h (enum lval_type): Delete lval_reg_frame_relative.
	* value.h (struct value): Update comment.
	* valops.c (value_assign): Fold lval_reg_fame_relative into
	lval_register.
	* findvar.c (value_from_register, locate_var_value): Ditto.

Index: defs.h
===================================================================
RCS file: /cvs/src/src/gdb/defs.h,v
retrieving revision 1.172
diff -p -u -r1.172 defs.h
--- defs.h	10 Nov 2004 21:17:56 -0000	1.172
+++ defs.h	13 Nov 2004 02:21:01 -0000
@@ -630,18 +630,14 @@ enum lval_type
   {
     /* Not an lval. */
     not_lval,
-    /* In memory.  Could be a saved register.  */
+    /* In memory.  */
     lval_memory,
-    /* In a register.  */
+    /* In a register.  Registers are relative to a frame.  */
     lval_register,
     /* In a gdb internal variable.  */
     lval_internalvar,
     /* Part of a gdb internal variable (structure field).  */
-    lval_internalvar_component,
-    /* In a register series in a frame not the current one, which may have been
-       partially saved or saved in different places (otherwise would be
-       lval_register or lval_memory).  */
-    lval_reg_frame_relative
+    lval_internalvar_component
   };
 
 /* Control types for commands */
Index: findvar.c
===================================================================
RCS file: /cvs/src/src/gdb/findvar.c,v
retrieving revision 1.80
diff -p -u -r1.80 findvar.c
--- findvar.c	13 Nov 2004 00:53:09 -0000	1.80
+++ findvar.c	13 Nov 2004 02:21:01 -0000
@@ -634,7 +634,7 @@ value_from_register (struct type *type, 
          is that REGISTER_TO_VALUE populates the entire value
          including the location.  */
       REGISTER_TO_VALUE (frame, regnum, type, VALUE_CONTENTS_RAW (v));
-      VALUE_LVAL (v) = lval_reg_frame_relative;
+      VALUE_LVAL (v) = lval_register;
       VALUE_FRAME_ID (v) = get_frame_id (frame);
       VALUE_REGNUM (v) = regnum;
     }
@@ -678,6 +678,9 @@ value_from_register (struct type *type, 
 	    {
 	      mem_stor++;
 	      
+	      /* FIXME: cagney/2004-11-12: I think this is trying to
+		 check that the stored registers are adjacent in
+		 memory.  It isn't doing a good job?  */
 	      mem_tracking = (mem_tracking
 			      && (regnum == local_regnum
 				  || addr == last_addr));
@@ -685,33 +688,17 @@ value_from_register (struct type *type, 
 	  last_addr = addr;
 	}
       
-      /* FIXME: cagney/2003-06-04: Shouldn't this always use
-         lval_reg_frame_relative?  If it doesn't and the register's
-         location changes (say after a resume) then this value is
-         going to have wrong information.  */
-      if ((reg_stor && mem_stor)
-	  || (mem_stor && !mem_tracking))
-	/* Mixed storage; all of the hassle we just went through was
-	   for some good purpose.  */
-	{
-	  VALUE_LVAL (v) = lval_reg_frame_relative;
-	  VALUE_FRAME_ID (v) = get_frame_id (frame);
-	  VALUE_REGNUM (v) = regnum;
-	}
-      else if (mem_stor)
+      if (mem_tracking && mem_stor && !reg_stor)
 	{
 	  VALUE_LVAL (v) = lval_memory;
 	  VALUE_ADDRESS (v) = first_addr;
 	}
-      else if (reg_stor)
+      else
 	{
 	  VALUE_LVAL (v) = lval_register;
-	  VALUE_ADDRESS (v) = first_addr;
-	  VALUE_REGNUM (v) = first_realnum;
+	  VALUE_FRAME_ID (v) = get_frame_id (frame);
+	  VALUE_REGNUM (v) = regnum;
 	}
-      else
-	internal_error (__FILE__, __LINE__,
-			"value_from_register: Value not stored anywhere!");
       
       VALUE_OPTIMIZED_OUT (v) = optimized;
       
@@ -772,15 +759,6 @@ locate_var_value (struct symbol *var, st
 	    REGISTER_NAME (VALUE_REGNUM (lazy_value)));
       break;
 
-    case lval_reg_frame_relative:
-      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_REGNUM (lazy_value)));
-      break;
-
     default:
       error ("Can't take address of \"%s\" which isn't an lvalue.",
 	     SYMBOL_PRINT_NAME (var));
Index: valops.c
===================================================================
RCS file: /cvs/src/src/gdb/valops.c,v
retrieving revision 1.136
diff -p -u -r1.136 valops.c
--- valops.c	13 Nov 2004 00:53:09 -0000	1.136
+++ valops.c	13 Nov 2004 02:21:01 -0000
@@ -596,7 +596,6 @@ value_assign (struct value *toval, struc
       }
       break;
 
-    case lval_reg_frame_relative:
     case lval_register:
       {
 	struct frame_info *frame;
@@ -617,7 +616,7 @@ value_assign (struct value *toval, struc
 	if (!frame)
 	  error ("Value being assigned to is no longer active.");
 	
-	if (VALUE_LVAL (toval) == lval_reg_frame_relative
+	if (VALUE_LVAL (toval) == lval_register
 	    && CONVERT_REGISTER_P (VALUE_REGNUM (toval), type))
 	  {
 	    /* If TOVAL is a special machine register requiring
@@ -699,7 +698,6 @@ value_assign (struct value *toval, struc
     {
     case lval_memory:
     case lval_register:
-    case lval_reg_frame_relative:
 
       reinit_frame_cache ();
 
Index: value.h
===================================================================
RCS file: /cvs/src/src/gdb/value.h,v
retrieving revision 1.60
diff -p -u -r1.60 value.h
--- value.h	13 Nov 2004 00:53:09 -0000	1.60
+++ value.h	13 Nov 2004 02:21:01 -0000
@@ -75,11 +75,8 @@ struct value
      For BITS_BIG_ENDIAN=1 targets, it is the position of the MSB. */
     int bitpos;
 
-  /* Frame value is relative to.  In practice, this ID is only used if
-     the value is stored in several registers in other than the
-     current frame, and these registers have not all been saved at the
-     same place in memory.  This will be described in the lval enum
-     above as "lval_reg_frame_relative".  */
+  /* Frame register value is relative to.  This will be described in
+     the lval enum above as "lval_register".  */
   struct frame_id frame_id;
 
   /* Type of the value.  */

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