]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gdb/mep-tdep.c
GDB copyright headers update after running GDB's copyright.py script.
[thirdparty/binutils-gdb.git] / gdb / mep-tdep.c
index e266062ebb9a6c522cd050c5ebbcbda8a5b226ca..a110b04dab1a7a407c87f55a8d9bdef338f63911 100644 (file)
@@ -1,6 +1,6 @@
 /* Target-dependent code for the Toshiba MeP for GDB, the GNU debugger.
 
-   Copyright (C) 2001-2013 Free Software Foundation, Inc.
+   Copyright (C) 2001-2016 Free Software Foundation, Inc.
 
    Contributed by Red Hat, Inc.
 
@@ -27,7 +27,6 @@
 #include "gdbtypes.h"
 #include "gdbcmd.h"
 #include "gdbcore.h"
-#include <string.h>
 #include "value.h"
 #include "inferior.h"
 #include "dis-asm.h"
@@ -48,8 +47,6 @@
 #include "cgen/bitset.h"
 #include "infcall.h"
 
-#include "gdb_assert.h"
-
 /* Get the user's customized MeP coprocessor register names from
    libopcodes.  */
 #include "opcodes/mep-desc.h"
@@ -787,7 +784,9 @@ static int
 mep_debug_reg_to_regnum (struct gdbarch *gdbarch, int debug_reg)
 {
   /* The debug info uses the raw register numbers.  */
-  return mep_raw_to_pseudo[debug_reg];
+  if (debug_reg >= 0 && debug_reg < ARRAY_SIZE (mep_raw_to_pseudo))
+    return mep_raw_to_pseudo[debug_reg];
+  return -1;
 }
 
 
@@ -851,7 +850,7 @@ current_me_module (void)
       ULONGEST regval;
       regcache_cooked_read_unsigned (get_current_regcache (),
                                     MEP_MODULE_REGNUM, &regval);
-      return regval;
+      return (CONFIG_ATTR) regval;
     }
   else
     return gdbarch_tdep (target_gdbarch ())->me_module;
@@ -1129,7 +1128,7 @@ static enum register_status
 mep_pseudo_cr32_read (struct gdbarch *gdbarch,
                       struct regcache *regcache,
                       int cookednum,
-                      void *buf)
+                      gdb_byte *buf)
 {
   enum register_status status;
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -1155,7 +1154,7 @@ static enum register_status
 mep_pseudo_cr64_read (struct gdbarch *gdbarch,
                       struct regcache *regcache,
                       int cookednum,
-                      void *buf)
+                      gdb_byte *buf)
 {
   return regcache_raw_read (regcache, mep_pseudo_to_raw[cookednum], buf);
 }
@@ -1185,7 +1184,7 @@ static void
 mep_pseudo_csr_write (struct gdbarch *gdbarch,
                       struct regcache *regcache,
                       int cookednum,
-                      const void *buf)
+                      const gdb_byte *buf)
 {
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   int size = register_size (gdbarch, cookednum);
@@ -1216,7 +1215,7 @@ static void
 mep_pseudo_cr32_write (struct gdbarch *gdbarch,
                        struct regcache *regcache,
                        int cookednum,
-                       const void *buf)
+                       const gdb_byte *buf)
 {
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   /* Expand the 32-bit value into a 64-bit value, and write that to
@@ -1237,7 +1236,7 @@ static void
 mep_pseudo_cr64_write (struct gdbarch *gdbarch,
                      struct regcache *regcache,
                      int cookednum,
-                     const void *buf)
+                     const gdb_byte *buf)
 {
   regcache_raw_write (regcache, mep_pseudo_to_raw[cookednum], buf);
 }
@@ -1953,10 +1952,11 @@ mep_analyze_frame_prologue (struct frame_info *this_frame,
         stop_addr = func_start;
 
       mep_analyze_prologue (get_frame_arch (this_frame),
-                           func_start, stop_addr, *this_prologue_cache);
+                           func_start, stop_addr,
+                           (struct mep_prologue *) *this_prologue_cache);
     }
 
-  return *this_prologue_cache;
+  return (struct mep_prologue *) *this_prologue_cache;
 }
 
 
@@ -2398,7 +2398,10 @@ mep_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
       /* The way to get the me_module code depends on the object file
          format.  At the moment, we only know how to handle ELF.  */
       if (bfd_get_flavour (info.abfd) == bfd_target_elf_flavour)
-        me_module = elf_elfheader (info.abfd)->e_flags & EF_MEP_INDEX_MASK;
+       {
+         int flag = elf_elfheader (info.abfd)->e_flags & EF_MEP_INDEX_MASK;
+         me_module = (CONFIG_ATTR) flag;
+       }
       else
         me_module = CONFIG_NONE;
     }
@@ -2444,7 +2447,7 @@ mep_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
     if (gdbarch_tdep (arches->gdbarch)->me_module == me_module)
       return arches->gdbarch;
 
-  tdep = (struct gdbarch_tdep *) xmalloc (sizeof (struct gdbarch_tdep));
+  tdep = XNEW (struct gdbarch_tdep);
   gdbarch = gdbarch_alloc (&info, tdep);
 
   /* Get a CGEN CPU descriptor for this architecture.  */