Change objcopy's --set-section-alignment option to take a byte alignment value rather...
[deliverable/binutils-gdb.git] / gdb / xtensa-tdep.c
index 49a7f023e7d9ec6d0ad3f2ca0dec294eb813b6d4..efa0bcb1dc3ba05cd037874aa2431d060873aa3f 100644 (file)
@@ -1,6 +1,6 @@
 /* Target-dependent code for the Xtensa port of GDB, the GNU debugger.
 
-   Copyright (C) 2003-2018 Free Software Foundation, Inc.
+   Copyright (C) 2003-2019 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -234,9 +234,7 @@ xtensa_find_register_by_name (struct gdbarch *gdbarch, const char *name)
 {
   int i;
 
-  for (i = 0; i < gdbarch_num_regs (gdbarch)
-        + gdbarch_num_pseudo_regs (gdbarch);
-       i++)
+  for (i = 0; i < gdbarch_num_cooked_regs (gdbarch); i++)
 
     if (strcasecmp (gdbarch_tdep (gdbarch)->regmap[i].name, name) == 0)
       return i;
@@ -249,8 +247,7 @@ static const char *
 xtensa_register_name (struct gdbarch *gdbarch, int regnum)
 {
   /* Return the name stored in the register map.  */
-  if (regnum >= 0 && regnum < gdbarch_num_regs (gdbarch)
-                             + gdbarch_num_pseudo_regs (gdbarch))
+  if (regnum >= 0 && regnum < gdbarch_num_cooked_regs (gdbarch))
     return gdbarch_tdep (gdbarch)->regmap[regnum].name;
 
   internal_error (__FILE__, __LINE__, _("invalid register %d"), regnum);
@@ -276,8 +273,7 @@ xtensa_register_type (struct gdbarch *gdbarch, int regnum)
     return builtin_type (gdbarch)->builtin_data_ptr;
 
   /* Return the stored type for all other registers.  */
-  else if (regnum >= 0 && regnum < gdbarch_num_regs (gdbarch)
-                                  + gdbarch_num_pseudo_regs (gdbarch))
+  else if (regnum >= 0 && regnum < gdbarch_num_cooked_regs (gdbarch))
     {
       xtensa_register_t* reg = &tdep->regmap[regnum];
 
@@ -352,9 +348,7 @@ xtensa_reg_to_regnum (struct gdbarch *gdbarch, int regnum)
   if (regnum >= 0 && regnum < 16)
     return gdbarch_tdep (gdbarch)->a0_base + regnum;
 
-  for (i = 0;
-       i < gdbarch_num_regs (gdbarch) + gdbarch_num_pseudo_regs (gdbarch);
-       i++)
+  for (i = 0; i < gdbarch_num_cooked_regs (gdbarch); i++)
     if (regnum == gdbarch_tdep (gdbarch)->regmap[i].target_number)
       return i;
 
@@ -585,9 +579,7 @@ xtensa_pseudo_register_read (struct gdbarch *gdbarch,
       return REG_VALID;
     }
   /* Pseudo registers.  */
-  else if (regnum >= 0
-           && regnum < gdbarch_num_regs (gdbarch)
-                       + gdbarch_num_pseudo_regs (gdbarch))
+  else if (regnum >= 0 && regnum < gdbarch_num_cooked_regs (gdbarch))
     {
       xtensa_register_t *reg = &gdbarch_tdep (gdbarch)->regmap[regnum];
       xtensa_register_type_t type = reg->type;
@@ -670,9 +662,7 @@ xtensa_pseudo_register_write (struct gdbarch *gdbarch,
       return;
     }
   /* Pseudo registers.  */
-  else if (regnum >= 0
-          && regnum < gdbarch_num_regs (gdbarch)
-                      + gdbarch_num_pseudo_regs (gdbarch))
+  else if (regnum >= 0 && regnum < gdbarch_num_cooked_regs (gdbarch))
     {
       xtensa_register_t *reg = &gdbarch_tdep (gdbarch)->regmap[regnum];
       xtensa_register_type_t type = reg->type;
@@ -1625,8 +1615,8 @@ xtensa_store_return_value (struct type *type,
 
       if (len > (callsize > 8 ? 8 : 16))
        internal_error (__FILE__, __LINE__,
-                       _("unimplemented for this length: %d"),
-                       TYPE_LENGTH (type));
+                       _("unimplemented for this length: %s"),
+                       pulongest (TYPE_LENGTH (type)));
       areg = arreg_number (gdbarch,
                           gdbarch_tdep (gdbarch)->a0_base + 2 + callsize, wb);
 
@@ -1695,11 +1685,10 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch,
                        int nargs,
                        struct value **args,
                        CORE_ADDR sp,
-                       int struct_return,
+                       function_call_return_method return_method,
                        CORE_ADDR struct_addr)
 {
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
-  int i;
   int size, onstack_size;
   gdb_byte *buf = (gdb_byte *) alloca (16);
   CORE_ADDR ra, ps;
@@ -1725,19 +1714,18 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch,
 
   if (xtensa_debug_level > 3)
     {
-      int i;
       DEBUGINFO ("[xtensa_push_dummy_call] nargs = %d\n", nargs);
-      DEBUGINFO ("[xtensa_push_dummy_call] sp=0x%x, struct_return=%d, "
+      DEBUGINFO ("[xtensa_push_dummy_call] sp=0x%x, return_method=%d, "
                 "struct_addr=0x%x\n",
-                (int) sp, (int) struct_return, (int) struct_addr);
+                (int) sp, (int) return_method, (int) struct_addr);
 
-      for (i = 0; i < nargs; i++)
+      for (int i = 0; i < nargs; i++)
         {
          struct value *arg = args[i];
          struct type *arg_type = check_typedef (value_type (arg));
-         fprintf_unfiltered (gdb_stdlog, "%2d: %s %3d ", i,
+         fprintf_unfiltered (gdb_stdlog, "%2d: %s %3s ", i,
                              host_address_to_string (arg),
-                             TYPE_LENGTH (arg_type));
+                             pulongest (TYPE_LENGTH (arg_type)));
          switch (TYPE_CODE (arg_type))
            {
            case TYPE_CODE_INT:
@@ -1762,12 +1750,11 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch,
 
   size = 0;
   onstack_size = 0;
-  i = 0;
 
-  if (struct_return)
+  if (return_method == return_method_struct)
     size = REGISTER_SIZE;
 
-  for (i = 0; i < nargs; i++)
+  for (int i = 0; i < nargs; i++)
     {
       struct argument_info *info = &arg_info[i];
       struct value *arg = args[i];
@@ -1841,13 +1828,13 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch,
 
   /* Second Loop: Load arguments.  */
 
-  if (struct_return)
+  if (return_method == return_method_struct)
     {
       store_unsigned_integer (buf, REGISTER_SIZE, byte_order, struct_addr);
       regcache->cooked_write (ARG_1ST (gdbarch), buf);
     }
 
-  for (i = 0; i < nargs; i++)
+  for (int i = 0; i < nargs; i++)
     {
       struct argument_info *info = &arg_info[i];
 
This page took 0.027128 seconds and 4 git commands to generate.