aboutsummaryrefslogtreecommitdiff
path: root/gdb/i386-tdep.c
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@gnu.org>2001-03-31 13:05:16 +0000
committerMark Kettenis <kettenis@gnu.org>2001-03-31 13:05:16 +0000
commit1e8d0a7b553cd82164b9eb5bc55045cf7aa40728 (patch)
tree0677f1fcaacc2804a631528194f860bf0c7f8177 /gdb/i386-tdep.c
parent61b96bb4281e65ed15d15ed7e9ae5102d64bc8c9 (diff)
downloadgdb-1e8d0a7b553cd82164b9eb5bc55045cf7aa40728.zip
gdb-1e8d0a7b553cd82164b9eb5bc55045cf7aa40728.tar.gz
gdb-1e8d0a7b553cd82164b9eb5bc55045cf7aa40728.tar.bz2
* 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.
Diffstat (limited to 'gdb/i386-tdep.c')
-rw-r--r--gdb/i386-tdep.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index a5d3ef7..db001da 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)
{