gdb: add cmd_list_element::is_command_class_help
[deliverable/binutils-gdb.git] / gdb / tilegx-tdep.c
index 8f688b16cf03f2c6b347396865931db826797ee8..9bd982f49f50f1ce0fc9895b40cf6d5f4d6c0dda 100644 (file)
@@ -1,6 +1,6 @@
 /* Target-dependent code for the Tilera TILE-Gx processor.
 
-   Copyright (C) 2012-2018 Free Software Foundation, Inc.
+   Copyright (C) 2012-2021 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -21,7 +21,7 @@
 #include "frame.h"
 #include "frame-base.h"
 #include "frame-unwind.h"
-#include "dwarf2-frame.h"
+#include "dwarf2/frame.h"
 #include "trad-frame.h"
 #include "symtab.h"
 #include "gdbtypes.h"
@@ -40,7 +40,7 @@
 #include "tilegx-tdep.h"
 #include "opcode/tilegx.h"
 #include <algorithm>
-#include "common/byte-vector.h"
+#include "gdbsupport/byte-vector.h"
 
 struct tilegx_frame_cache
 {
@@ -50,7 +50,7 @@ struct tilegx_frame_cache
   CORE_ADDR start_pc;
 
   /* Table of saved registers.  */
-  struct trad_frame_saved_reg *saved_regs;
+  trad_frame_saved_reg *saved_regs;
 };
 
 /* Register state values used by analyze_prologue.  */
@@ -188,9 +188,9 @@ tilegx_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, int num)
 static int
 tilegx_type_is_scalar (struct type *t)
 {
-  return (TYPE_CODE(t) != TYPE_CODE_STRUCT
-         && TYPE_CODE(t) != TYPE_CODE_UNION
-         && TYPE_CODE(t) != TYPE_CODE_ARRAY);
+  return (t->code () != TYPE_CODE_STRUCT
+         && t->code () != TYPE_CODE_UNION
+         && t->code () != TYPE_CODE_ARRAY);
 }
 
 /* Returns non-zero if the given struct type will be returned using
@@ -219,7 +219,7 @@ tilegx_extract_return_value (struct type *type, struct regcache *regcache,
   int i, regnum = TILEGX_R0_REGNUM;
 
   for (i = 0; i < len; i += tilegx_reg_size)
-    regcache_raw_read (regcache, regnum++, valbuf + i);
+    regcache->raw_read (regnum++, valbuf + i);
 }
 
 /* Copy the function return value from VALBUF into the proper
@@ -236,7 +236,7 @@ tilegx_store_return_value (struct type *type, struct regcache *regcache,
       gdb_byte buf[tilegx_reg_size] = { 0 };
 
       memcpy (buf, valbuf, TYPE_LENGTH (type));
-      regcache_raw_write (regcache, TILEGX_R0_REGNUM, buf);
+      regcache->raw_write (TILEGX_R0_REGNUM, buf);
     }
   else
     {
@@ -244,7 +244,7 @@ tilegx_store_return_value (struct type *type, struct regcache *regcache,
       int i, regnum = TILEGX_R0_REGNUM;
 
       for (i = 0; i < len; i += tilegx_reg_size)
-       regcache_raw_write (regcache, regnum++, (gdb_byte *) valbuf + i);
+       regcache->raw_write (regnum++, (gdb_byte *) valbuf + i);
     }
 }
 
@@ -281,7 +281,7 @@ tilegx_push_dummy_call (struct gdbarch *gdbarch,
                        struct regcache *regcache,
                        CORE_ADDR bp_addr, int nargs,
                        struct value **args,
-                       CORE_ADDR sp, int struct_return,
+                       CORE_ADDR sp, function_call_return_method return_method,
                        CORE_ADDR struct_addr)
 {
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -293,7 +293,7 @@ tilegx_push_dummy_call (struct gdbarch *gdbarch,
 
   /* If struct_return is 1, then the struct return address will
      consume one argument-passing register.  */
-  if (struct_return)
+  if (return_method == return_method_struct)
     regcache_cooked_write_unsigned (regcache, argreg++, struct_addr);
 
   /* Arguments are passed in R0 - R9, and as soon as an argument
@@ -429,7 +429,7 @@ tilegx_analyze_prologue (struct gdbarch* gdbarch,
          instbuf_start = next_addr;
 
          status = safe_frame_unwind_memory (next_frame, instbuf_start,
-                                            instbuf, instbuf_size);
+                                            {instbuf, instbuf_size});
          if (status == 0)
            memory_error (TARGET_XFER_E_IO, next_addr);
        }
@@ -459,13 +459,7 @@ tilegx_analyze_prologue (struct gdbarch* gdbarch,
                  unsigned saved_register
                    = (unsigned) reverse_frame[operands[1]].value;
 
-                 /* realreg >= 0 and addr != -1 indicates that the
-                    value of saved_register is in memory location
-                    saved_address.  The value of realreg is not
-                    meaningful in this case but it must be >= 0.
-                    See trad-frame.h.  */
-                 cache->saved_regs[saved_register].realreg = saved_register;
-                 cache->saved_regs[saved_register].addr = saved_address;
+                 cache->saved_regs[saved_register].set_addr (saved_address);
                } 
              else if (cache
                       && (operands[0] == TILEGX_SP_REGNUM) 
@@ -488,14 +482,13 @@ tilegx_analyze_prologue (struct gdbarch* gdbarch,
                  /* Fix up the sign-extension.  */
                  if (opcode->mnemonic == TILEGX_OPC_ADDI)
                    op2_as_short = op2_as_char;
-                 prev_sp_value = (cache->saved_regs[hopefully_sp].addr
+                 prev_sp_value = (cache->saved_regs[hopefully_sp].addr ()
                                   - op2_as_short);
 
                  new_reverse_frame[i].state = REVERSE_STATE_VALUE;
                  new_reverse_frame[i].value
-                   = cache->saved_regs[hopefully_sp].addr;
-                 trad_frame_set_value (cache->saved_regs,
-                                       hopefully_sp, prev_sp_value);
+                   = cache->saved_regs[hopefully_sp].addr ();
+                 cache->saved_regs[hopefully_sp].set_value (prev_sp_value);
                }
              else
                {
@@ -717,17 +710,15 @@ tilegx_analyze_prologue (struct gdbarch* gdbarch,
            {
              unsigned saved_register = (unsigned) reverse_frame[i].value;
 
-             cache->saved_regs[saved_register].realreg = i;
-             cache->saved_regs[saved_register].addr = (LONGEST) -1;
+             cache->saved_regs[saved_register].set_realreg (i);
            }
        }
     }
 
   if (lr_saved_on_stack_p)
     {
-      cache->saved_regs[TILEGX_LR_REGNUM].realreg = TILEGX_LR_REGNUM;
-      cache->saved_regs[TILEGX_LR_REGNUM].addr =
-       cache->saved_regs[TILEGX_SP_REGNUM].addr;
+      CORE_ADDR addr = cache->saved_regs[TILEGX_SP_REGNUM].addr ();
+      cache->saved_regs[TILEGX_LR_REGNUM].set_addr (addr);
     }
 
   return prolog_end;
@@ -746,10 +737,10 @@ tilegx_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
   if (find_pc_partial_function (start_pc, NULL, &func_start, NULL))
     {
       CORE_ADDR post_prologue_pc
-        = skip_prologue_using_sal (gdbarch, func_start);
+       = skip_prologue_using_sal (gdbarch, func_start);
 
       if (post_prologue_pc != 0)
-        return std::max (start_pc, post_prologue_pc);
+       return std::max (start_pc, post_prologue_pc);
     }
 
   /* Don't straddle a section boundary.  */
@@ -834,7 +825,7 @@ tilegx_write_pc (struct regcache *regcache, CORE_ADDR pc)
      within GDB.  In all other cases the system call will not be
      restarted.  */
   regcache_cooked_write_unsigned (regcache, TILEGX_FAULTNUM_REGNUM,
-                                  INT_SWINT_1_SIGRETURN);
+                                 INT_SWINT_1_SIGRETURN);
 }
 
 /* 64-bit pattern for a { bpt ; nop } bundle.  */
@@ -863,7 +854,7 @@ tilegx_frame_cache (struct frame_info *this_frame, void **this_cache)
   current_pc = get_frame_pc (this_frame);
 
   cache->base = get_frame_register_unsigned (this_frame, TILEGX_SP_REGNUM);
-  trad_frame_set_value (cache->saved_regs, TILEGX_SP_REGNUM, cache->base);
+  cache->saved_regs[TILEGX_SP_REGNUM].set_value (cache->base);
 
   if (cache->start_pc)
     tilegx_analyze_prologue (gdbarch, cache->start_pc, current_pc,
@@ -930,29 +921,6 @@ static const struct frame_base tilegx_frame_base = {
   tilegx_frame_base_address
 };
 
-static CORE_ADDR
-tilegx_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, TILEGX_SP_REGNUM);
-}
-
-static CORE_ADDR
-tilegx_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, TILEGX_PC_REGNUM);
-}
-
-static struct frame_id
-tilegx_unwind_dummy_id (struct gdbarch *gdbarch,
-                       struct frame_info *this_frame)
-{
-  CORE_ADDR sp;
-
-  sp = get_frame_register_unsigned (this_frame, TILEGX_SP_REGNUM);
-  return frame_id_build (sp, get_frame_pc (this_frame));
-}
-
-
 /* We cannot read/write the "special" registers.  */
 
 static int
@@ -961,7 +929,7 @@ tilegx_cannot_reference_register (struct gdbarch *gdbarch, int regno)
   if (regno >= 0 && regno < TILEGX_NUM_EASY_REGS)
     return 0;
   else if (regno == TILEGX_PC_REGNUM
-           || regno == TILEGX_FAULTNUM_REGNUM)
+          || regno == TILEGX_FAULTNUM_REGNUM)
     return 0;
   else
     return 1;
@@ -1027,9 +995,6 @@ tilegx_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
 
   /* Frame Info.  */
-  set_gdbarch_unwind_sp (gdbarch, tilegx_unwind_sp);
-  set_gdbarch_unwind_pc (gdbarch, tilegx_unwind_pc);
-  set_gdbarch_dummy_id (gdbarch, tilegx_unwind_dummy_id);
   set_gdbarch_frame_align (gdbarch, tilegx_frame_align);
   frame_base_set_default (gdbarch, &tilegx_frame_base);
 
@@ -1058,8 +1023,9 @@ tilegx_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   return gdbarch;
 }
 
+void _initialize_tilegx_tdep ();
 void
-_initialize_tilegx_tdep (void)
+_initialize_tilegx_tdep ()
 {
   register_gdbarch_init (bfd_arch_tilegx, tilegx_gdbarch_init);
 }
This page took 0.031839 seconds and 4 git commands to generate.