gdb: add target_ops::supports_displaced_step
[deliverable/binutils-gdb.git] / gdb / s390-tdep.c
index a4aae0736ddbc0022fa6e61c47f0dc068c2b5c8e..66369c690934b25be4d6755f343e235d1b3d6f2e 100644 (file)
@@ -1,6 +1,6 @@
 /* Target-dependent code for s390.
 
-   Copyright (C) 2001-2019 Free Software Foundation, Inc.
+   Copyright (C) 2001-2020 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -21,7 +21,7 @@
 
 #include "arch-utils.h"
 #include "ax-gdb.h"
-#include "dwarf2-frame.h"
+#include "dwarf2/frame.h"
 #include "elf/s390.h"
 #include "elf-bfd.h"
 #include "frame-base.h"
@@ -63,7 +63,7 @@ s390_type_align (gdbarch *gdbarch, struct type *t)
 
   if (TYPE_LENGTH (t) > 8)
     {
-      switch (TYPE_CODE (t))
+      switch (t->code ())
        {
        case TYPE_CODE_INT:
        case TYPE_CODE_RANGE:
@@ -421,18 +421,18 @@ is_non_branch_ril (gdb_byte *insn)
   return 0;
 }
 
-typedef buf_displaced_step_closure s390_displaced_step_closure;
+typedef buf_displaced_step_copy_insn_closure s390_displaced_step_copy_insn_closure;
 
 /* Implementation of gdbarch_displaced_step_copy_insn.  */
 
-static struct displaced_step_closure *
+static displaced_step_copy_insn_closure_up
 s390_displaced_step_copy_insn (struct gdbarch *gdbarch,
                               CORE_ADDR from, CORE_ADDR to,
                               struct regcache *regs)
 {
   size_t len = gdbarch_max_insn_length (gdbarch);
-  std::unique_ptr<s390_displaced_step_closure> closure
-    (new s390_displaced_step_closure (len));
+  std::unique_ptr<s390_displaced_step_copy_insn_closure> closure
+    (new s390_displaced_step_copy_insn_closure (len));
   gdb_byte *buf = closure->buf.data ();
 
   read_memory (from, buf, len);
@@ -477,7 +477,8 @@ s390_displaced_step_copy_insn (struct gdbarch *gdbarch,
       displaced_step_dump_bytes (gdb_stdlog, buf, len);
     }
 
-  return closure.release ();
+  /* This is a work around for a problem with g++ 4.8.  */
+  return displaced_step_copy_insn_closure_up (closure.release ());
 }
 
 /* Fix up the state of registers and memory after having single-stepped
@@ -485,13 +486,13 @@ s390_displaced_step_copy_insn (struct gdbarch *gdbarch,
 
 static void
 s390_displaced_step_fixup (struct gdbarch *gdbarch,
-                          struct displaced_step_closure *closure_,
+                          struct displaced_step_copy_insn_closure *closure_,
                           CORE_ADDR from, CORE_ADDR to,
                           struct regcache *regs)
 {
   /* Our closure is a copy of the instruction.  */
-  s390_displaced_step_closure *closure
-    = (s390_displaced_step_closure *) closure_;
+  s390_displaced_step_copy_insn_closure *closure
+    = (s390_displaced_step_copy_insn_closure *) closure_;
   gdb_byte *insn = closure->buf.data ();
   static int s390_instrlen[] = { 2, 4, 4, 6 };
   int insnlen = s390_instrlen[insn[0] >> 6];
@@ -586,7 +587,7 @@ s390_displaced_step_fixup (struct gdbarch *gdbarch,
 
 static int
 s390_displaced_step_hw_singlestep (struct gdbarch *gdbarch,
-                                  struct displaced_step_closure *closure)
+                                  struct displaced_step_copy_insn_closure *closure)
 {
   return 1;
 }
@@ -1637,15 +1638,15 @@ s390_address_class_name_to_type_flags (struct gdbarch *gdbarch,
 static struct type *
 s390_effective_inner_type (struct type *type, unsigned int min_size)
 {
-  while (TYPE_CODE (type) == TYPE_CODE_STRUCT)
+  while (type->code () == TYPE_CODE_STRUCT)
     {
       struct type *inner = NULL;
 
       /* Find a non-static field, if any.  Unless there's exactly one,
         abort the unwrapping.  */
-      for (int i = 0; i < TYPE_NFIELDS (type); i++)
+      for (int i = 0; i < type->num_fields (); i++)
        {
-         struct field f = TYPE_FIELD (type, i);
+         struct field f = type->field (i);
 
          if (field_is_static (&f))
            continue;
@@ -1680,8 +1681,8 @@ s390_function_arg_float (struct type *type)
      or double.  */
   type = s390_effective_inner_type (type, 0);
 
-  return (TYPE_CODE (type) == TYPE_CODE_FLT
-         || TYPE_CODE (type) == TYPE_CODE_DECFLOAT);
+  return (type->code () == TYPE_CODE_FLT
+         || type->code () == TYPE_CODE_DECFLOAT);
 }
 
 /* Return non-zero if TYPE should be passed like a vector.  */
@@ -1695,7 +1696,7 @@ s390_function_arg_vector (struct type *type)
   /* Structs containing just a vector are passed like a vector.  */
   type = s390_effective_inner_type (type, TYPE_LENGTH (type));
 
-  return TYPE_CODE (type) == TYPE_CODE_ARRAY && TYPE_VECTOR (type);
+  return type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type);
 }
 
 /* Determine whether N is a power of two.  */
@@ -1713,7 +1714,7 @@ is_power_of_two (unsigned int n)
 static int
 s390_function_arg_integer (struct type *type)
 {
-  enum type_code code = TYPE_CODE (type);
+  enum type_code code = type->code ();
 
   if (TYPE_LENGTH (type) > 8)
     return 0;
@@ -1920,7 +1921,7 @@ s390_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
   CORE_ADDR param_area_start, new_sp;
   struct type *ftype = check_typedef (value_type (function));
 
-  if (TYPE_CODE (ftype) == TYPE_CODE_PTR)
+  if (ftype->code () == TYPE_CODE_PTR)
     ftype = check_typedef (TYPE_TARGET_TYPE (ftype));
 
   arg_prep.copy = sp;
@@ -1937,7 +1938,7 @@ s390_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
      and arg_state.argp with the size of the parameter area.  */
   for (i = 0; i < nargs; i++)
     s390_handle_arg (&arg_state, args[i], tdep, word_size, byte_order,
-                    TYPE_VARARGS (ftype) && i >= TYPE_NFIELDS (ftype));
+                    TYPE_VARARGS (ftype) && i >= ftype->num_fields ());
 
   param_area_start = align_down (arg_state.copy - arg_state.argp, 8);
 
@@ -1964,7 +1965,7 @@ s390_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
   /* Write all parameters.  */
   for (i = 0; i < nargs; i++)
     s390_handle_arg (&arg_state, args[i], tdep, word_size, byte_order,
-                    TYPE_VARARGS (ftype) && i >= TYPE_NFIELDS (ftype));
+                    TYPE_VARARGS (ftype) && i >= ftype->num_fields ());
 
   /* Store return PSWA.  In 31-bit mode, keep addressing mode bit.  */
   if (word_size == 4)
@@ -2020,7 +2021,7 @@ s390_register_return_value (struct gdbarch *gdbarch, struct type *type,
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   int word_size = gdbarch_ptr_bit (gdbarch) / 8;
   int length = TYPE_LENGTH (type);
-  int code = TYPE_CODE (type);
+  int code = type->code ();
 
   if (code == TYPE_CODE_FLT || code == TYPE_CODE_DECFLOAT)
     {
@@ -2082,7 +2083,7 @@ s390_return_value (struct gdbarch *gdbarch, struct value *function,
 
   type = check_typedef (type);
 
-  switch (TYPE_CODE (type))
+  switch (type->code ())
     {
     case TYPE_CODE_STRUCT:
     case TYPE_CODE_UNION:
@@ -7215,8 +7216,9 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   return gdbarch;
 }
 
+void _initialize_s390_tdep ();
 void
-_initialize_s390_tdep (void)
+_initialize_s390_tdep ()
 {
   /* Hook us into the gdbarch mechanism.  */
   register_gdbarch_init (bfd_arch_s390, s390_gdbarch_init);
This page took 0.044278 seconds and 4 git commands to generate.