This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [rfa/ppc] Use frame_align(); delete hack


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]