From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13534 invoked by alias); 26 Sep 2008 17:52:39 -0000 Received: (qmail 13524 invoked by uid 22791); 26 Sep 2008 17:52:38 -0000 X-Spam-Check-By: sourceware.org Received: from main.gmane.org (HELO ciao.gmane.org) (80.91.229.2) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 26 Sep 2008 17:52:01 +0000 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1KjHTy-0008Sq-Pu for gdb-patches@sources.redhat.com; Fri, 26 Sep 2008 17:51:58 +0000 Received: from mobius.qnx.com ([209.226.137.108]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 26 Sep 2008 17:51:58 +0000 Received: from aristovski by mobius.qnx.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 26 Sep 2008 17:51:58 +0000 To: gdb-patches@sources.redhat.com From: Aleksandar Ristovski Subject: [patch] Set register even when no frame exists Date: Fri, 26 Sep 2008 17:52:00 -0000 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------090002030504080002000001" User-Agent: Thunderbird 2.0.0.17 (Windows/20080914) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-09/txt/msg00520.txt.bz2 This is a multi-part message in MIME format. --------------090002030504080002000001 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 1268 Hello, We have recently run into a problem with an ARM board debugging via a jtag emulator (bdi2000). The problem looks very much like what was discussed in "GDB and ARM Frame Pointer strangeness" (http://sources.redhat.com/ml/gdb/2004-06/msg00040.html) What is happening in our case is this: gdb connects to bdi2000 (target remote ...) then reset command is issued via bdi2000 (monitor reset...) the target is reset. (and stopped). bdi2000 via init sequence initializes on-board hardware. After that, gdb loads image into device memory. However, when gdb now tries to set PC to the start instruction of the loaded image, GDB fails with: "Value being assigned to is no longer active" and gives up trying to write the register. Note that at this point the target is barely initialized; stack pointer register (GPR 11) has random value which makes frame_find_by_id to fail. Simple solution (see the patch attached) is to call "get_current_frame" which will effectively create a sentinel frame.To me having only sentinel frame at this point in game makes a lot of sense. Thanks, Aleksandar Ristovski QNX Software Systems 2008-09-26 Aleksandar Ristovski * valops.c (value_assign): Get current frame if frame_find_by_id fails. --------------090002030504080002000001 Content-Type: text/x-patch; name="valops.c-20080926.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="valops.c-20080926.diff" Content-length: 764 Index: gdb/valops.c =================================================================== RCS file: /cvs/src/src/gdb/valops.c,v retrieving revision 1.200 diff -u -p -r1.200 valops.c --- gdb/valops.c 11 Sep 2008 14:27:34 -0000 1.200 +++ gdb/valops.c 26 Sep 2008 17:32:56 -0000 @@ -839,6 +839,12 @@ value_assign (struct value *toval, struc /* Figure out which frame this is in currently. */ frame = frame_find_by_id (VALUE_FRAME_ID (toval)); value_reg = VALUE_REGNUM (toval); + + /* Get sentinel frame. For remote targets that just + booted, there will be no frame to work with. Use registers + instead (sentinel frame). */ + if (!frame) + frame = get_current_frame (); if (!frame) error (_("Value being assigned to is no longer active.")); --------------090002030504080002000001--