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] Assume a frame when lval_register
Date: Mon, 15 Nov 2004 22:26:00 -0000	[thread overview]
Message-ID: <41992CF1.5060703@gnu.org> (raw)

[-- 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;

                 reply	other threads:[~2004-11-15 22:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=41992CF1.5060703@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