objcopy/strip: Add option --remove-relocations=SECTIONPATTERN
[deliverable/binutils-gdb.git] / gdb / m68k-tdep.c
index cc1df343845ae695cd0ab0c25bab1d56d252a9ef..5d7b65d285e5baf530221bd31fe71f1a3e93fd64 100644 (file)
@@ -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-2016 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -26,8 +26,6 @@
 #include "symtab.h"
 #include "gdbcore.h"
 #include "value.h"
-#include "gdb_string.h"
-#include "gdb_assert.h"
 #include "inferior.h"
 #include "regcache.h"
 #include "arch-utils.h"
@@ -315,7 +313,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 +323,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 +354,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 +364,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 +373,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 +384,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 +407,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 +442,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:
@@ -574,7 +573,7 @@ m68k_dwarf_reg_to_regnum (struct gdbarch *gdbarch, int num)
     /* pc */
     return M68K_PC_REGNUM;
   else
-    return gdbarch_num_regs (gdbarch) + gdbarch_num_pseudo_regs (gdbarch);
+    return -1;
 }
 
 \f
@@ -883,7 +882,7 @@ m68k_frame_cache (struct frame_info *this_frame, void **this_cache)
   int i;
 
   if (*this_cache)
-    return *this_cache;
+    return (struct m68k_frame_cache *) *this_cache;
 
   cache = m68k_alloc_frame_cache ();
   *this_cache = cache;
@@ -1029,7 +1028,7 @@ m68k_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc)
       return 0;
     }
 
-  buf = alloca (gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT);
+  buf = (gdb_byte *) alloca (gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT);
   sp = get_frame_register_unsigned (frame, gdbarch_sp_regnum (gdbarch));
 
   if (target_read_memory (sp + SP_ARG0,        /* Offset of first arg on stack.  */
@@ -1050,6 +1049,16 @@ m68k_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc)
 }
 \f
 
+/* This is the implementation of gdbarch method
+   return_in_first_hidden_param_p.  */
+
+static int
+m68k_return_in_first_hidden_param_p (struct gdbarch *gdbarch,
+                                    struct type *type)
+{
+  return 0;
+}
+
 /* System V Release 4 (SVR4).  */
 
 void
@@ -1089,9 +1098,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)
        {
@@ -1179,7 +1185,7 @@ m68k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
       return best_arch->gdbarch;
     }
 
-  tdep = xzalloc (sizeof (struct gdbarch_tdep));
+  tdep = XCNEW (struct gdbarch_tdep);
   gdbarch = gdbarch_alloc (&info, tdep);
   tdep->fpregs_present = has_fp;
   tdep->flavour = flavour;
@@ -1235,6 +1241,8 @@ m68k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   /* Function call & return.  */
   set_gdbarch_push_dummy_call (gdbarch, m68k_push_dummy_call);
   set_gdbarch_return_value (gdbarch, m68k_return_value);
+  set_gdbarch_return_in_first_hidden_param_p (gdbarch,
+                                             m68k_return_in_first_hidden_param_p);
 
 
   /* Disassembler.  */
This page took 0.027767 seconds and 4 git commands to generate.