From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24205 invoked by alias); 29 Mar 2004 14:25:38 -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 24195 invoked from network); 29 Mar 2004 14:25:37 -0000 Received: from unknown (HELO nevyn.them.org) (66.93.172.17) by sources.redhat.com with SMTP; 29 Mar 2004 14:25:37 -0000 Received: from drow by nevyn.them.org with local (Exim 4.30 #1 (Debian)) id 1B7xho-0003u7-K7; Mon, 29 Mar 2004 09:25:36 -0500 Date: Mon, 29 Mar 2004 14:25:00 -0000 From: Daniel Jacobowitz To: Orjan Friberg Cc: gdb-patches@sources.redhat.com Subject: Re: Function argument no longer in register Message-ID: <20040329142536.GA14990@nevyn.them.org> Mail-Followup-To: Orjan Friberg , gdb-patches@sources.redhat.com References: <406830DF.10109@axis.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <406830DF.10109@axis.com> User-Agent: Mutt/1.5.1i X-SW-Source: 2004-03/txt/msg00717.txt.bz2 On Mon, Mar 29, 2004 at 04:21:19PM +0200, Orjan Friberg wrote: > Hi all, > > What should happen when a function argument goes out of scope because > the register used to pass it is now used for something else? I > encountered the following situation: > > foo (char *str) > { > ... > i = bar (); > ... > } > > The str argument is passed in register r10, which is then overwritten > with the return value from bar. If I stop somewhere after the call to > bar and try to "print str", GDB will try to read from the address > pointed out by r10 (i.e. sends an 'm' packet to the remote stub). > > I don't know what kind of problem I'm looking at here. Could it be that > the debug information is wrong? I'm guessing GDB somehow fails to > realize that the function argument is out of scope at this point. Nothing's wrong - eventually, versions of GCC with proper location list will tell GDB that the variable is out of scope, but no released version does that. I think 3.5 snapshots will. -- Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer