From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3810 invoked by alias); 1 Jun 2002 17:21:47 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 3803 invoked from network); 1 Jun 2002 17:21:44 -0000 Received: from unknown (HELO localhost.redhat.com) (24.112.240.27) by sources.redhat.com with SMTP; 1 Jun 2002 17:21:44 -0000 Received: from cygnus.com (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id 9AE913D9F; Sat, 1 Jun 2002 13:21:52 -0400 (EDT) Message-ID: <3CF902B0.50405@cygnus.com> Date: Sat, 01 Jun 2002 10:21:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-US; rv:1.0rc3) Gecko/20020530 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Michael Elizabeth Chastain , thorpej@wasabisystems.com Cc: gdb-patches@sources.redhat.com Subject: [rfa:ppc] Fix PPC/NBSD struct return; Was: userdef.exp regression for ppc? References: <200206011546.g51FkMj30586@duracef.shout.net> Content-Type: multipart/mixed; boundary="------------040304030409040502070001" X-SW-Source: 2002-06/txt/msg00002.txt.bz2 This is a multi-part message in MIME format. --------------040304030409040502070001 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Content-length: 761 > 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 --------------040304030409040502070001 Content-Type: text/plain; name="diffs" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="diffs" Content-length: 1767 2002-06-01 Andrew Cagney * 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); --------------040304030409040502070001--