Handle pending stops from the Windows kernel
[deliverable/binutils-gdb.git] / gdb / s390-tdep.c
index e7f1215e1aec7792509fd23eb4e95cc5bfdc4f02..d8c28c72e49c3015eacc2a4be3dacf3d0a70bd46 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"
@@ -425,7 +425,7 @@ typedef buf_displaced_step_closure s390_displaced_step_closure;
 
 /* Implementation of gdbarch_displaced_step_copy_insn.  */
 
-static struct displaced_step_closure *
+static displaced_step_closure_up
 s390_displaced_step_copy_insn (struct gdbarch *gdbarch,
                               CORE_ADDR from, CORE_ADDR to,
                               struct regcache *regs)
@@ -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_closure_up (closure.release ());
 }
 
 /* Fix up the state of registers and memory after having single-stepped
@@ -1637,11 +1638,26 @@ 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
-        && TYPE_NFIELDS (type) == 1)
+  while (TYPE_CODE (type) == TYPE_CODE_STRUCT)
     {
-      struct type *inner = check_typedef (TYPE_FIELD_TYPE (type, 0));
+      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++)
+       {
+         struct field f = TYPE_FIELD (type, i);
+
+         if (field_is_static (&f))
+           continue;
+         if (inner != NULL)
+           return type;
+         inner = FIELD_TYPE (f);
+       }
+
+      if (inner == NULL)
+       break;
+      inner = check_typedef (inner);
       if (TYPE_LENGTH (inner) < min_size)
        break;
       type = inner;
@@ -2101,7 +2117,7 @@ s390_return_value (struct gdbarch *gdbarch, struct value *function,
 
 /* Frame unwinding.  */
 
-/* Implmement the stack_frame_destroyed_p gdbarch method.  */
+/* Implement the stack_frame_destroyed_p gdbarch method.  */
 
 static int
 s390_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc)
@@ -5296,7 +5312,7 @@ ex:
        case 0xe383: /* MSGC - multiply single 64x64mem -> 64 */
        case 0xe398: /* ALC - add logical with carry */
        case 0xe399: /* SLB - subtract logical with borrow */
-       case 0xe727: /* LCBB - load count to block bounduary */
+       case 0xe727: /* LCBB - load count to block boundary */
        case 0xeb81: /* ICMY - insert characters under mask */
        case 0xebdc: /* SRAK - shift left single */
        case 0xebdd: /* SLAK - shift left single */
@@ -5522,7 +5538,7 @@ ex:
        case 0xe704: /* VLLEZ - vector load logical element and zero */
        case 0xe705: /* VLREP - vector load and replicate */
        case 0xe706: /* VL - vector load */
-       case 0xe707: /* VLBB - vector load to block bounduary */
+       case 0xe707: /* VLBB - vector load to block boundary */
        case 0xe712: /* VGEG - vector gather element */
        case 0xe713: /* VGEF - vector gather element */
        case 0xe722: /* VLVG - vector load vr element from gr */
@@ -6223,7 +6239,7 @@ ex:
            return -1;
          break;
 
-       /* 0xed42-0xed47 undefind */
+       /* 0xed42-0xed47 undefined */
 
        case 0xed48: /* SLXT - shift significand left */
        case 0xed49: /* SRXT - shift significand right */
@@ -6238,10 +6254,10 @@ ex:
            return -1;
          break;
 
-       /* 0xed4a-0xed4f undefind */
-       /* 0xed52-0xed53 undefind */
-       /* 0xed56-0xed57 undefind */
-       /* 0xed5a-0xed63 undefind */
+       /* 0xed4a-0xed4f undefined */
+       /* 0xed52-0xed53 undefined */
+       /* 0xed56-0xed57 undefined */
+       /* 0xed5a-0xed63 undefined */
        /* 0xed68-0xeda7 undefined */
 
        case 0xeda8: /* CZDT - convert to zoned */
@@ -6764,10 +6780,10 @@ UNKNOWN_OP:
 /* Implement gdbarch_gcc_target_options.  GCC does not know "-m32" or
    "-mcmodel=large".  */
 
-static char *
+static std::string
 s390_gcc_target_options (struct gdbarch *gdbarch)
 {
-  return xstrdup (gdbarch_ptr_bit (gdbarch) == 64 ? "-m64" : "-m31");
+  return gdbarch_ptr_bit (gdbarch) == 64 ? "-m64" : "-m31";
 }
 
 /* Implement gdbarch_gnu_triplet_regexp.  Target triplets are "s390-*"
@@ -7200,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.026011 seconds and 4 git commands to generate.