* config/pa/tm-hppa.h (EXTRACT_RETURN_VALUE): Rewrite to correctly
authorJeff Law <law@redhat.com>
Sat, 22 Apr 1995 07:30:32 +0000 (07:30 +0000)
committerJeff Law <law@redhat.com>
Sat, 22 Apr 1995 07:30:32 +0000 (07:30 +0000)
handle "short", "int" and small structures returned in registers.

gdb/config/pa/tm-hppa.h

index e346f3a2006246a16f8f89228aa5783c48c8a59c..d3ec6cf0f61fc3a4b7616e85e9a50fe307f83869 100644 (file)
@@ -238,8 +238,17 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
    into VALBUF.  */
 
 #define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
-  memcpy (VALBUF, (REGBUF) + REGISTER_BYTE(TYPE_LENGTH(TYPE) > 4 ? \
-                                         FP4_REGNUM :28), TYPE_LENGTH (TYPE))
+  { \
+    if (TYPE_CODE (TYPE) == TYPE_CODE_FLT) \
+      memcpy ((VALBUF), \
+             ((int *)(REGBUF)) + REGISTER_BYTE (FP4_REGNUM), \
+             TYPE_LENGTH (TYPE)); \
+    else \
+      memcpy ((VALBUF), \
+             (char *)(REGBUF) + REGISTER_BYTE (28) + \
+             (TYPE_LENGTH (TYPE) >= 4 ? 0 : 4 - TYPE_LENGTH (TYPE)), \
+             TYPE_LENGTH (TYPE)); \
+  }
 
 /* Write into appropriate registers a function return value
    of type TYPE, given in virtual format.  */