From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4385 invoked by alias); 23 Jan 2013 18:37:53 -0000 Received: (qmail 4360 invoked by uid 22791); 23 Jan 2013 18:37:53 -0000 X-SWARE-Spam-Status: No, hits=-6.6 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from e9.ny.us.ibm.com (HELO e9.ny.us.ibm.com) (32.97.182.139) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 23 Jan 2013 18:37:47 +0000 Received: from /spool/local by e9.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 23 Jan 2013 13:37:44 -0500 Received: from d01dlp02.pok.ibm.com (9.56.250.167) by e9.ny.us.ibm.com (192.168.1.109) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 23 Jan 2013 13:37:42 -0500 Received: from d01relay03.pok.ibm.com (d01relay03.pok.ibm.com [9.56.227.235]) by d01dlp02.pok.ibm.com (Postfix) with ESMTP id 1C67A6E8043 for ; Wed, 23 Jan 2013 13:37:40 -0500 (EST) Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by d01relay03.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r0NIbfU1295630 for ; Wed, 23 Jan 2013 13:37:41 -0500 Received: from d01av03.pok.ibm.com (loopback [127.0.0.1]) by d01av03.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r0NIbeMe005875 for ; Wed, 23 Jan 2013 16:37:41 -0200 Received: from igoo.rch.stglabs.ibm.com (igoo.rch.stglabs.ibm.com [9.5.12.222]) by d01av03.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with SMTP id r0NIbe7h005811; Wed, 23 Jan 2013 16:37:40 -0200 Date: Wed, 23 Jan 2013 18:37:00 -0000 From: Tiago =?iso-8859-1?Q?St=FCrmer?= Daitx To: gdb-patches@sourceware.org Subject: [PATCH] Fix printing functions with complex return on PPC64 Cc: emachado@linux.vnet.ibm.com, Ulrich.Weigand@de.ibm.com Message-ID: <51002df4.gTlyNYCLGs9Wzueq%tdaitx@linux.vnet.ibm.com> User-Agent: Heirloom mailx 12.4 7/29/08 MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13012318-7182-0000-0000-000004A7F9AA X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2013-01/txt/msg00557.txt.bz2 This patch fix the current PPC64 return value code to properly handle complex types by passing the target type of the COMPLEX value. It also makes use of a variable to hold TYPE_TARGET_TYPE (valtype) for better readability and reuse. Previously two testcases from gdb.base/callfuncs.exp and another two from gdb.base/varargs.exp would fail with GDB Interal Error due to improperly calling convert_typed_floating with a COMPLEX type instead of using the target type. Excerpt from a diff between PPC64 run log before and after the fix: -FAIL: gdb.base/callfuncs.exp: call inferior func with struct - returns float _Complex (GDB internal error) -FAIL: gdb.base/callfuncs.exp: call inferior func with struct - returns double _Complex (GDB internal error) -FAIL: gdb.base/varargs.exp: print find_max_float_real(4, fc1, fc2, fc3, fc4) (GDB internal error) -FAIL: gdb.base/varargs.exp: print find_max_double_real(4, dc1, dc2, dc3, dc4) (GDB internal error) +FAIL: gdb.base/varargs.exp: print find_max_float_real(4, fc1, fc2, fc3, fc4) The existing FAIL is due to the complex arguments and will be fixed by another patch series. No regression was detected on PPC (32 bits) testcases. Regards, Tiago Daitx gdb/Changelog 2012-11-01 Tiago Stürmer Daitx * ppc-sysv-tdep.c (ppc64_sysv_abi_return_value): Set correct type on float conversion for complex type. --- diff --git a/gdb/ppc-sysv-tdep.c b/gdb/ppc-sysv-tdep.c index 48b4765..0ffeab9 100644 --- a/gdb/ppc-sysv-tdep.c +++ b/gdb/ppc-sysv-tdep.c @@ -1920,11 +1920,13 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function, gdb_byte regval[MAX_REGISTER_SIZE]; struct type *regtype = register_type (gdbarch, tdep->ppc_fp0_regnum); + struct type *target_type; + target_type = check_typedef (TYPE_TARGET_TYPE (valtype)); if (writebuf != NULL) { convert_typed_floating ((const bfd_byte *) writebuf + - i * (TYPE_LENGTH (valtype) / 2), - valtype, regval, regtype); + i * TYPE_LENGTH (target_type), + target_type, regval, regtype); regcache_cooked_write (regcache, tdep->ppc_fp0_regnum + 1 + i, regval); @@ -1936,8 +1938,8 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function, regval); convert_typed_floating (regval, regtype, (bfd_byte *) readbuf + - i * (TYPE_LENGTH (valtype) / 2), - valtype); + i * TYPE_LENGTH (target_type), + target_type); } } }