/* Target-dependent code for s390.
- Copyright (C) 2001-2022 Free Software Foundation, Inc.
+ Copyright (C) 2001-2023 Free Software Foundation, Inc.
This file is part of GDB.
{
t = check_typedef (t);
- if (TYPE_LENGTH (t) > 8)
+ if (t->length () > 8)
{
switch (t->code ())
{
regcache_write_pc (regs, from + insnlen);
/* Recompute output address in R1. */
regcache_cooked_write_unsigned (regs, S390_R0_REGNUM + r1,
- amode | (from + i2 * 2));
+ from + i2 * 2);
}
/* If we executed a breakpoint instruction, point PC right back at it. */
check_typedef (type);
if ((regnum >= S390_F0_REGNUM && regnum <= S390_F15_REGNUM
- && TYPE_LENGTH (type) < 8)
+ && type->length () < 8)
|| regnum_is_vxr_full (tdep, regnum)
|| (regnum >= S390_V16_REGNUM && regnum <= S390_V31_REGNUM))
set_value_offset (value, 0);
return full_name[regnum - tdep->v0_full_regnum];
}
- internal_error (__FILE__, __LINE__, _("invalid regnum"));
+ internal_error (_("invalid regnum"));
}
/* Implement pseudo_register_type tdesc method. */
if (regnum_is_vxr_full (tdep, regnum))
return tdesc_register_type (gdbarch, S390_V16_REGNUM);
- internal_error (__FILE__, __LINE__, _("invalid regnum"));
+ internal_error (_("invalid regnum"));
}
/* Implement pseudo_register_read gdbarch method. */
return status;
}
- internal_error (__FILE__, __LINE__, _("invalid regnum"));
+ internal_error (_("invalid regnum"));
}
/* Implement pseudo_register_write gdbarch method. */
return;
}
- internal_error (__FILE__, __LINE__, _("invalid regnum"));
+ internal_error (_("invalid regnum"));
}
/* Register groups. */
}
else
{
- internal_error (__FILE__, __LINE__, _("invalid regnum"));
+ internal_error (_("invalid regnum"));
}
return 0;
}
}
else
{
- internal_error (__FILE__, __LINE__, _("invalid regnum"));
+ internal_error (_("invalid regnum"));
}
return 0;
}
if (inner == NULL)
break;
inner = check_typedef (inner);
- if (TYPE_LENGTH (inner) < min_size)
+ if (inner->length () < min_size)
break;
type = inner;
}
{
/* Note that long double as well as complex types are intentionally
excluded. */
- if (TYPE_LENGTH (type) > 8)
+ if (type->length () > 8)
return 0;
/* A struct containing just a float or double is passed like a float
static int
s390_function_arg_vector (struct type *type)
{
- if (TYPE_LENGTH (type) > 16)
+ if (type->length () > 16)
return 0;
/* Structs containing just a vector are passed like a vector. */
- type = s390_effective_inner_type (type, TYPE_LENGTH (type));
+ type = s390_effective_inner_type (type, type->length ());
return type->code () == TYPE_CODE_ARRAY && type->is_vector ();
}
{
enum type_code code = type->code ();
- if (TYPE_LENGTH (type) > 8)
+ if (type->length () > 8)
return 0;
if (code == TYPE_CODE_INT
return 1;
return ((code == TYPE_CODE_UNION || code == TYPE_CODE_STRUCT)
- && is_power_of_two (TYPE_LENGTH (type)));
+ && is_power_of_two (type->length ()));
}
/* Argument passing state: Internal data structure passed to helper
enum bfd_endian byte_order, int is_unnamed)
{
struct type *type = check_typedef (value_type (arg));
- unsigned int length = TYPE_LENGTH (type);
+ unsigned int length = type->length ();
int write_mode = as->regcache != NULL;
if (s390_function_arg_float (type))
struct type *ftype = check_typedef (value_type (function));
if (ftype->code () == TYPE_CODE_PTR)
- ftype = check_typedef (TYPE_TARGET_TYPE (ftype));
+ ftype = check_typedef (ftype->target_type ());
arg_prep.copy = sp;
arg_prep.gr = (return_method == return_method_struct) ? 3 : 2;
breakpoint. */
static struct frame_id
-s390_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
+s390_dummy_id (struct gdbarch *gdbarch, frame_info_ptr this_frame)
{
int word_size = gdbarch_ptr_bit (gdbarch) / 8;
CORE_ADDR sp = get_frame_register_unsigned (this_frame, S390_SP_REGNUM);
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int word_size = gdbarch_ptr_bit (gdbarch) / 8;
- int length = TYPE_LENGTH (type);
+ int length = type->length ();
int code = type->code ();
if (code == TYPE_CODE_FLT || code == TYPE_CODE_DECFLOAT)
}
}
else
- internal_error (__FILE__, __LINE__, _("invalid return type"));
+ internal_error (_("invalid return type"));
}
/* Implement the 'return_value' gdbarch method. */
{
s390_gdbarch_tdep *tdep = gdbarch_tdep<s390_gdbarch_tdep> (gdbarch);
rvc = (tdep->vector_abi == S390_VECTOR_ABI_128
- && TYPE_LENGTH (type) <= 16 && type->is_vector ())
+ && type->length () <= 16 && type->is_vector ())
? RETURN_VALUE_REGISTER_CONVENTION
: RETURN_VALUE_STRUCT_CONVENTION;
break;
}
default:
- rvc = TYPE_LENGTH (type) <= 8
+ rvc = type->length () <= 8
? RETURN_VALUE_REGISTER_CONVENTION
: RETURN_VALUE_STRUCT_CONVENTION;
}
/* Implement unwind_pc gdbarch method. */
static CORE_ADDR
-s390_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
+s390_unwind_pc (struct gdbarch *gdbarch, frame_info_ptr next_frame)
{
s390_gdbarch_tdep *tdep = gdbarch_tdep<s390_gdbarch_tdep> (gdbarch);
ULONGEST pc;
/* Implement unwind_sp gdbarch method. */
static CORE_ADDR
-s390_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
+s390_unwind_sp (struct gdbarch *gdbarch, frame_info_ptr next_frame)
{
ULONGEST sp;
sp = frame_unwind_register_unsigned (next_frame, S390_SP_REGNUM);
/* Helper routine to unwind pseudo registers. */
static struct value *
-s390_unwind_pseudo_register (struct frame_info *this_frame, int regnum)
+s390_unwind_pseudo_register (frame_info_ptr this_frame, int regnum)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
s390_gdbarch_tdep *tdep = gdbarch_tdep<s390_gdbarch_tdep> (gdbarch);
{
LONGEST pswa = value_as_long (val);
- if (TYPE_LENGTH (type) == 4)
+ if (type->length () == 4)
return value_from_pointer (type, pswa & 0x7fffffff);
else
return value_from_pointer (type, pswa);
{
LONGEST pswm = value_as_long (val);
- if (TYPE_LENGTH (type) == 4)
+ if (type->length () == 4)
return value_from_longest (type, (pswm >> 12) & 3);
else
return value_from_longest (type, (pswm >> 44) & 3);
s390_dwarf2_frame_init_reg. */
static struct value *
-s390_dwarf2_prev_register (struct frame_info *this_frame, void **this_cache,
+s390_dwarf2_prev_register (frame_info_ptr this_frame, void **this_cache,
int regnum)
{
return s390_unwind_pseudo_register (this_frame, regnum);
static void
s390_dwarf2_frame_init_reg (struct gdbarch *gdbarch, int regnum,
struct dwarf2_frame_state_reg *reg,
- struct frame_info *this_frame)
+ frame_info_ptr this_frame)
{
/* The condition code (and thus PSW mask) is call-clobbered. */
if (regnum == S390_PSWM_REGNUM)
register translation. */
struct value *
-s390_trad_frame_prev_register (struct frame_info *this_frame,
+s390_trad_frame_prev_register (frame_info_ptr this_frame,
trad_frame_saved_reg saved_regs[],
int regnum)
{
prologue analysis. Helper for s390_frame_unwind_cache. */
static int
-s390_prologue_frame_unwind_cache (struct frame_info *this_frame,
+s390_prologue_frame_unwind_cache (frame_info_ptr this_frame,
struct s390_unwind_cache *info)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
CORE_ADDR prev_sp;
int frame_pointer;
int size;
- struct frame_info *next_frame;
+ frame_info_ptr next_frame;
/* Try to find the function start address. If we can't find it, we don't
bother searching for it -- with modern compilers this would be mostly
back chain unwinding. Helper for s390_frame_unwind_cache. */
static void
-s390_backchain_frame_unwind_cache (struct frame_info *this_frame,
+s390_backchain_frame_unwind_cache (frame_info_ptr this_frame,
struct s390_unwind_cache *info)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
s390_frame_unwind and s390_frame_base. */
static struct s390_unwind_cache *
-s390_frame_unwind_cache (struct frame_info *this_frame,
+s390_frame_unwind_cache (frame_info_ptr this_frame,
void **this_prologue_cache)
{
struct s390_unwind_cache *info;
/* Implement this_id frame_unwind method for s390_frame_unwind. */
static void
-s390_frame_this_id (struct frame_info *this_frame,
+s390_frame_this_id (frame_info_ptr this_frame,
void **this_prologue_cache,
struct frame_id *this_id)
{
/* Implement prev_register frame_unwind method for s390_frame_unwind. */
static struct value *
-s390_frame_prev_register (struct frame_info *this_frame,
+s390_frame_prev_register (frame_info_ptr this_frame,
void **this_prologue_cache, int regnum)
{
struct s390_unwind_cache *info
s390_stub_frame_unwind. */
static struct s390_stub_unwind_cache *
-s390_stub_frame_unwind_cache (struct frame_info *this_frame,
+s390_stub_frame_unwind_cache (frame_info_ptr this_frame,
void **this_prologue_cache)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
/* Implement this_id frame_unwind method for s390_stub_frame_unwind. */
static void
-s390_stub_frame_this_id (struct frame_info *this_frame,
+s390_stub_frame_this_id (frame_info_ptr this_frame,
void **this_prologue_cache,
struct frame_id *this_id)
{
/* Implement prev_register frame_unwind method for s390_stub_frame_unwind. */
static struct value *
-s390_stub_frame_prev_register (struct frame_info *this_frame,
+s390_stub_frame_prev_register (frame_info_ptr this_frame,
void **this_prologue_cache, int regnum)
{
struct s390_stub_unwind_cache *info
static int
s390_stub_frame_sniffer (const struct frame_unwind *self,
- struct frame_info *this_frame,
+ frame_info_ptr this_frame,
void **this_prologue_cache)
{
CORE_ADDR addr_in_block;
/* Frame base handling. */
static CORE_ADDR
-s390_frame_base_address (struct frame_info *this_frame, void **this_cache)
+s390_frame_base_address (frame_info_ptr this_frame, void **this_cache)
{
struct s390_unwind_cache *info
= s390_frame_unwind_cache (this_frame, this_cache);
}
static CORE_ADDR
-s390_local_base_address (struct frame_info *this_frame, void **this_cache)
+s390_local_base_address (frame_info_ptr this_frame, void **this_cache)
{
struct s390_unwind_cache *info
= s390_frame_unwind_cache (this_frame, this_cache);
return true;
}
-/* Allocate and initialize new gdbarch_tdep. Caller is responsible to free
- memory after use. */
+/* Allocate and initialize new gdbarch_tdep. */
-static s390_gdbarch_tdep *
+static s390_gdbarch_tdep_up
s390_gdbarch_tdep_alloc ()
{
- s390_gdbarch_tdep *tdep = new s390_gdbarch_tdep;
+ s390_gdbarch_tdep_up tdep (new s390_gdbarch_tdep);
tdep->tdesc = NULL;
static const char *const stap_register_indirection_suffixes[] = { ")",
NULL };
- s390_gdbarch_tdep *tdep = s390_gdbarch_tdep_alloc ();
- struct gdbarch *gdbarch = gdbarch_alloc (&info, tdep);
+ gdbarch *gdbarch = gdbarch_alloc (&info, s390_gdbarch_tdep_alloc ());
+ s390_gdbarch_tdep *tdep = gdbarch_tdep<s390_gdbarch_tdep> (gdbarch);
tdesc_arch_data_up tdesc_data = tdesc_data_alloc ();
info.tdesc_data = tdesc_data.get ();
/* Check any target description for validity. */
if (!s390_tdesc_valid (tdep, tdesc_data.get ()))
{
- delete tdep;
gdbarch_free (gdbarch);
return NULL;
}
if (tmp->vector_abi != tdep->vector_abi)
continue;
- delete tdep;
gdbarch_free (gdbarch);
return arches->gdbarch;
}