Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@mvista.com>
To: Michael Snyder <msnyder@redhat.com>
Cc: gdb-patches@sources.redhat.com, kevinb@redhat.com, cagney@redhat.com
Subject: Re: [RFC] fixing extract_struct_value_address
Date: Wed, 21 Aug 2002 18:32:00 -0000	[thread overview]
Message-ID: <20020822013255.GA18169@nevyn.them.org> (raw)
In-Reply-To: <3D6418C5.FBF117D@redhat.com>

On Wed, Aug 21, 2002 at 03:48:37PM -0700, Michael Snyder wrote:
> Problem: Find a function's return value when it is a struct 
> returned by reference (thru a pointer).
> 
> Solution level one: Take the value of the register that was
> used by the caller to pass the struct return address.
> 
> Shortcoming: that register isn't preserved, so may be clobbered.
> 
> Solution level two: Save the struct_return address when it
> is passed to store_struct_return (or push_arguments), and
> recover it when it is needed by extract_struct_value_address.
> 
> Shortcoming: Not reentrant.  Nested function calls will clobber it.
> 
> Proposed solution: create a stack structure, and "push" the
> struct_return address in store_struct_return, popping it in
> extract_return_address.  If you can't find it on the stack, 
> then use the value of the appropriate arg0 register.
> 
> I think this should work for most targets, so the code for
> managing the stack can be shared.
> 
> What do you think?

Sharing the solution to this across targets would be a good step
forward - I just had to use the same hack for another port.  You want
to be careful of functions which don't return (either GDB is activated
inside the called function and the expression is never finished, or we
longjmp out, or something...) but I believe there's somewhere that
already tries to figure these things out...

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


  reply	other threads:[~2002-08-22  1:32 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-21 16:05 Michael Snyder
2002-08-21 18:32 ` Daniel Jacobowitz [this message]
2002-08-21 19:04   ` Michael Snyder
2002-08-21 22:43 ` Jim Blandy
2002-08-22 11:12   ` Michael Snyder
2002-08-22 11:39     ` Andrew Cagney
2002-08-22  8:38 ` Andrew Cagney
2002-08-22 10:08   ` Elena Zannoni
2002-08-22 11:17   ` Michael Snyder
2002-08-22 13:04     ` Andrew Cagney

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=20020822013255.GA18169@nevyn.them.org \
    --to=drow@mvista.com \
    --cc=cagney@redhat.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=kevinb@redhat.com \
    --cc=msnyder@redhat.com \
    /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