Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [commit] Assume a frame when lval_register
@ 2004-11-15 22:26 Andrew Cagney
  0 siblings, 0 replies; only message in thread
From: Andrew Cagney @ 2004-11-15 22:26 UTC (permalink / raw)
  To: gdb-patches

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

The attached simplifies the code handling lval_register by exploiting 
the assumption:

     /* In a register.  Registers are relative to a frame.  */
     lval_register,

i.e., there's always a frame.  With just that committed, my PPC results 
regress.  It turns out that the value code was forgetting to propogate 
the value id.  A sequence like:

	(gdb) up
	(gdb) set variable u.i = 1

where "u" was in a register in frame #1 would end up trashing the 
corresponding register in frame #0.

committed,
Andrew

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

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

	* findvar.c (value_of_register): Set the frame ID.
	* value.c (value_primitive_field): Copy the frame ID.
	* valops.c (value_assign): Simplify lval_register case, there's
	always a frame.

Index: findvar.c
===================================================================
RCS file: /cvs/src/src/gdb/findvar.c,v
retrieving revision 1.81
diff -p -u -r1.81 findvar.c
--- findvar.c	13 Nov 2004 02:29:48 -0000	1.81
+++ findvar.c	15 Nov 2004 22:14:37 -0000
@@ -288,6 +288,7 @@ value_of_register (int regnum, struct fr
   VALUE_ADDRESS (reg_val) = addr;
   VALUE_REGNUM (reg_val) = regnum;
   VALUE_OPTIMIZED_OUT (reg_val) = optim;
+  VALUE_FRAME_ID (reg_val) = get_frame_id (frame);
   return reg_val;
 }
 
Index: valops.c
===================================================================
RCS file: /cvs/src/src/gdb/valops.c,v
retrieving revision 1.137
diff -p -u -r1.137 valops.c
--- valops.c	13 Nov 2004 02:29:48 -0000	1.137
+++ valops.c	15 Nov 2004 22:14:38 -0000
@@ -602,16 +602,8 @@ value_assign (struct value *toval, struc
 	int value_reg;
 
 	/* Figure out which frame this is in currently.  */
-	if (VALUE_LVAL (toval) == lval_register)
-	  {
-	    frame = get_current_frame ();
-	    value_reg = VALUE_REGNUM (toval);
-	  }
-	else
-	  {
-	    frame = frame_find_by_id (VALUE_FRAME_ID (toval));
-	    value_reg = VALUE_REGNUM (toval);
-	  }
+	frame = frame_find_by_id (VALUE_FRAME_ID (toval));
+	value_reg = VALUE_REGNUM (toval);
 
 	if (!frame)
 	  error ("Value being assigned to is no longer active.");
Index: value.c
===================================================================
RCS file: /cvs/src/src/gdb/value.c,v
retrieving revision 1.4
diff -p -u -r1.4 value.c
--- value.c	13 Nov 2004 00:53:09 -0000	1.4
+++ value.c	15 Nov 2004 22:14:38 -0000
@@ -964,6 +964,7 @@ value_primitive_field (struct value *arg
     VALUE_LVAL (v) = lval_internalvar_component;
   VALUE_ADDRESS (v) = VALUE_ADDRESS (arg1);
   VALUE_REGNUM (v) = VALUE_REGNUM (arg1);
+  VALUE_FRAME_ID (v) = VALUE_FRAME_ID (arg1);
 /*  VALUE_OFFSET (v) = VALUE_OFFSET (arg1) + offset
    + TYPE_FIELD_BITPOS (arg_type, fieldno) / 8; */
   return v;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-11-15 22:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-15 22:26 [commit] Assume a frame when lval_register Andrew Cagney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox