This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFA] Patch for mips_o64_return_value to fix calling functions by hand


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

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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]