aboutsummaryrefslogtreecommitdiff
path: root/gdb/i386-tdep.c
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@gnu.org>2005-07-18 12:40:13 +0000
committerMark Kettenis <kettenis@gnu.org>2005-07-18 12:40:13 +0000
commit9edde48e00d4278aa430b25b96ee8703ebf3d880 (patch)
treef895a85a13cc4c94ae207325e8bef2b28466e7ce /gdb/i386-tdep.c
parent6bdae935ab11a79ae7c5399950e138b337c17bed (diff)
downloadgdb-9edde48e00d4278aa430b25b96ee8703ebf3d880.zip
gdb-9edde48e00d4278aa430b25b96ee8703ebf3d880.tar.gz
gdb-9edde48e00d4278aa430b25b96ee8703ebf3d880.tar.bz2
* i386-tdep.c (i386_reg_struct_return_p): Handle structures with a
single 'long double' member correctly. (i386_return_value): Tweak comment.
Diffstat (limited to 'gdb/i386-tdep.c')
-rw-r--r--gdb/i386-tdep.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index 40739a0..7c04787 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -1427,6 +1427,15 @@ i386_reg_struct_return_p (struct gdbarch *gdbarch, struct type *type)
&& 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 *gdbarch, struct type *type,
}
/* 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));