This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [SO obvious...] make struct_return work for hand_function_call
- From: Andrew Cagney <ac131313 at redhat dot com>
- To: Michael Snyder <msnyder at redhat dot com>
- Cc: gdb-patches at sources dot redhat dot com, eliz at is dot elta dot co dot il
- Date: Wed, 30 Jul 2003 22:26:21 -0400
- Subject: Re: [SO obvious...] make struct_return work for hand_function_call
- References: <3F28321A.7040201@redhat.com>
God, we've struggled with this for years... the answer is so obvious!
Er, struct return already works for hand call functions. Vis:
/* NOTE: cagney/2002-09-10: Only when the stack has been correctly
aligned (using frame_align()) do we can trust STRUCT_ADDR and
fetch the return value direct from the stack. This lack of trust
comes about because legacy targets have a nasty habit of
silently, and local to PUSH_ARGUMENTS(), moving STRUCT_ADDR. For
such targets, just hope that value_being_returned() can find the
adjusted value. */
if (struct_return && gdbarch_frame_align_p (current_gdbarch))
{
struct value *retval = value_at (value_type, struct_addr, NULL);
do_cleanups (retbuf_cleanup);
return retval;
}
else
{
struct value *retval = value_being_returned (value_type, retbuf,
struct_return);
do_cleanups (retbuf_cleanup);
return retval;
}
If your architecture provides frame_align(), and does not it will all work.
I think all those changes can be reverted.
Eli, this generalizes some special-purpose code that you wrote for HP,
which now becomes redundant and may be removed.
BTW, Elz is Elena.
Andrew