aboutsummaryrefslogtreecommitdiff
path: root/gdb/sparc64-tdep.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@redhat.com>2011-09-28 17:59:42 +0000
committerDavid S. Miller <davem@redhat.com>2011-09-28 17:59:42 +0000
commitfe10a582b69fc09ce4775071aa619b0a6fc5dd1a (patch)
tree90f615bc2c8d392eb1532c4aacb28a0b717b84d4 /gdb/sparc64-tdep.c
parent766ad876093f4df3a7f3836df3c705a2243ea2e7 (diff)
downloadgdb-fe10a582b69fc09ce4775071aa619b0a6fc5dd1a.zip
gdb-fe10a582b69fc09ce4775071aa619b0a6fc5dd1a.tar.gz
gdb-fe10a582b69fc09ce4775071aa619b0a6fc5dd1a.tar.bz2
Fix complex floats on sparc.
* sparc-tdep.h (SPARC_F2_REGNUM, SPARC_F3_REGNUM, SPARC_F4_REGNUM, SPARC_F5_REGNUM, SPARC_F6_REGNUM, SPARC_F7_REGNUM): New enums. * sparc-tdep.c (sparc_complex_floating_p): New function. (sparc32_store_arguments): Handle complex floats. (sparc32_extract_return_value): Likewise. (sparc32_store_return_value): Likewise. (sparc32_stabs_argument_has_addr): Likewise. * sparc64-tdep.c (sparc64_complex_floating_p): New function. (sparc64_store_floating_fields): Handle complex floats. (sparc64_store_arguments): Likewise. (sparc64_store_return_value): Likewise.
Diffstat (limited to 'gdb/sparc64-tdep.c')
-rw-r--r--gdb/sparc64-tdep.c32
1 files changed, 27 insertions, 5 deletions
diff --git a/gdb/sparc64-tdep.c b/gdb/sparc64-tdep.c
index 0430ecf..31ee613 100644
--- a/gdb/sparc64-tdep.c
+++ b/gdb/sparc64-tdep.c
@@ -103,6 +103,26 @@ sparc64_floating_p (const struct type *type)
return 0;
}
+/* Check whether TYPE is "Complex Floating". */
+
+static int
+sparc64_complex_floating_p (const struct type *type)
+{
+ switch (TYPE_CODE (type))
+ {
+ case TYPE_CODE_COMPLEX:
+ {
+ int len = TYPE_LENGTH (type);
+ gdb_assert (len == 8 || len == 16 || len == 32);
+ }
+ return 1;
+ default:
+ break;
+ }
+
+ return 0;
+}
+
/* Check whether TYPE is "Structure or Union".
In terms of Ada subprogram calls, arrays are treated the same as
@@ -622,11 +642,13 @@ static void
sparc64_store_floating_fields (struct regcache *regcache, struct type *type,
const gdb_byte *valbuf, int element, int bitpos)
{
+ int len = TYPE_LENGTH (type);
+
gdb_assert (element < 16);
- if (sparc64_floating_p (type))
+ if (sparc64_floating_p (type)
+ || (sparc64_complex_floating_p (type) && len <= 16))
{
- int len = TYPE_LENGTH (type);
int regnum;
if (len == 16)
@@ -886,7 +908,7 @@ sparc64_store_arguments (struct regcache *regcache, int nargs,
if (element < 16)
sparc64_store_floating_fields (regcache, type, valbuf, element, 0);
}
- else if (sparc64_floating_p (type))
+ else if (sparc64_floating_p (type) || sparc64_complex_floating_p (type))
{
/* Floating arguments. */
if (len == 16)
@@ -901,7 +923,7 @@ sparc64_store_arguments (struct regcache *regcache, int nargs,
if (element < 16)
regnum = SPARC64_D0_REGNUM + element;
}
- else
+ else if (len == 4)
{
/* The psABI says "Each single-precision parameter value
will be assigned to one extended word in the
@@ -1067,7 +1089,7 @@ sparc64_store_return_value (struct type *type, struct regcache *regcache,
if (TYPE_CODE (type) != TYPE_CODE_UNION)
sparc64_store_floating_fields (regcache, type, buf, 0, 0);
}
- else if (sparc64_floating_p (type))
+ else if (sparc64_floating_p (type) || sparc64_complex_floating_p (type))
{
/* Floating return values. */
memcpy (buf, valbuf, len);