Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <cagney@gnu.org>
To: Mark Kettenis <kettenis@chello.nl>
Cc: gdb@sources.redhat.com
Subject: Re: [RFC] Struct return values
Date: Thu, 22 Jan 2004 14:20:00 -0000	[thread overview]
Message-ID: <400FDC3E.3060708@gnu.org> (raw)
In-Reply-To: <200401182213.i0IMD2oO026710@elgar.kettenis.dyndns.org>


> 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


  reply	other threads:[~2004-01-22 14:20 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-09 16:22 Mark Kettenis
2004-01-09 20:05 ` Andrew Cagney
2004-01-09 23:47   ` Mark Kettenis
2004-01-11 15:58     ` Andrew Cagney
2004-01-17 19:08 ` Andrew Cagney
2004-01-18 15:20   ` Mark Kettenis
2004-01-18 16:31     ` Andrew Cagney
2004-01-18 22:13       ` Mark Kettenis
2004-01-22 14:20         ` Andrew Cagney [this message]
2004-01-22 21:52           ` Mark Kettenis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=400FDC3E.3060708@gnu.org \
    --to=cagney@gnu.org \
    --cc=gdb@sources.redhat.com \
    --cc=kettenis@chello.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox