This is the mail archive of the gdb-patches@sources.redhat.com 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]

[commit] Fix extracting return values for small structures on i386


This fixes extracting return values that are structures containing a
single `long double' on ABI's that return small structures in
registers (i.e. the BSD's).

Mark


Index: ChangeLog
from  Mark Kettenis  <kettenis@gnu.org>

	* i386-tdep.c (i386_reg_struct_return_p): Handle structures with a
	single 'long double' member correctly.
	(i386_return_value): Tweak comment.

Index: i386-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-tdep.c,v
retrieving revision 1.215
diff -u -p -r1.215 i386-tdep.c
--- i386-tdep.c 24 Jun 2005 08:12:32 -0000 1.215
+++ i386-tdep.c 18 Jul 2005 12:39:21 -0000
@@ -1427,6 +1427,15 @@ i386_reg_struct_return_p (struct gdbarch
 	  && tdep->struct_return == pcc_struct_return))
     return 0;
 
+  /* Structures consisting of a single `float', `double' or 'long
+     double' member are returned in %st(0).  */
+  if (code == TYPE_CODE_STRUCT && TYPE_NFIELDS (type) == 1)
+    {
+      type = check_typedef (TYPE_FIELD_TYPE (type, 0));
+      if (TYPE_CODE (type) == TYPE_CODE_FLT)
+	return (len == 4 || len == 8 || len == 12);
+    }
+
   return (len == 1 || len == 2 || len == 4 || len == 8);
 }
 
@@ -1469,11 +1478,12 @@ i386_return_value (struct gdbarch *gdbar
     }
 
   /* This special case is for structures consisting of a single
-     `float' or `double' member.  These structures are returned in
-     %st(0).  For these structures, we call ourselves recursively,
-     changing TYPE into the type of the first member of the structure.
-     Since that should work for all structures that have only one
-     member, we don't bother to check the member's type here.  */
+     `float', `double' or 'long double' member.  These structures are
+     returned in %st(0).  For these structures, we call ourselves
+     recursively, changing TYPE into the type of the first member of
+     the structure.  Since that should work for all structures that
+     have only one member, we don't bother to check the member's type
+     here.  */
   if (code == TYPE_CODE_STRUCT && TYPE_NFIELDS (type) == 1)
     {
       type = check_typedef (TYPE_FIELD_TYPE (type, 0));


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