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]

[rfa:ppc] Fix PPC/NBSD struct return; Was: userdef.exp regressionfor ppc?


> This looks like a bug in calling functions that return a structure
> by value.  All the functions that return structures FAIL:
> 
>   print one + two
>   $1 = {x = 2147479536, y = 1099239424}
>   (gdb) FAIL: gdb.c++/userdef.exp: print one + two
> 
> The functions that return a scalar PASS:
> 
>   print one && two
>   $6 = 1
>   (gdb) PASS: gdb.c++/userdef.exp: print one && two
> 
> Look at the results in gdb.base/call-rt-st.exp and gdb.base/structs.exp.
> I bet there is a lot of juicy log info there.

Yep!  The attached fixes it.  Looks like PPC/NetBSD's custom GCC has a 
fixed struct return (I'm pretty sure that mainline GCC is broken).

The old code, for reasons I'm not sure, was failing to detect NetBSD and 
hence was failing ot set it.

Andrew

2002-06-01  Andrew Cagney  <ac131313@redhat.com>
 
 	* ppcnbsd-tdep.c (ppcnbsd_init_abi): Don't set
 	use_struct_convention to sysv_abi_broken_use_struct_convention.
 
Index: ppcnbsd-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/ppcnbsd-tdep.c,v
retrieving revision 1.1
diff -p -r1.1 ppcnbsd-tdep.c
*** ppcnbsd-tdep.c	28 May 2002 18:43:07 -0000	1.1
--- ppcnbsd-tdep.c	1 Jun 2002 17:07:37 -0000
*************** ppcnbsd_init_abi (struct gdbarch_info in
*** 203,211 ****
    /* Until November 2001, gcc was not complying to the SYSV ABI for
       returning structures less than or equal to 8 bytes in size. It was
       returning everything in memory. When this was corrected, it wasn't
!      fixed for native platforms.  */
    set_gdbarch_use_struct_convention (gdbarch,
                                     ppc_sysv_abi_broken_use_struct_convention);
  
    set_solib_svr4_fetch_link_map_offsets (gdbarch,
                                  nbsd_ilp32_solib_svr4_fetch_link_map_offsets);
--- 203,217 ----
    /* Until November 2001, gcc was not complying to the SYSV ABI for
       returning structures less than or equal to 8 bytes in size. It was
       returning everything in memory. When this was corrected, it wasn't
!      fixed for native platforms.
! 
!      However, NetBSD 1.5.x uses gcc version egcs-2.91.66 19990314
!      (egcs-1.1.2 release) with local patches and that has a fixed
!      struct convention.  */
! #if 0
    set_gdbarch_use_struct_convention (gdbarch,
                                     ppc_sysv_abi_broken_use_struct_convention);
+ #endif
  
    set_solib_svr4_fetch_link_map_offsets (gdbarch,
                                  nbsd_ilp32_solib_svr4_fetch_link_map_offsets);

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