/* Target-dependent code for s390.
- Copyright (C) 2001-2018 Free Software Foundation, Inc.
+ Copyright (C) 2001-2019 Free Software Foundation, Inc.
This file is part of GDB.
typedef BP_MANIPULATION (s390_break_insn) s390_breakpoint;
+/* Types. */
+
+/* Implement the gdbarch type alignment method. */
+
+static ULONGEST
+s390_type_align (gdbarch *gdbarch, struct type *t)
+{
+ t = check_typedef (t);
+
+ if (TYPE_LENGTH (t) > 8)
+ {
+ switch (TYPE_CODE (t))
+ {
+ case TYPE_CODE_INT:
+ case TYPE_CODE_RANGE:
+ case TYPE_CODE_FLT:
+ case TYPE_CODE_ENUM:
+ case TYPE_CODE_CHAR:
+ case TYPE_CODE_BOOL:
+ case TYPE_CODE_DECFLOAT:
+ return 8;
+
+ case TYPE_CODE_ARRAY:
+ if (TYPE_VECTOR (t))
+ return 8;
+ break;
+ }
+ }
+ return 0;
+}
+
/* Decoding S/390 instructions. */
/* Read a single instruction from address AT. */
/* Recompute saved return address in R1. */
regcache_cooked_write_unsigned (regs, S390_R0_REGNUM + r1,
amode | (from + insnlen));
+ /* Update PC iff the instruction doesn't actually branch. */
+ if (insn[0] == op_basr && r2 == 0)
+ regcache_write_pc (regs, from + insnlen);
}
/* Handle absolute branch instructions. */
if (pv_is_constant (addr))
{
struct target_section *secp;
- secp = target_section_by_addr (target_stack, addr.k);
+ secp = target_section_by_addr (current_top_target (), addr.k);
if (secp != NULL
&& (bfd_get_section_flags (secp->the_bfd_section->owner,
secp->the_bfd_section)
if (regnum_is_gpr_full (tdep, regnum))
return builtin_type (gdbarch)->builtin_uint64;
+ /* For the "concatenated" vector registers use the same type as v16. */
if (regnum_is_vxr_full (tdep, regnum))
- return tdesc_find_type (gdbarch, "vec128");
+ return tdesc_register_type (gdbarch, S390_V16_REGNUM);
internal_error (__FILE__, __LINE__, _("invalid regnum"));
}
s390_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
struct regcache *regcache, CORE_ADDR bp_addr,
int nargs, struct value **args, CORE_ADDR sp,
- int struct_return, CORE_ADDR struct_addr)
+ function_call_return_method return_method,
+ CORE_ADDR struct_addr)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
int word_size = gdbarch_ptr_bit (gdbarch) / 8;
ftype = check_typedef (TYPE_TARGET_TYPE (ftype));
arg_prep.copy = sp;
- arg_prep.gr = struct_return ? 3 : 2;
+ arg_prep.gr = (return_method == return_method_struct) ? 3 : 2;
arg_prep.fr = 0;
arg_prep.vr = 0;
arg_prep.argp = 0;
error (_("Stack overflow"));
/* Pass the structure return address in general register 2. */
- if (struct_return)
+ if (return_method == return_method_struct)
regcache_cooked_write_unsigned (regcache, S390_R2_REGNUM, struct_addr);
/* Initialize arg_state for "write mode". */
Recognize this case by looking ahead a bit ... */
struct s390_prologue_data data2;
- pv_t *sp = &data2.gpr[S390_SP_REGNUM - S390_R0_REGNUM];
+ pv_t *sp2 = &data2.gpr[S390_SP_REGNUM - S390_R0_REGNUM];
if (!(s390_analyze_prologue (gdbarch, func, (CORE_ADDR)-1, &data2)
- && pv_is_register (*sp, S390_SP_REGNUM)
- && sp->k != 0))
+ && pv_is_register (*sp2, S390_SP_REGNUM)
+ && sp2->k != 0))
return 0;
}
}
info->frame_base = -1;
info->local_base = -1;
- TRY
+ try
{
/* Try to use prologue analysis to fill the unwind cache.
If this fails, fall back to reading the stack backchain. */
if (!s390_prologue_frame_unwind_cache (this_frame, info))
s390_backchain_frame_unwind_cache (this_frame, info);
}
- CATCH (ex, RETURN_MASK_ERROR)
+ catch (const gdb_exception_error &ex)
{
if (ex.error != NOT_AVAILABLE_ERROR)
- throw_exception (ex);
+ throw;
}
- END_CATCH
return info;
}
set_gdbarch_long_double_bit (gdbarch, 128);
set_gdbarch_long_double_format (gdbarch, floatformats_ia64_quad);
+ set_gdbarch_type_align (gdbarch, s390_type_align);
+
/* Breakpoints. */
/* Amount PC must be decremented by after a breakpoint. This is
often the number of bytes returned by gdbarch_breakpoint_from_pc but not