gdb: add target_ops::supports_displaced_step
[deliverable/binutils-gdb.git] / gdb / csky-tdep.c
index 997ca93288b36d096a0fd9548f1a35205a9c438e..7e5b71eece0f497f0c44ed89c522d8e0a8bb1135 100644 (file)
@@ -1,6 +1,6 @@
 /* Target-dependent code for the CSKY architecture, for GDB.
 
-   Copyright (C) 2010-2018 Free Software Foundation, Inc.
+   Copyright (C) 2010-2020 Free Software Foundation, Inc.
 
    Contributed by C-SKY Microsystems and Mentor Graphics.
 
@@ -20,7 +20,7 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "defs.h"
-#include "gdb_assert.h"
+#include "gdbsupport/gdb_assert.h"
 #include "frame.h"
 #include "inferior.h"
 #include "symtab.h"
 #include "floatformat.h"
 #include "remote.h"
 #include "target-descriptions.h"
-#include "dwarf2-frame.h"
+#include "dwarf2/frame.h"
 #include "user-regs.h"
 #include "valprint.h"
-#include "reggroups.h"
 #include "csky-tdep.h"
 #include "regset.h"
-#include "block.h"
 #include "opcode/csky.h"
 #include <algorithm>
 #include <vector>
 
 /* Control debugging information emitted in this file.  */
-static int csky_debug = 0;
+static bool csky_debug = false;
 
 static struct reggroup *cr_reggroup;
 static struct reggroup *fr_reggroup;
@@ -162,14 +160,6 @@ csky_write_pc (regcache *regcache, CORE_ADDR val)
   regcache_cooked_write_unsigned (regcache, CSKY_PC_REGNUM, val);
 }
 
-/* Implement the unwind_sp gdbarch method.  */
-
-static CORE_ADDR
-csky_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, CSKY_SP_REGNUM);
-}
-
 /* C-Sky ABI register names.  */
 
 static const char *csky_register_names[] =
@@ -277,7 +267,7 @@ csky_vector_type (struct gdbarch *gdbarch)
                               init_vector_type (bt->builtin_int8, 16));
 
   TYPE_VECTOR (t) = 1;
-  TYPE_NAME (t) = "builtin_type_vec128i";
+  t->set_name ("builtin_type_vec128i");
 
   return t;
 }
@@ -336,7 +326,8 @@ static CORE_ADDR
 csky_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
                      struct regcache *regcache, CORE_ADDR bp_addr,
                      int nargs, struct value **args, CORE_ADDR sp,
-                     int struct_return, CORE_ADDR struct_addr)
+                     function_call_return_method return_method,
+                     CORE_ADDR struct_addr)
 {
   int argnum;
   int argreg = CSKY_ABI_A0_REGNUM;
@@ -351,7 +342,7 @@ csky_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
 
   /* The struct_return pointer occupies the first parameter
      passing register.  */
-  if (struct_return)
+  if (return_method == return_method_struct)
     {
       if (csky_debug)
        {
@@ -1103,8 +1094,8 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
                                          "csky: found stack adjustment of"
                                          " 0x%x bytes.\n", adjust);
                      fprintf_unfiltered (gdb_stdlog,
-                                         "csky: skipping to new address "
-                                         "0x%lx\n", addr);
+                                         "csky: skipping to new address %s\n",
+                                         core_addr_to_string_nz (addr));
                      fprintf_unfiltered (gdb_stdlog,
                                          "csky: continuing\n");
                    }
@@ -1205,7 +1196,6 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
          else if (CSKY_16_IS_LRW4 (insn) || CSKY_16_IS_MOVI4 (insn))
            {
              int adjust = 0;
-             int offset = 0;
              unsigned int insn2;
 
              if (csky_debug)
@@ -1239,7 +1229,7 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
                  fprintf_unfiltered (gdb_stdlog,
                                      "csky: looking for r4 adjusters...\n");
                }
-             offset = 2;
+             int offset = 2;
              insn_len = csky_get_insn (gdbarch, addr + offset, &insn2);
              while (CSKY_IS_R4_ADJUSTER (insn2))
                {
@@ -1415,8 +1405,8 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
                                          "found stack adjustment of 0x%x"
                                          " bytes.\n", adjust);
                      fprintf_unfiltered (gdb_stdlog, "csky: "
-                                         "skipping to new address 0x%lx\n",
-                                         addr);
+                                         "skipping to new address %s\n",
+                                         core_addr_to_string_nz (addr));
                      fprintf_unfiltered (gdb_stdlog, "csky: continuing\n");
                    }
                  continue;
@@ -1609,7 +1599,7 @@ csky_memory_insert_breakpoint (struct gdbarch *gdbarch,
 
   /* Sanity-check bp_address.  */
   if (bp_tgt->reqstd_address % 2)
-    warning (_("Invalid breakpoint address 0x%x is an odd number.\n"),
+    warning (_("Invalid breakpoint address 0x%x is an odd number."),
             (unsigned int) bp_tgt->reqstd_address);
   scoped_restore restore_memory
     = make_scoped_restore_show_memory_breakpoints (1);
@@ -1885,14 +1875,6 @@ csky_frame_unwind_cache (struct frame_info *this_frame)
   return cache;
 }
 
-/* Implement the unwind_pc gdbarch method.  */
-
-static CORE_ADDR
-csky_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, CSKY_PC_REGNUM);
-}
-
 /* Implement the this_id function for the normal unwinder.  */
 
 static void
@@ -2047,19 +2029,6 @@ static const struct frame_base csky_frame_base = {
   csky_frame_base_address
 };
 
-/* Implement the dummy_id gdbarch method.  The frame ID's base
-   needs to match the TOS value saved by save_dummy_frame_tos,
-   and the PC should match the dummy frame's breakpoint.  */
-
-static struct frame_id
-csky_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  unsigned int sp_regnum = CSKY_SP_REGNUM;
-
-  CORE_ADDR sp = get_frame_register_unsigned (this_frame, sp_regnum);
-  return frame_id_build (sp, get_frame_pc (this_frame));
-}
-
 /* Initialize register access method.  */
 
 static void
@@ -2247,13 +2216,8 @@ csky_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_frame_align (gdbarch, csky_frame_align);
   set_gdbarch_stack_frame_destroyed_p (gdbarch, csky_stack_frame_destroyed_p);
 
-  /* Functions to access frame data.  */
-  set_gdbarch_unwind_pc (gdbarch, csky_unwind_pc);
-  set_gdbarch_unwind_sp (gdbarch, csky_unwind_sp);
-
   /* Functions handling dummy frames.  */
   set_gdbarch_push_dummy_call (gdbarch, csky_push_dummy_call);
-  set_gdbarch_dummy_id (gdbarch, csky_dummy_id);
 
   /* Frame unwinders.  Use DWARF debug info if available,
      otherwise use our own unwinder.  */
@@ -2276,8 +2240,9 @@ csky_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   return gdbarch;
 }
 
+void _initialize_csky_tdep ();
 void
-_initialize_csky_tdep (void)
+_initialize_csky_tdep ()
 {
 
   register_gdbarch_init (bfd_arch_csky, csky_gdbarch_init);
This page took 0.02736 seconds and 4 git commands to generate.