From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2336 invoked by alias); 3 May 2006 14:06:28 -0000 Received: (qmail 2323 invoked by uid 22791); 3 May 2006 14:06:26 -0000 X-Spam-Check-By: sourceware.org Received: from lon-del-01.spheriq.net (HELO lon-del-01.spheriq.net) (195.46.50.97) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 03 May 2006 14:06:03 +0000 Received: from lon-out-01.spheriq.net ([195.46.50.129]) by lon-del-01.spheriq.net with ESMTP id k43E5jYY031758 for ; Wed, 3 May 2006 14:05:45 GMT Received: from lon-cus-02.spheriq.net (lon-cus-02.spheriq.net [195.46.50.38]) by lon-out-01.spheriq.net with ESMTP id k43E5it7030081 for ; Wed, 3 May 2006 14:05:44 GMT Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by lon-cus-02.spheriq.net with ESMTP id k43E5XH0005006 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=OK) for ; Wed, 3 May 2006 14:05:38 GMT Received: from zeta.dmz-eu.st.com (ns2.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 1A862DA53 for ; Wed, 3 May 2006 14:05:21 +0000 (GMT) Received: from mail1.bri.st.com (mail1.bri.st.com [164.129.8.218]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 9DD2947476 for ; Wed, 3 May 2006 14:05:19 +0000 (GMT) Received: from [164.129.15.13] (bri1043.bri.st.com [164.129.15.13]) by mail1.bri.st.com (MOS 3.5.8-GR) with ESMTP id CHM47767 (AUTH stubbsa); Wed, 3 May 2006 15:05:17 +0100 (BST) Message-ID: <4458B803.5050506@st.com> Date: Wed, 03 May 2006 14:06:00 -0000 From: Andrew STUBBS User-Agent: Thunderbird 1.5.0.2 (Windows/20060308) MIME-Version: 1.0 To: GDB Patches Subject: [PATCH] Allow writing to registers before the program starts Content-Type: multipart/mixed; boundary="------------070101060905080508040402" X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-05/txt/msg00017.txt.bz2 This is a multi-part message in MIME format. --------------070101060905080508040402 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 717 Hi, It used to be possible to write to registers before starting the program (on a simulator or other target that has registers that early). This is useful to start a program from a non-standard point, or else, with a target which retains it state between runs, reset the target to a usable state. E.g: (gdb) target sim (gdb) load (gdb) set $pc = 0x100 However, this now results in the message 'Value being assigned to is no longer active.'. I have tracked this to a patch here: http://sourceware.org/ml/gdb-patches/2004-11/msg00317.html Reverting the valops.c portion of this patch solves the problem for me. I have tested it and it produced no regressions. Ok to apply the attached reversion? Andrew --------------070101060905080508040402 Content-Type: text/plain; name="register-write.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="register-write.patch" Content-length: 954 2006-05-03 Andrew Stubbs * valops.c (value_assign): Revert Andrew Cagney's patch from 2004-11-15: re-allow writing of registers before there is a current frame. Index: src/gdb/valops.c =================================================================== --- src.orig/gdb/valops.c 2006-05-03 14:13:36.000000000 +0100 +++ src/gdb/valops.c 2006-05-03 14:14:28.000000000 +0100 @@ -610,8 +610,16 @@ value_assign (struct value *toval, struc int value_reg; /* Figure out which frame this is in currently. */ - frame = frame_find_by_id (VALUE_FRAME_ID (toval)); - value_reg = VALUE_REGNUM (toval); + 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); + } if (!frame) error (_("Value being assigned to is no longer active.")); --------------070101060905080508040402--