From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30070 invoked by alias); 15 Nov 2004 22:26:20 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 29747 invoked from network); 15 Nov 2004 22:26:11 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org with SMTP; 15 Nov 2004 22:26:11 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11/8.12.11) with ESMTP id iAFMQ11D030920 for ; Mon, 15 Nov 2004 17:26:11 -0500 Received: from localhost.redhat.com (to-dhcp51.toronto.redhat.com [172.16.14.151]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id iAFMQ1r13470; Mon, 15 Nov 2004 17:26:01 -0500 Received: from [127.0.0.1] (localhost.localdomain [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id 55EBE129D8C; Mon, 15 Nov 2004 17:25:56 -0500 (EST) Message-ID: <41992CF1.5060703@gnu.org> Date: Mon, 15 Nov 2004 22:26:00 -0000 From: Andrew Cagney User-Agent: Mozilla Thunderbird 0.8 (X11/20041020) MIME-Version: 1.0 To: gdb-patches@sources.redhat.com Subject: [commit] Assume a frame when lval_register Content-Type: multipart/mixed; boundary="------------030506020603070400010502" X-SW-Source: 2004-11/txt/msg00317.txt.bz2 This is a multi-part message in MIME format. --------------030506020603070400010502 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 511 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 --------------030506020603070400010502 Content-Type: text/plain; name="diffs" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="diffs" Content-length: 2173 2004-11-15 Andrew Cagney * 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; --------------030506020603070400010502--