Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Fred Fish <fnf@specifix.com>
To: gdb-patches@sourceware.org
Cc: fnf@specifix.com
Subject: [RFA] Patch for mips_o64_return_value to fix calling functions by hand
Date: Thu, 27 Apr 2006 14:04:00 -0000	[thread overview]
Message-ID: <200604271004.44938.fnf@specifix.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 3277 bytes --]

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


[-- Attachment #2: mips-tdep.patch --]
[-- Type: text/x-diff, Size: 2388 bytes --]

2006-04-27  Fred Fish  <fnf@specifix.com>

	* 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.

             reply	other threads:[~2006-04-27 14:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-27 14:04 Fred Fish [this message]
2006-05-02 20:29 ` [RFA] Patch for mips_o64_return_value to fix calling functions by hand (additional patch) Fred Fish
2006-05-05 17:11   ` Daniel Jacobowitz
2006-05-05 18:06     ` [commit] " Fred Fish
2006-05-05 17:13 ` [RFA] Patch for mips_o64_return_value to fix calling functions by hand Daniel Jacobowitz
2006-05-05 17:55   ` [commit] " Fred Fish

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200604271004.44938.fnf@specifix.com \
    --to=fnf@specifix.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox