Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFC] fixing extract_struct_value_address
@ 2002-08-21 16:05 Michael Snyder
  2002-08-21 18:32 ` Daniel Jacobowitz
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Michael Snyder @ 2002-08-21 16:05 UTC (permalink / raw)
  To: gdb-patches; +Cc: kevinb, cagney

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?


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2002-08-22 19:11 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-21 16:05 [RFC] fixing extract_struct_value_address Michael Snyder
2002-08-21 18:32 ` Daniel Jacobowitz
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox