From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7276 invoked by alias); 27 Apr 2006 14:04:26 -0000 Received: (qmail 7267 invoked by uid 22791); 27 Apr 2006 14:04:25 -0000 X-Spam-Check-By: sourceware.org Received: from w099.z064220152.sjc-ca.dsl.cnc.net (HELO duck.specifix.com) (64.220.152.99) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 27 Apr 2006 14:04:20 +0000 Received: from [::1] (duck.specifix.com [64.220.152.99]) by duck.specifix.com (Postfix) with ESMTP id 76175FC96; Thu, 27 Apr 2006 07:04:17 -0700 (PDT) From: Fred Fish Reply-To: fnf@specifix.com To: gdb-patches@sourceware.org Subject: [RFA] Patch for mips_o64_return_value to fix calling functions by hand Date: Thu, 27 Apr 2006 14:04:00 -0000 User-Agent: KMail/1.9.1 MIME-Version: 1.0 Content-Disposition: inline Cc: fnf@specifix.com Content-Type: Multipart/Mixed; boundary="Boundary-00=_89MUE8AdwbdE9pr" Message-Id: <200604271004.44938.fnf@specifix.com> Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-04/txt/msg00359.txt.bz2 --Boundary-00=_89MUE8AdwbdE9pr Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Content-length: 3277 I'm doing some work with a mips64-elf toolchain and took a look at why there are so many gdb testsuite failures. One problem I found is that calling functions by hand was broken, due to what looked to me like a case of a development stub being left in. I've attached a patch that reduces the total number of testsuite failures by around 50%. I'm testing with the following multilibs: mips64-sim/-EB mips64-sim/-EL mips64-sim/-EB/-msoft-float mips64-sim/-EL/-msoft-float Before applying the attached patch, I get: # of expected passes 34613 # of unexpected failures 1866 # of unexpected successes 4 # of expected failures 164 # of known failures 196 # of unresolved testcases 77 # of untested testcases 36 # of unsupported tests 152 /links/build/latest/trunk/mips64-elf/gdb/gdb/testsuite/../../gdb/gdb version 6.4.50.20060422-cvs -nx after applying the patch I get: # of expected passes 35540 # of unexpected failures 938 # of unexpected successes 4 # of expected failures 164 # of known failures 196 # of unresolved testcases 76 # of untested testcases 36 # of unsupported tests 152 /links/build/latest/trunk/mips64-elf/gdb/gdb/testsuite/../../gdb/gdb version 6.4.50.20060422-cvs -nx There are still some issues calling functions by hand in code compiled with -msoft-float, but these are not specific to 64-bit mips, or even mips for that matter. For example: Running target mips64-sim/-EB/-msoft-float Running /src/latest/trunk/src/gdb/gdb/testsuite/gdb.base/call-sc.exp ... FAIL: gdb.base/call-sc.exp: p/c fun(); call call-sc-tf FAIL: gdb.base/call-sc.exp: value foo returned; return call-sc-tf FAIL: gdb.base/call-sc.exp: p/c fun(); call call-sc-td FAIL: gdb.base/call-sc.exp: value foo returned; return call-sc-td FAIL: gdb.base/call-sc.exp: p/c fun(); call call-sc-tld FAIL: gdb.base/call-sc.exp: value foo returned; return call-sc-tld Running target mips-sim/-EB/-msoft-float Running /src/latest/trunk/src/gdb/gdb/testsuite/gdb.base/call-sc.exp ... FAIL: gdb.base/call-sc.exp: p/c fun(); call call-sc-tf FAIL: gdb.base/call-sc.exp: p/c L; call call-sc-tf FAIL: gdb.base/call-sc.exp: value foo returned; return call-sc-tf FAIL: gdb.base/call-sc.exp: p/c fun(); call call-sc-td FAIL: gdb.base/call-sc.exp: p/c L; call call-sc-td FAIL: gdb.base/call-sc.exp: value foo returned; return call-sc-td FAIL: gdb.base/call-sc.exp: p/c fun(); call call-sc-tld FAIL: gdb.base/call-sc.exp: p/c L; call call-sc-tld FAIL: gdb.base/call-sc.exp: value foo returned; return call-sc-tld Running target powerpc-sim/-msoft-float/-mrelocatable-lib/-mno-eabi/-mstrict-align Running /src/latest/trunk/src/gdb/gdb/testsuite/gdb.base/call-sc.exp ... FAIL: gdb.base/call-sc.exp: p/c fun(); call call-sc-tf FAIL: gdb.base/call-sc.exp: p/c L; call call-sc-tf FAIL: gdb.base/call-sc.exp: p/c fun(); call call-sc-td FAIL: gdb.base/call-sc.exp: p/c L; call call-sc-td FAIL: gdb.base/call-sc.exp: p/c fun(); call call-sc-tld FAIL: gdb.base/call-sc.exp: p/c L; call call-sc-tld I'll investigate those failures and supply a separate patch. -Fred --Boundary-00=_89MUE8AdwbdE9pr Content-Type: text/x-diff; charset="us-ascii"; name="mips-tdep.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="mips-tdep.patch" Content-length: 2388 2006-04-27 Fred Fish * mips-tdep.c (mips_o64_return_value): Replace stub that always returned RETURN_VALUE_STRUCT_CONVENTION with a real function. Index: mips-tdep.c =================================================================== RCS file: /cvsroots/latest/src/gdb/gdb/mips-tdep.c,v retrieving revision 1.1.1.4 diff -c -p -r1.1.1.4 mips-tdep.c *** mips-tdep.c 22 Apr 2006 17:31:07 -0000 1.1.1.4 --- mips-tdep.c 27 Apr 2006 14:14:51 -0000 *************** mips_o64_return_value (struct gdbarch *g *** 3788,3794 **** struct type *type, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf) { ! return RETURN_VALUE_STRUCT_CONVENTION; } /* Floating point register management. --- 3788,3832 ---- struct type *type, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf) { ! struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); ! ! if (TYPE_CODE (type) == TYPE_CODE_STRUCT ! || TYPE_CODE (type) == TYPE_CODE_UNION ! || TYPE_CODE (type) == TYPE_CODE_ARRAY) ! return RETURN_VALUE_STRUCT_CONVENTION; ! else if (fp_register_arg_p (TYPE_CODE (type), type)) ! { ! /* A floating-point value. It fits in the least significant ! part of FP0. */ ! if (mips_debug) ! fprintf_unfiltered (gdb_stderr, "Return float in $fp0\n"); ! mips_xfer_register (regcache, ! NUM_REGS + mips_regnum (current_gdbarch)->fp0, ! TYPE_LENGTH (type), ! TARGET_BYTE_ORDER, readbuf, writebuf, 0); ! return RETURN_VALUE_REGISTER_CONVENTION; ! } ! else ! { ! /* A scalar extract each part but least-significant-byte ! justified. */ ! int offset; ! int regnum; ! for (offset = 0, regnum = MIPS_V0_REGNUM; ! offset < TYPE_LENGTH (type); ! offset += mips_stack_argsize (gdbarch), regnum++) ! { ! int xfer = mips_stack_argsize (gdbarch); ! if (offset + xfer > TYPE_LENGTH (type)) ! xfer = TYPE_LENGTH (type) - offset; ! if (mips_debug) ! fprintf_unfiltered (gdb_stderr, "Return scalar+%d:%d in $%d\n", ! offset, xfer, regnum); ! mips_xfer_register (regcache, NUM_REGS + regnum, xfer, ! TARGET_BYTE_ORDER, readbuf, writebuf, offset); ! } ! return RETURN_VALUE_REGISTER_CONVENTION; ! } } /* Floating point register management. --Boundary-00=_89MUE8AdwbdE9pr--