/* Intel 386 target-dependent stuff.
- Copyright (C) 1988-2022 Free Software Foundation, Inc.
+ Copyright (C) 1988-2023 Free Software Foundation, Inc.
This file is part of GDB.
static int
i386_mmx_regnum_p (struct gdbarch *gdbarch, int regnum)
{
- i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+ i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
int mm0_regnum = tdep->mm0_regnum;
if (mm0_regnum < 0)
int
i386_byte_regnum_p (struct gdbarch *gdbarch, int regnum)
{
- i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+ i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
regnum -= tdep->al_regnum;
return regnum >= 0 && regnum < tdep->num_byte_regs;
int
i386_word_regnum_p (struct gdbarch *gdbarch, int regnum)
{
- i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+ i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
regnum -= tdep->ax_regnum;
return regnum >= 0 && regnum < tdep->num_word_regs;
int
i386_dword_regnum_p (struct gdbarch *gdbarch, int regnum)
{
- i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+ i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
int eax_regnum = tdep->eax_regnum;
if (eax_regnum < 0)
int
i386_zmmh_regnum_p (struct gdbarch *gdbarch, int regnum)
{
- i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+ i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
int zmm0h_regnum = tdep->zmm0h_regnum;
if (zmm0h_regnum < 0)
int
i386_zmm_regnum_p (struct gdbarch *gdbarch, int regnum)
{
- i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+ i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
int zmm0_regnum = tdep->zmm0_regnum;
if (zmm0_regnum < 0)
int
i386_k_regnum_p (struct gdbarch *gdbarch, int regnum)
{
- i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+ i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
int k0_regnum = tdep->k0_regnum;
if (k0_regnum < 0)
static int
i386_ymmh_regnum_p (struct gdbarch *gdbarch, int regnum)
{
- i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+ i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
int ymm0h_regnum = tdep->ymm0h_regnum;
if (ymm0h_regnum < 0)
int
i386_ymm_regnum_p (struct gdbarch *gdbarch, int regnum)
{
- i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+ i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
int ymm0_regnum = tdep->ymm0_regnum;
if (ymm0_regnum < 0)
static int
i386_ymmh_avx512_regnum_p (struct gdbarch *gdbarch, int regnum)
{
- i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+ i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
int ymm16h_regnum = tdep->ymm16h_regnum;
if (ymm16h_regnum < 0)
int
i386_ymm_avx512_regnum_p (struct gdbarch *gdbarch, int regnum)
{
- i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+ i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
int ymm16_regnum = tdep->ymm16_regnum;
if (ymm16_regnum < 0)
int
i386_bnd_regnum_p (struct gdbarch *gdbarch, int regnum)
{
- i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+ i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
int bnd0_regnum = tdep->bnd0_regnum;
if (bnd0_regnum < 0)
int
i386_xmm_regnum_p (struct gdbarch *gdbarch, int regnum)
{
- i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+ i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
int num_xmm_regs = I387_NUM_XMM_REGS (tdep);
if (num_xmm_regs == 0)
int
i386_xmm_avx512_regnum_p (struct gdbarch *gdbarch, int regnum)
{
- i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+ i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
int num_xmm_avx512_regs = I387_NUM_XMM_AVX512_REGS (tdep);
if (num_xmm_avx512_regs == 0)
static int
i386_mxcsr_regnum_p (struct gdbarch *gdbarch, int regnum)
{
- i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+ i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
if (I387_NUM_XMM_REGS (tdep) == 0)
return 0;
int
i386_fp_regnum_p (struct gdbarch *gdbarch, int regnum)
{
- i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+ i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
if (I387_ST0_REGNUM (tdep) < 0)
return 0;
int
i386_fpc_regnum_p (struct gdbarch *gdbarch, int regnum)
{
- i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+ i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
if (I387_ST0_REGNUM (tdep) < 0)
return 0;
static int
i386_bndr_regnum_p (struct gdbarch *gdbarch, int regnum)
{
- i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+ i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
if (I387_BND0R_REGNUM (tdep) < 0)
return 0;
static int
i386_mpx_ctrl_regnum_p (struct gdbarch *gdbarch, int regnum)
{
- i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+ i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
if (I387_BNDCFGU_REGNUM (tdep) < 0)
return 0;
bool
i386_pkru_regnum_p (struct gdbarch *gdbarch, int regnum)
{
- i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+ i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
int pkru_regnum = tdep->pkru_regnum;
if (pkru_regnum < 0)
const char *
i386_pseudo_register_name (struct gdbarch *gdbarch, int regnum)
{
- i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+ i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
if (i386_bnd_regnum_p (gdbarch, regnum))
return i386_bnd_names[regnum - tdep->bnd0_regnum];
if (i386_mmx_regnum_p (gdbarch, regnum))
else if (i386_word_regnum_p (gdbarch, regnum))
return i386_word_names[regnum - tdep->ax_regnum];
- internal_error (__FILE__, __LINE__, _("invalid regnum"));
+ internal_error (_("invalid regnum"));
}
/* Convert a dbx register number REG to the appropriate register
static int
i386_dbx_reg_to_regnum (struct gdbarch *gdbarch, int reg)
{
- i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+ i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
/* This implements what GCC calls the "default" register map
(dbx_register_map[]). */
static int
i386_svr4_dwarf_reg_to_regnum (struct gdbarch *gdbarch, int reg)
{
- i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+ i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
/* This implements the GCC register map that tries to be compatible
with the SVR4 C compiler for DWARF (svr4_dbx_register_map[]). */
/* This function is 64-bit safe. */
static CORE_ADDR
-i386_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
+i386_unwind_pc (struct gdbarch *gdbarch, frame_info_ptr next_frame)
{
gdb_byte buf[8];
/* Normal frames. */
static void
-i386_frame_cache_1 (struct frame_info *this_frame,
+i386_frame_cache_1 (frame_info_ptr this_frame,
struct i386_frame_cache *cache)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
}
static struct i386_frame_cache *
-i386_frame_cache (struct frame_info *this_frame, void **this_cache)
+i386_frame_cache (frame_info_ptr this_frame, void **this_cache)
{
struct i386_frame_cache *cache;
}
static void
-i386_frame_this_id (struct frame_info *this_frame, void **this_cache,
+i386_frame_this_id (frame_info_ptr this_frame, void **this_cache,
struct frame_id *this_id)
{
struct i386_frame_cache *cache = i386_frame_cache (this_frame, this_cache);
}
static enum unwind_stop_reason
-i386_frame_unwind_stop_reason (struct frame_info *this_frame,
+i386_frame_unwind_stop_reason (frame_info_ptr this_frame,
void **this_cache)
{
struct i386_frame_cache *cache = i386_frame_cache (this_frame, this_cache);
}
static struct value *
-i386_frame_prev_register (struct frame_info *this_frame, void **this_cache,
+i386_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
int regnum)
{
struct i386_frame_cache *cache = i386_frame_cache (this_frame, this_cache);
static int
i386_epilogue_frame_sniffer (const struct frame_unwind *self,
- struct frame_info *this_frame,
+ frame_info_ptr this_frame,
void **this_prologue_cache)
{
if (frame_relative_level (this_frame) == 0)
}
static struct i386_frame_cache *
-i386_epilogue_frame_cache (struct frame_info *this_frame, void **this_cache)
+i386_epilogue_frame_cache (frame_info_ptr this_frame, void **this_cache)
{
struct i386_frame_cache *cache;
CORE_ADDR sp;
}
static enum unwind_stop_reason
-i386_epilogue_frame_unwind_stop_reason (struct frame_info *this_frame,
+i386_epilogue_frame_unwind_stop_reason (frame_info_ptr this_frame,
void **this_cache)
{
struct i386_frame_cache *cache =
}
static void
-i386_epilogue_frame_this_id (struct frame_info *this_frame,
+i386_epilogue_frame_this_id (frame_info_ptr this_frame,
void **this_cache,
struct frame_id *this_id)
{
}
static struct value *
-i386_epilogue_frame_prev_register (struct frame_info *this_frame,
+i386_epilogue_frame_prev_register (frame_info_ptr this_frame,
void **this_cache, int regnum)
{
/* Make sure we've initialized the cache. */
static int
i386_stack_tramp_frame_sniffer (const struct frame_unwind *self,
- struct frame_info *this_frame,
+ frame_info_ptr this_frame,
void **this_cache)
{
if (frame_relative_level (this_frame) == 0)
/* Signal trampolines. */
static struct i386_frame_cache *
-i386_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache)
+i386_sigtramp_frame_cache (frame_info_ptr this_frame, void **this_cache)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
- i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+ i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct i386_frame_cache *cache;
CORE_ADDR addr;
}
static enum unwind_stop_reason
-i386_sigtramp_frame_unwind_stop_reason (struct frame_info *this_frame,
+i386_sigtramp_frame_unwind_stop_reason (frame_info_ptr this_frame,
void **this_cache)
{
struct i386_frame_cache *cache =
}
static void
-i386_sigtramp_frame_this_id (struct frame_info *this_frame, void **this_cache,
+i386_sigtramp_frame_this_id (frame_info_ptr this_frame, void **this_cache,
struct frame_id *this_id)
{
struct i386_frame_cache *cache =
}
static struct value *
-i386_sigtramp_frame_prev_register (struct frame_info *this_frame,
+i386_sigtramp_frame_prev_register (frame_info_ptr this_frame,
void **this_cache, int regnum)
{
/* Make sure we've initialized the cache. */
static int
i386_sigtramp_frame_sniffer (const struct frame_unwind *self,
- struct frame_info *this_frame,
+ frame_info_ptr this_frame,
void **this_prologue_cache)
{
gdbarch *arch = get_frame_arch (this_frame);
- i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (arch);
+ i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (arch);
/* We shouldn't even bother if we don't have a sigcontext_addr
handler. */
\f
static CORE_ADDR
-i386_frame_base_address (struct frame_info *this_frame, void **this_cache)
+i386_frame_base_address (frame_info_ptr this_frame, void **this_cache)
{
struct i386_frame_cache *cache = i386_frame_cache (this_frame, this_cache);
};
static struct frame_id
-i386_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
+i386_dummy_id (struct gdbarch *gdbarch, frame_info_ptr this_frame)
{
CORE_ADDR fp;
success. */
static int
-i386_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc)
+i386_get_longjmp_target (frame_info_ptr frame, CORE_ADDR *pc)
{
gdb_byte buf[4];
CORE_ADDR sp, jb_addr;
struct gdbarch *gdbarch = get_frame_arch (frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
- i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+ i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
int jb_pc_offset = tdep->jb_pc_offset;
/* If JB_PC_OFFSET is -1, we have no way to find out where the
type = check_typedef (type);
if ((type->code () == TYPE_CODE_DECFLOAT
|| (type->code () == TYPE_CODE_ARRAY && type->is_vector ()))
- && TYPE_LENGTH (type) == 16)
+ && type->length () == 16)
return 1;
if (type->code () == TYPE_CODE_ARRAY)
- return i386_16_byte_align_p (TYPE_TARGET_TYPE (type));
+ return i386_16_byte_align_p (type->target_type ());
if (type->code () == TYPE_CODE_STRUCT
|| type->code () == TYPE_CODE_UNION)
{
for (i = thiscall ? 1 : 0; i < nargs; i++)
{
- int len = TYPE_LENGTH (value_enclosing_type (args[i]));
+ int len = value_enclosing_type (args[i])->length ();
if (write_pass)
{
if (objf != nullptr)
{
/* Get corresponding .got.plt or .got section. */
- asect = bfd_get_section_by_name (objf->obfd, ".got.plt");
+ asect = bfd_get_section_by_name (objf->obfd.get (), ".got.plt");
if (asect == nullptr)
- asect = bfd_get_section_by_name (objf->obfd, ".got");
+ asect = bfd_get_section_by_name (objf->obfd.get (), ".got");
}
if (asect != nullptr)
/* Translate asection to obj_section. */
- osect = maint_obj_section_from_bfd_section (objf->obfd, asect, objf);
+ osect = maint_obj_section_from_bfd_section (objf->obfd.get (),
+ asect, objf);
if (osect != nullptr)
{
i386_extract_return_value (struct gdbarch *gdbarch, struct type *type,
struct regcache *regcache, gdb_byte *valbuf)
{
- i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
- int len = TYPE_LENGTH (type);
+ i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
+ int len = type->length ();
gdb_byte buf[I386_MAX_REGISTER_SIZE];
/* _Float16 and _Float16 _Complex values are returned via xmm0. */
memcpy (valbuf + low_size, buf, len - low_size);
}
else
- internal_error (__FILE__, __LINE__,
- _("Cannot extract return value of %d bytes long."),
+ internal_error (_("Cannot extract return value of %d bytes long."),
len);
}
}
i386_store_return_value (struct gdbarch *gdbarch, struct type *type,
struct regcache *regcache, const gdb_byte *valbuf)
{
- i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
- int len = TYPE_LENGTH (type);
+ i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
+ int len = type->length ();
if (type->code () == TYPE_CODE_FLT)
{
valbuf + low_size);
}
else
- internal_error (__FILE__, __LINE__,
- _("Cannot store return value of %d bytes long."), len);
+ internal_error (_("Cannot store return value of %d bytes long."), len);
}
}
\f
static int
i386_reg_struct_return_p (struct gdbarch *gdbarch, struct type *type)
{
- i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+ i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
enum type_code code = type->code ();
- int len = TYPE_LENGTH (type);
+ int len = type->length ();
gdb_assert (code == TYPE_CODE_STRUCT
|| code == TYPE_CODE_UNION
if (struct_convention == pcc_struct_convention
|| (struct_convention == default_struct_convention
- && tdep->struct_return == pcc_struct_return))
+ && tdep->struct_return == pcc_struct_return)
+ || TYPE_HAS_DYNAMIC_LENGTH (type))
return 0;
/* Structures consisting of a single `float', `double' or 'long
static enum return_value_convention
i386_return_value (struct gdbarch *gdbarch, struct value *function,
struct type *type, struct regcache *regcache,
- gdb_byte *readbuf, const gdb_byte *writebuf)
+ struct value **read_value, const gdb_byte *writebuf)
{
enum type_code code = type->code ();
|| code == TYPE_CODE_ARRAY)
&& !i386_reg_struct_return_p (gdbarch, type))
/* Complex double and long double uses the struct return convention. */
- || (code == TYPE_CODE_COMPLEX && TYPE_LENGTH (type) == 16)
- || (code == TYPE_CODE_COMPLEX && TYPE_LENGTH (type) == 24)
+ || (code == TYPE_CODE_COMPLEX && type->length () == 16)
+ || (code == TYPE_CODE_COMPLEX && type->length () == 24)
/* 128-bit decimal float uses the struct return convention. */
- || (code == TYPE_CODE_DECFLOAT && TYPE_LENGTH (type) == 16))
+ || (code == TYPE_CODE_DECFLOAT && type->length () == 16))
{
/* The System V ABI says that:
a record, so the convention applied to records also applies
to arrays. */
- if (readbuf)
+ if (read_value != nullptr)
{
ULONGEST addr;
regcache_raw_read_unsigned (regcache, I386_EAX_REGNUM, &addr);
- read_memory (addr, readbuf, TYPE_LENGTH (type));
+ *read_value = value_at_non_lval (type, addr);
}
return RETURN_VALUE_ABI_RETURNS_ADDRESS;
here. */
if (code == TYPE_CODE_STRUCT && type->num_fields () == 1)
{
- type = check_typedef (type->field (0).type ());
- return i386_return_value (gdbarch, function, type, regcache,
- readbuf, writebuf);
+ struct type *inner_type = check_typedef (type->field (0).type ());
+ enum return_value_convention result
+ = i386_return_value (gdbarch, function, inner_type, regcache,
+ read_value, writebuf);
+ if (read_value != nullptr)
+ deprecated_set_value_type (*read_value, type);
+ return result;
}
- if (readbuf)
- i386_extract_return_value (gdbarch, type, regcache, readbuf);
+ if (read_value != nullptr)
+ {
+ *read_value = allocate_value (type);
+ i386_extract_return_value (gdbarch, type, regcache,
+ value_contents_raw (*read_value).data ());
+ }
if (writebuf)
i386_store_return_value (gdbarch, type, regcache, writebuf);
struct type *
i387_ext_type (struct gdbarch *gdbarch)
{
- i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+ i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
if (!tdep->i387_ext_type)
{
static struct type *
i386_bnd_type (struct gdbarch *gdbarch)
{
- i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+ i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
if (!tdep->i386_bnd_type)
static struct type *
i386_zmm_type (struct gdbarch *gdbarch)
{
- i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+ i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
if (!tdep->i386_zmm_type)
{
static struct type *
i386_ymm_type (struct gdbarch *gdbarch)
{
- i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+ i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
if (!tdep->i386_ymm_type)
{
static struct type *
i386_mmx_type (struct gdbarch *gdbarch)
{
- i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+ i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
if (!tdep->i386_mmx_type)
{
return bt->builtin_int64;
}
- internal_error (__FILE__, __LINE__, _("invalid regnum"));
+ internal_error (_("invalid regnum"));
}
/* Map a cooked register onto a raw register or memory. For the i386,
i386_mmx_regnum_to_fp_regnum (readable_regcache *regcache, int regnum)
{
gdbarch *arch = regcache->arch ();
- i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (arch);
+ i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (arch);
int mmxreg, fpreg;
ULONGEST fstat;
int tos;
status = regcache->raw_read (fpnum, raw_buf);
if (status != REG_VALID)
mark_value_bytes_unavailable (result_value, 0,
- TYPE_LENGTH (value_type (result_value)));
+ result_value->type ()->length ());
else
memcpy (buf, raw_buf, register_size (gdbarch, regnum));
}
else
{
- i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+ i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
if (i386_bnd_regnum_p (gdbarch, regnum))
{
regnum -= tdep->bnd0_regnum;
{
enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
LONGEST upper, lower;
- int size = TYPE_LENGTH (builtin_type (gdbarch)->builtin_data_ptr);
+ int size = builtin_type (gdbarch)->builtin_data_ptr->length ();
lower = extract_unsigned_integer (raw_buf, 8, byte_order);
upper = extract_unsigned_integer (raw_buf + 8, 8, byte_order);
status = regcache->raw_read (gpnum, raw_buf);
if (status != REG_VALID)
mark_value_bytes_unavailable (result_value, 0,
- TYPE_LENGTH (value_type (result_value)));
+ result_value->type ()->length ());
else
memcpy (buf, raw_buf, 2);
}
status = regcache->raw_read (gpnum % 4, raw_buf);
if (status != REG_VALID)
mark_value_bytes_unavailable (result_value, 0,
- TYPE_LENGTH (value_type (result_value)));
+ result_value->type ()->length ());
else if (gpnum >= 4)
memcpy (buf, raw_buf + 1, 1);
else
memcpy (buf, raw_buf, 1);
}
else
- internal_error (__FILE__, __LINE__, _("invalid regnum"));
+ internal_error (_("invalid regnum"));
}
}
}
else
{
- i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+ i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
if (i386_bnd_regnum_p (gdbarch, regnum))
{
ULONGEST upper, lower;
- int size = TYPE_LENGTH (builtin_type (gdbarch)->builtin_data_ptr);
+ int size = builtin_type (gdbarch)->builtin_data_ptr->length ();
enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
/* New values from input value. */
regcache->raw_write (gpnum % 4, raw_buf);
}
else
- internal_error (__FILE__, __LINE__, _("invalid regnum"));
+ internal_error (_("invalid regnum"));
}
}
i386_ax_pseudo_register_collect (struct gdbarch *gdbarch,
struct agent_expr *ax, int regnum)
{
- i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+ i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
if (i386_mmx_regnum_p (gdbarch, regnum))
{
return 0;
}
else
- internal_error (__FILE__, __LINE__, _("invalid regnum"));
+ internal_error (_("invalid regnum"));
return 1;
}
\f
i386_convert_register_p (struct gdbarch *gdbarch,
int regnum, struct type *type)
{
- int len = TYPE_LENGTH (type);
+ int len = type->length ();
/* Values may be spread across multiple registers. Most debugging
formats aren't expressive enough to specify the locations, so
return its contents in TO. */
static int
-i386_register_to_value (struct frame_info *frame, int regnum,
+i386_register_to_value (frame_info_ptr frame, int regnum,
struct type *type, gdb_byte *to,
int *optimizedp, int *unavailablep)
{
struct gdbarch *gdbarch = get_frame_arch (frame);
- int len = TYPE_LENGTH (type);
+ int len = type->length ();
if (i386_fp_regnum_p (gdbarch, regnum))
return i387_register_to_value (frame, regnum, type, to,
REGNUM in frame FRAME. */
static void
-i386_value_to_register (struct frame_info *frame, int regnum,
+i386_value_to_register (frame_info_ptr frame, int regnum,
struct type *type, const gdb_byte *from)
{
- int len = TYPE_LENGTH (type);
+ int len = type->length ();
if (i386_fp_regnum_p (get_frame_arch (frame), regnum))
{
int regnum, const void *gregs, size_t len)
{
struct gdbarch *gdbarch = regcache->arch ();
- const i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+ const i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
const gdb_byte *regs = (const gdb_byte *) gregs;
int i;
int regnum, void *gregs, size_t len)
{
struct gdbarch *gdbarch = regcache->arch ();
- const i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+ const i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
gdb_byte *regs = (gdb_byte *) gregs;
int i;
int regnum, const void *fpregs, size_t len)
{
struct gdbarch *gdbarch = regcache->arch ();
- const i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+ const i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
if (len == I387_SIZEOF_FXSAVE)
{
int regnum, void *fpregs, size_t len)
{
struct gdbarch *gdbarch = regcache->arch ();
- const i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+ const i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
if (len == I387_SIZEOF_FXSAVE)
{
void *cb_data,
const struct regcache *regcache)
{
- i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+ i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
cb (".reg", tdep->sizeof_gregset, tdep->sizeof_gregset, &i386_gregset, NULL,
cb_data);
/* Stuff for WIN32 PE style DLL's but is pretty generic really. */
CORE_ADDR
-i386_pe_skip_trampoline_code (struct frame_info *frame,
+i386_pe_skip_trampoline_code (frame_info_ptr frame,
CORE_ADDR pc, char *name)
{
struct gdbarch *gdbarch = get_frame_arch (frame);
routine. */
int
-i386_sigtramp_p (struct frame_info *this_frame)
+i386_sigtramp_p (frame_info_ptr this_frame)
{
CORE_ADDR pc = get_frame_pc (this_frame);
const char *name;
routine. */
static int
-i386_svr4_sigtramp_p (struct frame_info *this_frame)
+i386_svr4_sigtramp_p (frame_info_ptr this_frame)
{
CORE_ADDR pc = get_frame_pc (this_frame);
const char *name;
address of the associated sigcontext (ucontext) structure. */
static CORE_ADDR
-i386_svr4_sigcontext_addr (struct frame_info *this_frame)
+i386_svr4_sigcontext_addr (frame_info_ptr this_frame)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
specified by the "[-]N@" prefix, and it is one of the registers that
we know has an extended variant available, then use the extended
version of the register instead. */
- if (register_size (gdbarch, regnum) < TYPE_LENGTH (p->arg_type)
+ if (register_size (gdbarch, regnum) < p->arg_type->length ()
&& reg_assoc.find (regname) != reg_assoc.end ())
return "e" + regname;
void
i386_svr4_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
- i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+ i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
/* System V Release 4 uses ELF. */
i386_elf_init_abi (info, gdbarch);
i386_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
const struct reggroup *group)
{
- const i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+ const i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
int fp_regnum_p, mmx_regnum_p, xmm_regnum_p, mxcsr_regnum_p,
ymm_regnum_p, ymmh_regnum_p, ymm_avx512_regnum_p, ymmh_avx512_regnum_p,
bndr_regnum_p, bnd_regnum_p, zmm_regnum_p, zmmh_regnum_p,
/* Get the ARGIth function argument for the current function. */
static CORE_ADDR
-i386_fetch_pointer_argument (struct frame_info *frame, int argi,
+i386_fetch_pointer_argument (frame_info_ptr frame, int argi,
struct type *type)
{
struct gdbarch *gdbarch = get_frame_arch (frame);
struct i386_record_s *ir,
uint32_t iregnum)
{
- i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+ i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
int i;
/* Oza: Because of floating point insn push/pop of fpu stack is going to
ULONGEST addr;
gdb_byte buf[I386_MAX_REGISTER_SIZE];
struct i386_record_s ir;
- i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+ i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
uint8_t rex_w = -1;
uint8_t rex_r = 0;
{
if ((type->code () == TYPE_CODE_INT
|| type->code () == TYPE_CODE_FLT)
- && TYPE_LENGTH (type) > 4)
+ && type->length () > 4)
return 4;
/* Handle x86's funny long double. */
if (type->code () == TYPE_CODE_FLT
- && gdbarch_long_double_bit (gdbarch) == TYPE_LENGTH (type) * 8)
+ && gdbarch_long_double_bit (gdbarch) == type->length () * 8)
return 4;
}
static struct gdbarch *
i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
- struct gdbarch *gdbarch;
const struct target_desc *tdesc;
int mm0_regnum;
int ymm0_regnum;
return arches->gdbarch;
/* Allocate space for the new architecture. Assume i386 for now. */
- i386_gdbarch_tdep *tdep = new i386_gdbarch_tdep;
- gdbarch = gdbarch_alloc (&info, tdep);
+ gdbarch *gdbarch
+ = gdbarch_alloc (&info, gdbarch_tdep_up (new i386_gdbarch_tdep));
+ i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
/* General-purpose registers. */
tdep->gregset_reg_offset = NULL;
set_gdbarch_register_to_value (gdbarch, i386_register_to_value);
set_gdbarch_value_to_register (gdbarch, i386_value_to_register);
- set_gdbarch_return_value (gdbarch, i386_return_value);
+ set_gdbarch_return_value_as_value (gdbarch, i386_return_value);
set_gdbarch_skip_prologue (gdbarch, i386_skip_prologue);
appended to the list first, so that it supercedes the DWARF
unwinder in function epilogues (where the DWARF unwinder
currently fails). */
- frame_unwind_append_unwinder (gdbarch, &i386_epilogue_frame_unwind);
+ if (info.bfd_arch_info->bits_per_word == 32)
+ frame_unwind_append_unwinder (gdbarch, &i386_epilogue_frame_unwind);
/* Hook in the DWARF CFI frame unwinder. This unwinder is appended
to the list before the prologue-based unwinders, so that DWARF
if (!i386_validate_tdesc_p (tdep, tdesc_data.get ()))
{
- delete tdep;
gdbarch_free (gdbarch);
return NULL;
}
tdep-> bnd0_regnum = -1;
/* Hook in the legacy prologue-based unwinders last (fallback). */
- frame_unwind_append_unwinder (gdbarch, &i386_stack_tramp_frame_unwind);
- frame_unwind_append_unwinder (gdbarch, &i386_sigtramp_frame_unwind);
- frame_unwind_append_unwinder (gdbarch, &i386_frame_unwind);
+ if (info.bfd_arch_info->bits_per_word == 32)
+ {
+ frame_unwind_append_unwinder (gdbarch, &i386_stack_tramp_frame_unwind);
+ frame_unwind_append_unwinder (gdbarch, &i386_sigtramp_frame_unwind);
+ frame_unwind_append_unwinder (gdbarch, &i386_frame_unwind);
+ }
/* If we have a register mapping, enable the generic core file
support, unless it has already been enabled. */
rcache = get_current_regcache ();
gdbarch *arch = rcache->arch ();
- i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (arch);
+ i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (arch);
regstatus = regcache_raw_read_unsigned (rcache, tdep->bndcfgu_regnum, &ret);
i386_mpx_enabled (void)
{
gdbarch *arch = get_current_arch ();
- i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (arch);
+ i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (arch);
const struct target_desc *tdesc = tdep->tdesc;
return (tdesc_find_feature (tdesc, "org.gnu.gdb.i386.mpx") != NULL);
for (i = 0; i < 4; i++)
bt_entry[i] = read_memory_typed_address (bt_entry_addr
- + i * TYPE_LENGTH (data_ptr_type),
+ + i * data_ptr_type->length (),
data_ptr_type);
i386_mpx_print_bounds (bt_entry);
bt_entry_addr = i386_mpx_get_bt_entry (addr, bd_base);
for (i = 0; i < 2; i++)
bt_entry[i] = read_memory_typed_address (bt_entry_addr
- + i * TYPE_LENGTH (data_ptr_type),
+ + i * data_ptr_type->length (),
data_ptr_type);
bt_entry[0] = (uint64_t) lower;
bt_entry[1] = ~(uint64_t) upper;
for (i = 0; i < 2; i++)
write_memory_unsigned_integer (bt_entry_addr
- + i * TYPE_LENGTH (data_ptr_type),
- TYPE_LENGTH (data_ptr_type), byte_order,
+ + i * data_ptr_type->length (),
+ data_ptr_type->length (), byte_order,
bt_entry[i]);
}
void
_initialize_i386_tdep ()
{
- register_gdbarch_init (bfd_arch_i386, i386_gdbarch_init);
+ gdbarch_register (bfd_arch_i386, i386_gdbarch_init);
/* Add the variable that controls the disassembly flavor. */
add_setshow_enum_cmd ("disassembly-flavor", no_class, valid_flavors,