From: Andrew Cagney Date: Fri, 26 Apr 2002 23:37:33 +0000 (+0000) Subject: * sparc-tdep.c (sparc_gdbarch_init): Add comment explaining why X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7e57f5f4a274cadb0dd3714ec1b24b9eafd8bd78;p=binutils-gdb.git * sparc-tdep.c (sparc_gdbarch_init): Add comment explaining why ON_STACK is needed. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 16bf4f707dc..99733a9e82a 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2002-04-26 Andrew Cagney + + * sparc-tdep.c (sparc_gdbarch_init): Add comment explaining why + ON_STACK is needed. + 2002-04-26 Ben Elliston * target.c (do_xfer_memory): Correct reference to the new option diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c index 4f7f57b0d37..28c51dc8c64 100644 --- a/gdb/sparc-tdep.c +++ b/gdb/sparc-tdep.c @@ -3026,6 +3026,50 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_call_dummy_address (gdbarch, sparc_call_dummy_address); set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0x30); set_gdbarch_call_dummy_length (gdbarch, 0x38); + + /* NOTE: cagney/2002-04-26: Based from info posted by Peter + Schauer around Oct '99. Briefly, due to aspects of the SPARC + ABI, it isn't possible to use ON_STACK with a strictly + compliant compiler. + + Peter Schauer writes ... + + No, any call from GDB to a user function returning a + struct/union will fail miserably. Try this: + + *NOINDENT* + struct x + { + int a[4]; + }; + + struct x gx; + + struct x + sret () + { + return gx; + } + + main () + { + int i; + for (i = 0; i < 4; i++) + gx.a[i] = i + 1; + gx = sret (); + } + *INDENT* + + Set a breakpoint at the gx = sret () statement, run to it and + issue a `print sret()'. It will not succed with your + approach, and I doubt that continuing the program will work + as well. + + For details of the ABI see the Sparc Architecture Manual. I + have Version 8 (Prentice Hall ISBN 0-13-825001-4) and the + calling conventions for functions returning aggregate values + are explained in Appendix D.3. */ + set_gdbarch_call_dummy_location (gdbarch, ON_STACK); set_gdbarch_call_dummy_words (gdbarch, call_dummy_32); #else