Fix test-cp-name-parser build, unused variable
[deliverable/binutils-gdb.git] / gdb / aarch64-tdep.c
index ae56c9ca34c278ae60c0c68f4497281053448c94..dd57ef987396f784a26dffc96cd87a46f16771ab 100644 (file)
@@ -1,6 +1,6 @@
 /* Common target dependent code for GDB on AArch64 systems.
 
-   Copyright (C) 2009-2018 Free Software Foundation, Inc.
+   Copyright (C) 2009-2019 Free Software Foundation, Inc.
    Contributed by ARM Ltd.
 
    This file is part of GDB.
@@ -43,7 +43,7 @@
 #include "infcall.h"
 #include "ax.h"
 #include "ax-gdb.h"
-#include "selftest.h"
+#include "common/selftest.h"
 
 #include "aarch64-tdep.h"
 #include "aarch64-ravenscar-thread.h"
@@ -51,7 +51,7 @@
 #include "elf-bfd.h"
 #include "elf/aarch64.h"
 
-#include "vec.h"
+#include "common/vec.h"
 
 #include "record.h"
 #include "record-full.h"
@@ -998,39 +998,6 @@ struct frame_base aarch64_normal_base =
   aarch64_normal_frame_base
 };
 
-/* Assuming THIS_FRAME is a dummy, return the frame ID of that
-   dummy frame.  The frame ID's base needs to match the TOS value
-   saved by save_dummy_frame_tos () and returned from
-   aarch64_push_dummy_call, and the PC needs to match the dummy
-   frame's breakpoint.  */
-
-static struct frame_id
-aarch64_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  return frame_id_build (get_frame_register_unsigned (this_frame,
-                                                     AARCH64_SP_REGNUM),
-                        get_frame_pc (this_frame));
-}
-
-/* Implement the "unwind_pc" gdbarch method.  */
-
-static CORE_ADDR
-aarch64_unwind_pc (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  CORE_ADDR pc
-    = frame_unwind_register_unsigned (this_frame, AARCH64_PC_REGNUM);
-
-  return pc;
-}
-
-/* Implement the "unwind_sp" gdbarch method.  */
-
-static CORE_ADDR
-aarch64_unwind_sp (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  return frame_unwind_register_unsigned (this_frame, AARCH64_SP_REGNUM);
-}
-
 /* Return the value of the REGNUM register in the previous frame of
    *THIS_FRAME.  */
 
@@ -1224,6 +1191,10 @@ aapcs_is_vfp_call_or_return_candidate_1 (struct type *type,
 
        for (int i = 0; i < TYPE_NFIELDS (type); i++)
          {
+           /* Ignore any static fields.  */
+           if (field_is_static (&TYPE_FIELD (type, i)))
+             continue;
+
            struct type *member = check_typedef (TYPE_FIELD_TYPE (type, i));
 
            int sub_count = aapcs_is_vfp_call_or_return_candidate_1
@@ -1232,6 +1203,14 @@ aapcs_is_vfp_call_or_return_candidate_1 (struct type *type,
              return -1;
            count += sub_count;
          }
+
+       /* Ensure there is no padding between the fields (allowing for empty
+          zero length structs)  */
+       int ftype_length = (*fundamental_type == nullptr)
+                          ? 0 : TYPE_LENGTH (*fundamental_type);
+       if (count * ftype_length != TYPE_LENGTH (type))
+         return -1;
+
        return count;
       }
 
@@ -1494,6 +1473,10 @@ pass_in_v_vfp_candidate (struct gdbarch *gdbarch, struct regcache *regcache,
     case TYPE_CODE_UNION:
       for (int i = 0; i < TYPE_NFIELDS (arg_type); i++)
        {
+         /* Don't include static fields.  */
+         if (field_is_static (&TYPE_FIELD (arg_type, i)))
+           continue;
+
          struct value *field = value_primitive_field (arg, 0, i, arg_type);
          struct type *field_type = check_typedef (value_type (field));
 
@@ -1932,7 +1915,7 @@ aarch64_extract_return_value (struct type *type, struct regcache *regs,
           || TYPE_IS_REFERENCE (type)
           || TYPE_CODE (type) == TYPE_CODE_ENUM)
     {
-      /* If the the type is a plain integer, then the access is
+      /* If the type is a plain integer, then the access is
         straight-forward.  Otherwise we have to play around a bit
         more.  */
       int len = TYPE_LENGTH (type);
@@ -2939,6 +2922,19 @@ aarch64_get_tdesc_vq (const struct target_desc *tdesc)
   return sve_vq_from_vl (vl);
 }
 
+/* Add all the expected register sets into GDBARCH.  */
+
+static void
+aarch64_add_reggroups (struct gdbarch *gdbarch)
+{
+  reggroup_add (gdbarch, general_reggroup);
+  reggroup_add (gdbarch, float_reggroup);
+  reggroup_add (gdbarch, system_reggroup);
+  reggroup_add (gdbarch, vector_reggroup);
+  reggroup_add (gdbarch, all_reggroup);
+  reggroup_add (gdbarch, save_reggroup);
+  reggroup_add (gdbarch, restore_reggroup);
+}
 
 /* Initialize the current architecture based on INFO.  If possible,
    re-use an architecture from ARCHES, which is a list of
@@ -3062,11 +3058,6 @@ aarch64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_push_dummy_call (gdbarch, aarch64_push_dummy_call);
   set_gdbarch_frame_align (gdbarch, aarch64_frame_align);
 
-  /* Frame handling.  */
-  set_gdbarch_dummy_id (gdbarch, aarch64_dummy_id);
-  set_gdbarch_unwind_pc (gdbarch, aarch64_unwind_pc);
-  set_gdbarch_unwind_sp (gdbarch, aarch64_unwind_sp);
-
   /* Advance PC across function entry code.  */
   set_gdbarch_skip_prologue (gdbarch, aarch64_skip_prologue);
 
@@ -3121,6 +3112,9 @@ aarch64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   /* Virtual tables.  */
   set_gdbarch_vbit_in_delta (gdbarch, 1);
 
+  /* Register architecture.  */
+  aarch64_add_reggroups (gdbarch);
+
   /* Hook in the ABI-specific overrides, if they have been registered.  */
   info.target_desc = tdesc;
   info.tdesc_data = tdesc_data;
This page took 0.065333 seconds and 4 git commands to generate.