This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [rfa/ppc] Use frame_align(); delete hack
- From: Kevin Buettner <kevinb at redhat dot com>
- To: Andrew Cagney <ac131313 at redhat dot com>, gdb-patches at sources dot redhat dot com
- Date: Thu, 26 Sep 2002 11:37:19 -0700
- Subject: Re: [rfa/ppc] Use frame_align(); delete hack
- References: <3D90F04C.9040900@redhat.com>
On Sep 24, 7:07pm, Andrew Cagney wrote:
> The extract struct return function is also modified so that it, for want
> of a better guess, returns register 3. The other option is to have that
> function return 0 (since it really doesn't know).
[...]
> + /* FIXME: This will only work at random. The caller passes the
> + struct_return address in register 3, but it is not preserved. It
> + may still be there, or this may be a random value. */
> + ULONGEST val;
> + regcache_cooked_read_unsigned (regcache, 3, &val);
> + return val;
I think returning 0 here is a better idea. If the function that
you're returning from has made any (non-nullary) calls, r3 will have
been overwritten. Even if it doesn't make any calls, r3 is still fair
game for the compiler to use as a temporary.
I'd like to see a comment pointing out the fact that gdb knows about
and is able to print struct return values in inferior function calls
due to the fact that gdb is the caller (and therefore knows the address
of the struct return buffer).
Otherwise, okay.
Kevin