From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32751 invoked by alias); 22 Jan 2004 14:20:57 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 32721 invoked from network); 22 Jan 2004 14:20:49 -0000 Received: from unknown (HELO localhost.redhat.com) (65.49.4.239) by sources.redhat.com with SMTP; 22 Jan 2004 14:20:49 -0000 Received: from gnu.org (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id 11E002B8F; Thu, 22 Jan 2004 09:20:47 -0500 (EST) Message-ID: <400FDC3E.3060708@gnu.org> Date: Thu, 22 Jan 2004 14:20:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-US; rv:1.0.2) Gecko/20030820 MIME-Version: 1.0 To: Mark Kettenis Cc: gdb@sources.redhat.com Subject: Re: [RFC] Struct return values References: <200401091622.i09GMRVn000591@elgar.kettenis.dyndns.org> <4009883D.8050809@gnu.org> <200401181519.i0IFJrvC053668@elgar.kettenis.dyndns.org> <400AB4BE.5000300@gnu.org> <200401182213.i0IMD2oO026710@elgar.kettenis.dyndns.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2004-01/txt/msg00242.txt.bz2 > Hmm, OK, but this means that there are really three classes of ABIs here: > > a) The return value address is passed to the callee, and the callee > may clobber the location where the address is stored (i.e. it's > stored in the callee's stack frame, or in a scratch register). > > b) The return value address is passed to the callee, and the callee > may clobber the location where the address is stored (i.e. it's > stored in the callee's stack frame, or in a scratch register). We > can't "return VALUE" or display the return value with "finish". (I suspect you ment something like: while the callee can clober the location containing the original return value address it is required to return that address in a known location when the function finishes) > c) The return value address is passed to the callee in a location that > isn't clobbered by the callee (i.e. in the caller's stack frame, or > in a preserved register). > > This means that > > a) We cannot "return VALUE" or display the return value with "finish". > > b) We cannot "return VALUE" but we can display the return values with > "finish". > > c) We can both "return VALUE" and display the return value with > "finish". > > Examples are: > > a) The PPC System V psABI: The return value address is passed in r3, > which is "volatile". > > b) The AMD64 System V psABI: The return values address is passed in > %rdi. On return %rax will contain the address that has been passed > in by the caller in %rdi. > > c) The (32-bit) SPARC System V psABI: The return address is stored in > a reserved slot in the caller's frame. Can b) be made equivalent to c)? Does the ABI require that the CFI unwind the %rax register such that it contains the return value address? If that or something similar is true then it is just c). > Personally I find it very usefull that GDB prints the return value > when I say "finish", so I'd like to make that work too. Yes, perhaps get SPARC working and then see what can be tinkered with for AMD. It will eventually mean two methods, or an extra param. Andrew