From 5275b544d5428abd86214979e6326dc4eabbb3b8 Mon Sep 17 00:00:00 2001 From: Mark Kettenis Date: Sat, 31 Mar 2001 13:05:16 +0000 Subject: * i386-tdep.c (i386_extract_return_value): If the type of the return value is TYPE_STRUCT and the number of fields is one, call ourselves with TYPE set tp the type of the first field. (i386_store_return_value): Likewise. This fixes a problem with returning structs consisting of a single `float' or `double' on *BSD. --- gdb/i386-tdep.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'gdb/i386-tdep.c') diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index a5d3ef74f94..db001dafab7 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -733,7 +733,12 @@ i386_extract_return_value (struct type *type, char *regbuf, char *valbuf) { int len = TYPE_LENGTH (type); - if (TYPE_CODE_FLT == TYPE_CODE (type)) + if (TYPE_CODE (type) == TYPE_CODE_STRUCT + && TYPE_NFIELDS (type) == 1) + return i386_extract_return_value (TYPE_FIELD_TYPE (type, 0), + regbuf, valbuf); + + if (TYPE_CODE (type) == TYPE_CODE_FLT) { if (NUM_FREGS == 0) { @@ -791,7 +796,11 @@ i386_store_return_value (struct type *type, char *valbuf) { int len = TYPE_LENGTH (type); - if (TYPE_CODE_FLT == TYPE_CODE (type)) + if (TYPE_CODE (type) == TYPE_CODE_STRUCT + && TYPE_NFIELDS (type) == 1) + return i386_store_return_value (TYPE_FIELD_TYPE (type, 0), valbuf); + + if (TYPE_CODE (type) == TYPE_CODE_FLT) { if (NUM_FREGS == 0) { -- cgit v1.2.1