Index: gdb/m68k-tdep.c |
diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c |
index b1e2cd4ace99d9e96e23171c7fca107a8239223e..fb17fb96d43c0c105c68b7c4b7d7d27db17bac96 100644 |
--- a/gdb/m68k-tdep.c |
+++ b/gdb/m68k-tdep.c |
@@ -1,6 +1,6 @@ |
/* Target-dependent code for the Motorola 68000 series. |
- Copyright (C) 1990-1996, 1999-2012 Free Software Foundation, Inc. |
+ Copyright (C) 1990-2013 Free Software Foundation, Inc. |
This file is part of GDB. |
@@ -26,7 +26,7 @@ |
#include "symtab.h" |
#include "gdbcore.h" |
#include "value.h" |
-#include "gdb_string.h" |
+#include <string.h> |
#include "gdb_assert.h" |
#include "inferior.h" |
#include "regcache.h" |
@@ -315,7 +315,6 @@ static void |
m68k_svr4_extract_return_value (struct type *type, struct regcache *regcache, |
gdb_byte *valbuf) |
{ |
- int len = TYPE_LENGTH (type); |
gdb_byte buf[M68K_MAX_REGISTER_SIZE]; |
struct gdbarch *gdbarch = get_regcache_arch (regcache); |
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); |
@@ -326,7 +325,7 @@ m68k_svr4_extract_return_value (struct type *type, struct regcache *regcache, |
regcache_raw_read (regcache, M68K_FP0_REGNUM, buf); |
convert_typed_floating (buf, fpreg_type, valbuf, type); |
} |
- else if (TYPE_CODE (type) == TYPE_CODE_PTR && len == 4) |
+ else if (TYPE_CODE (type) == TYPE_CODE_PTR && TYPE_LENGTH (type) == 4) |
regcache_raw_read (regcache, M68K_A0_REGNUM, valbuf); |
else |
m68k_extract_return_value (type, regcache, valbuf); |
@@ -357,7 +356,6 @@ static void |
m68k_svr4_store_return_value (struct type *type, struct regcache *regcache, |
const gdb_byte *valbuf) |
{ |
- int len = TYPE_LENGTH (type); |
struct gdbarch *gdbarch = get_regcache_arch (regcache); |
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); |
@@ -368,7 +366,7 @@ m68k_svr4_store_return_value (struct type *type, struct regcache *regcache, |
convert_typed_floating (valbuf, type, buf, fpreg_type); |
regcache_raw_write (regcache, M68K_FP0_REGNUM, buf); |
} |
- else if (TYPE_CODE (type) == TYPE_CODE_PTR && len == 4) |
+ else if (TYPE_CODE (type) == TYPE_CODE_PTR && TYPE_LENGTH (type) == 4) |
{ |
regcache_raw_write (regcache, M68K_A0_REGNUM, valbuf); |
regcache_raw_write (regcache, M68K_D0_REGNUM, valbuf); |
@@ -377,8 +375,8 @@ m68k_svr4_store_return_value (struct type *type, struct regcache *regcache, |
m68k_store_return_value (type, regcache, valbuf); |
} |
-/* Return non-zero if TYPE, which is assumed to be a structure or |
- union type, should be returned in registers for architecture |
+/* Return non-zero if TYPE, which is assumed to be a structure, union or |
+ complex type, should be returned in registers for architecture |
GDBARCH. */ |
static int |
@@ -388,7 +386,8 @@ m68k_reg_struct_return_p (struct gdbarch *gdbarch, struct type *type) |
enum type_code code = TYPE_CODE (type); |
int len = TYPE_LENGTH (type); |
- gdb_assert (code == TYPE_CODE_STRUCT || code == TYPE_CODE_UNION); |
+ gdb_assert (code == TYPE_CODE_STRUCT || code == TYPE_CODE_UNION |
+ || code == TYPE_CODE_COMPLEX); |
if (tdep->struct_return == pcc_struct_return) |
return 0; |
@@ -410,7 +409,8 @@ m68k_return_value (struct gdbarch *gdbarch, struct value *function, |
enum type_code code = TYPE_CODE (type); |
/* GCC returns a `long double' in memory too. */ |
- if (((code == TYPE_CODE_STRUCT || code == TYPE_CODE_UNION) |
+ if (((code == TYPE_CODE_STRUCT || code == TYPE_CODE_UNION |
+ || code == TYPE_CODE_COMPLEX) |
&& !m68k_reg_struct_return_p (gdbarch, type)) |
|| (code == TYPE_CODE_FLT && TYPE_LENGTH (type) == 12)) |
{ |
@@ -444,7 +444,8 @@ m68k_svr4_return_value (struct gdbarch *gdbarch, struct value *function, |
{ |
enum type_code code = TYPE_CODE (type); |
- if ((code == TYPE_CODE_STRUCT || code == TYPE_CODE_UNION) |
+ if ((code == TYPE_CODE_STRUCT || code == TYPE_CODE_UNION |
+ || code == TYPE_CODE_COMPLEX) |
&& !m68k_reg_struct_return_p (gdbarch, type)) |
{ |
/* The System V ABI says that: |
@@ -1099,9 +1100,6 @@ m68k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) |
feature = tdesc_find_feature (info.target_desc, |
"org.gnu.gdb.m68k.core"); |
- if (feature != NULL) |
- /* Do nothing. */ |
- ; |
if (feature == NULL) |
{ |