From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20636 invoked by alias); 13 Sep 2003 23:47:36 -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 20622 invoked from network); 13 Sep 2003 23:47:29 -0000 Received: from unknown (HELO localhost.redhat.com) (205.151.14.213) by sources.redhat.com with SMTP; 13 Sep 2003 23:47:29 -0000 Received: from redhat.com (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id 46BDA2B8B; Sat, 13 Sep 2003 19:45:13 -0400 (EDT) Message-ID: <3F63AC09.4070809@redhat.com> Date: Sat, 13 Sep 2003 23:47:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-US; rv:1.0.2) Gecko/20030820 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Jason R Thorpe , gdb-patches@sources.redhat.com Subject: [rfa?] Fix PPC32 struct return Content-Type: multipart/mixed; boundary="------------060108050801020100090401" X-SW-Source: 2003-09/txt/msg00298.txt.bz2 This is a multi-part message in MIME format. --------------060108050801020100090401 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Content-length: 302 Jason, This fixes a problem with GDB's struct return code vis: struct xxx foo () { return xxx; for NetBSD/ppc 1.6. Looking at the history though, It appears that NetBSD/ppc changed it's struct return convention between 1.5 and 1.6? Does any OS implement the SVr4 abi correctly? still, ok? Andrew --------------060108050801020100090401 Content-Type: text/plain; name="diffs" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="diffs" Content-length: 1548 2003-09-13 Andrew Cagney * ppcnbsd-tdep.c (ppcnbsd_use_struct_convention): New function. (ppcnbsd_init_abi): Set "use_struct_convention" to "ppcnbsd_use_struct_convention". Index: ppcnbsd-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/ppcnbsd-tdep.c,v retrieving revision 1.7 diff -u -r1.7 ppcnbsd-tdep.c --- ppcnbsd-tdep.c 5 Jan 2003 01:39:55 -0000 1.7 +++ ppcnbsd-tdep.c 13 Sep 2003 23:22:34 -0000 @@ -204,12 +204,30 @@ return (nbsd_pc_in_sigtramp (pc, func_name)); } +/* NetBSD is confused. It appears that 1.5 was using the correct SVr4 + convention but, 1.6 switched to the below broken convention. For + the moment use the broken convention. Ulgh!. */ + +static int +ppcnbsd_use_struct_convention (int gcc_p, struct type *value_type) +{ + if ((TYPE_LENGTH (value_type) == 16 || TYPE_LENGTH (value_type) == 8) + && TYPE_VECTOR (value_type)) + return 0; + + return !(TYPE_LENGTH (value_type) == 1 + || TYPE_LENGTH (value_type) == 2 + || TYPE_LENGTH (value_type) == 4 + || TYPE_LENGTH (value_type) == 8); +} + static void ppcnbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) { set_gdbarch_pc_in_sigtramp (gdbarch, ppcnbsd_pc_in_sigtramp); + set_gdbarch_use_struct_convention (gdbarch, ppcnbsd_use_struct_convention); set_solib_svr4_fetch_link_map_offsets (gdbarch, nbsd_ilp32_solib_svr4_fetch_link_map_offsets); } --------------060108050801020100090401--