gdb: fix gdbarch_tdep ODR violation

I would like to be able to use non-trivial types in gdbarch_tdep types.
This is not possible at the moment (in theory), because of the one
definition rule.

To allow it, rename all gdbarch_tdep types to <arch>_gdbarch_tdep, and
make them inherit from a gdbarch_tdep base class.  The inheritance is
necessary to be able to pass pointers to all these <arch>_gdbarch_tdep
objects to gdbarch_alloc, which takes a pointer to gdbarch_tdep.

These objects are never deleted through a base class pointer, so I
didn't include a virtual destructor.  In the future, if gdbarch objects
deletable, I could imagine that the gdbarch_tdep objects could become
owned by the gdbarch objects, and then it would become useful to have a
virtual destructor (so that the gdbarch object can delete the owned
gdbarch_tdep object).  But that's not necessary right now.

It turns out that RISC-V already has a gdbarch_tdep that is
non-default-constructible, so that provides a good motivation for this
change.

Most changes are fairly straightforward, mostly needing to add some
casts all over the place.  There is however the xtensa architecture,
doing its own little weird thing to define its gdbarch_tdep.  I did my
best to adapt it, but I can't test those changes.

Change-Id: Ic001903f91ddd106bd6ca09a79dabe8df2d69f3b
This commit is contained in:
Simon Marchi 2021-11-15 11:29:39 -05:00
parent eae06bb301
commit 345bd07cce
133 changed files with 1508 additions and 1319 deletions

View File

@ -153,7 +153,7 @@ aarch64_fbsd_iterate_over_regset_sections (struct gdbarch *gdbarch,
static void
aarch64_fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
aarch64_gdbarch_tdep *tdep = (aarch64_gdbarch_tdep *) gdbarch_tdep (gdbarch);
/* Generic FreeBSD support. */
fbsd_init_abi (info, gdbarch);

View File

@ -286,7 +286,7 @@ aarch64_linux_sigframe_init (const struct tramp_frame *self,
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
aarch64_gdbarch_tdep *tdep = (aarch64_gdbarch_tdep *) gdbarch_tdep (gdbarch);
CORE_ADDR sp = get_frame_register_unsigned (this_frame, AARCH64_SP_REGNUM);
CORE_ADDR sigcontext_addr = (sp + AARCH64_RT_SIGFRAME_UCONTEXT_OFFSET
+ AARCH64_UCONTEXT_SIGCONTEXT_OFFSET );
@ -640,7 +640,8 @@ aarch64_linux_collect_sve_regset (const struct regset *regset,
gdb_byte *header = (gdb_byte *) buf;
struct gdbarch *gdbarch = regcache->arch ();
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
uint64_t vq = gdbarch_tdep (gdbarch)->vq;
aarch64_gdbarch_tdep *tdep = (aarch64_gdbarch_tdep *) gdbarch_tdep (gdbarch);
uint64_t vq = tdep->vq;
gdb_assert (buf != NULL);
gdb_assert (size > SVE_HEADER_SIZE);
@ -675,7 +676,7 @@ aarch64_linux_iterate_over_regset_sections (struct gdbarch *gdbarch,
void *cb_data,
const struct regcache *regcache)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
aarch64_gdbarch_tdep *tdep = (aarch64_gdbarch_tdep *) gdbarch_tdep (gdbarch);
cb (".reg", AARCH64_LINUX_SIZEOF_GREGSET, AARCH64_LINUX_SIZEOF_GREGSET,
&aarch64_linux_gregset, NULL, cb_data);
@ -1719,7 +1720,7 @@ aarch64_linux_report_signal_info (struct gdbarch *gdbarch,
struct ui_out *uiout,
enum gdb_signal siggnal)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
aarch64_gdbarch_tdep *tdep = (aarch64_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (!tdep->has_mte () || siggnal != GDB_SIGNAL_SEGV)
return;
@ -1788,7 +1789,7 @@ aarch64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
NULL };
static const char *const stap_register_indirection_suffixes[] = { "]",
NULL };
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
aarch64_gdbarch_tdep *tdep = (aarch64_gdbarch_tdep *) gdbarch_tdep (gdbarch);
tdep->lowest_pc = 0x8000;

View File

@ -29,7 +29,7 @@
static void
aarch64_newlib_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
aarch64_gdbarch_tdep *tdep = (aarch64_gdbarch_tdep *) gdbarch_tdep (gdbarch);
/* Jump buffer - support for longjmp.
Offset of original PC in jump buffer (in registers). */

View File

@ -248,7 +248,7 @@ class instruction_reader : public abstract_instruction_reader
THIS_FRAME. */
static CORE_ADDR
aarch64_frame_unmask_lr (struct gdbarch_tdep *tdep,
aarch64_frame_unmask_lr (aarch64_gdbarch_tdep *tdep,
struct frame_info *this_frame, CORE_ADDR addr)
{
if (tdep->has_pauth ()
@ -500,7 +500,8 @@ aarch64_analyze_prologue (struct gdbarch *gdbarch,
}
else if (inst.opcode->iclass == ic_system)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
aarch64_gdbarch_tdep *tdep
= (aarch64_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int ra_state_val = 0;
if (insn == 0xd503233f /* paciasp. */
@ -635,7 +636,7 @@ aarch64_analyze_prologue_test (void)
struct aarch64_prologue_cache cache;
cache.saved_regs = trad_frame_alloc_saved_regs (gdbarch);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
aarch64_gdbarch_tdep *tdep = (aarch64_gdbarch_tdep *) gdbarch_tdep (gdbarch);
/* Test the simple prologue in which frame pointer is used. */
{
@ -1037,7 +1038,9 @@ aarch64_prologue_frame_unwind_stop_reason (struct frame_info *this_frame,
return UNWIND_UNAVAILABLE;
/* Halt the backtrace at "_start". */
if (cache->prev_pc <= gdbarch_tdep (get_frame_arch (this_frame))->lowest_pc)
gdbarch *arch = get_frame_arch (this_frame);
aarch64_gdbarch_tdep *tdep = (aarch64_gdbarch_tdep *) gdbarch_tdep (arch);
if (cache->prev_pc <= tdep->lowest_pc)
return UNWIND_OUTERMOST;
/* We've hit a wall, stop. */
@ -1079,7 +1082,8 @@ aarch64_prologue_prev_register (struct frame_info *this_frame,
{
CORE_ADDR lr;
struct gdbarch *gdbarch = get_frame_arch (this_frame);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
aarch64_gdbarch_tdep *tdep
= (aarch64_gdbarch_tdep *) gdbarch_tdep (gdbarch);
lr = frame_unwind_register_unsigned (this_frame, AARCH64_LR_REGNUM);
@ -1247,7 +1251,8 @@ static struct value *
aarch64_dwarf2_prev_register (struct frame_info *this_frame,
void **this_cache, int regnum)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (this_frame));
gdbarch *arch = get_frame_arch (this_frame);
aarch64_gdbarch_tdep *tdep = (aarch64_gdbarch_tdep *) gdbarch_tdep (arch);
CORE_ADDR lr;
switch (regnum)
@ -1273,7 +1278,7 @@ aarch64_dwarf2_frame_init_reg (struct gdbarch *gdbarch, int regnum,
struct dwarf2_frame_state_reg *reg,
struct frame_info *this_frame)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
aarch64_gdbarch_tdep *tdep = (aarch64_gdbarch_tdep *) gdbarch_tdep (gdbarch);
switch (regnum)
{
@ -1313,7 +1318,7 @@ static bool
aarch64_execute_dwarf_cfa_vendor_op (struct gdbarch *gdbarch, gdb_byte op,
struct dwarf2_frame_state *fs)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
aarch64_gdbarch_tdep *tdep = (aarch64_gdbarch_tdep *) gdbarch_tdep (gdbarch);
struct dwarf2_frame_state_reg *ra_state;
if (op == DW_CFA_AARCH64_negate_ra_state)
@ -1952,7 +1957,7 @@ aarch64_frame_align (struct gdbarch *gdbarch, CORE_ADDR sp)
static struct type *
aarch64_vnq_type (struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
aarch64_gdbarch_tdep *tdep = (aarch64_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (tdep->vnq_type == NULL)
{
@ -1979,7 +1984,7 @@ aarch64_vnq_type (struct gdbarch *gdbarch)
static struct type *
aarch64_vnd_type (struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
aarch64_gdbarch_tdep *tdep = (aarch64_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (tdep->vnd_type == NULL)
{
@ -2009,7 +2014,7 @@ aarch64_vnd_type (struct gdbarch *gdbarch)
static struct type *
aarch64_vns_type (struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
aarch64_gdbarch_tdep *tdep = (aarch64_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (tdep->vns_type == NULL)
{
@ -2039,7 +2044,7 @@ aarch64_vns_type (struct gdbarch *gdbarch)
static struct type *
aarch64_vnh_type (struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
aarch64_gdbarch_tdep *tdep = (aarch64_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (tdep->vnh_type == NULL)
{
@ -2072,7 +2077,7 @@ aarch64_vnh_type (struct gdbarch *gdbarch)
static struct type *
aarch64_vnb_type (struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
aarch64_gdbarch_tdep *tdep = (aarch64_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (tdep->vnb_type == NULL)
{
@ -2099,7 +2104,7 @@ aarch64_vnb_type (struct gdbarch *gdbarch)
static struct type *
aarch64_vnv_type (struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
aarch64_gdbarch_tdep *tdep = (aarch64_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (tdep->vnv_type == NULL)
{
@ -2170,7 +2175,7 @@ aarch64_vnv_type (struct gdbarch *gdbarch)
static int
aarch64_dwarf_reg_to_regnum (struct gdbarch *gdbarch, int reg)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
aarch64_gdbarch_tdep *tdep = (aarch64_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (reg >= AARCH64_DWARF_X0 && reg <= AARCH64_DWARF_X0 + 30)
return AARCH64_X0_REGNUM + reg - AARCH64_DWARF_X0;
@ -2457,7 +2462,7 @@ aarch64_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc)
CORE_ADDR jb_addr;
gdb_byte buf[X_REGISTER_SIZE];
struct gdbarch *gdbarch = get_frame_arch (frame);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
aarch64_gdbarch_tdep *tdep = (aarch64_gdbarch_tdep *) gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
jb_addr = get_frame_register_unsigned (frame, AARCH64_X0_REGNUM);
@ -2488,7 +2493,7 @@ aarch64_gen_return_address (struct gdbarch *gdbarch,
static const char *
aarch64_pseudo_register_name (struct gdbarch *gdbarch, int regnum)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
aarch64_gdbarch_tdep *tdep = (aarch64_gdbarch_tdep *) gdbarch_tdep (gdbarch);
static const char *const q_name[] =
{
@ -2602,7 +2607,7 @@ aarch64_pseudo_register_name (struct gdbarch *gdbarch, int regnum)
static struct type *
aarch64_pseudo_register_type (struct gdbarch *gdbarch, int regnum)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
aarch64_gdbarch_tdep *tdep = (aarch64_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int p_regnum = regnum - gdbarch_num_regs (gdbarch);
@ -2639,7 +2644,7 @@ static int
aarch64_pseudo_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
struct reggroup *group)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
aarch64_gdbarch_tdep *tdep = (aarch64_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int p_regnum = regnum - gdbarch_num_regs (gdbarch);
@ -2693,7 +2698,7 @@ static struct value *
aarch64_pseudo_read_value (struct gdbarch *gdbarch, readable_regcache *regcache,
int regnum)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
aarch64_gdbarch_tdep *tdep = (aarch64_gdbarch_tdep *) gdbarch_tdep (gdbarch);
struct value *result_value = allocate_value (register_type (gdbarch, regnum));
VALUE_LVAL (result_value) = lval_register;
@ -2763,7 +2768,7 @@ static void
aarch64_pseudo_write (struct gdbarch *gdbarch, struct regcache *regcache,
int regnum, const gdb_byte *buf)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
aarch64_gdbarch_tdep *tdep = (aarch64_gdbarch_tdep *) gdbarch_tdep (gdbarch);
regnum -= gdbarch_num_regs (gdbarch);
if (regnum >= AARCH64_Q0_REGNUM && regnum < AARCH64_Q0_REGNUM + 32)
@ -3328,7 +3333,7 @@ aarch64_add_reggroups (struct gdbarch *gdbarch)
static int
aarch64_cannot_store_register (struct gdbarch *gdbarch, int regnum)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
aarch64_gdbarch_tdep *tdep = (aarch64_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (!tdep->has_pauth ())
return 0;
@ -3375,7 +3380,8 @@ aarch64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
best_arch != nullptr;
best_arch = gdbarch_list_lookup_by_info (best_arch->next, &info))
{
struct gdbarch_tdep *tdep = gdbarch_tdep (best_arch->gdbarch);
aarch64_gdbarch_tdep *tdep
= (aarch64_gdbarch_tdep *) gdbarch_tdep (best_arch->gdbarch);
if (tdep && tdep->vq == vq)
return best_arch->gdbarch;
}
@ -3483,7 +3489,7 @@ aarch64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* AArch64 code is always little-endian. */
info.byte_order_for_code = BFD_ENDIAN_LITTLE;
struct gdbarch_tdep *tdep = XCNEW (struct gdbarch_tdep);
aarch64_gdbarch_tdep *tdep = new aarch64_gdbarch_tdep;
struct gdbarch *gdbarch = gdbarch_alloc (&info, tdep);
/* This should be low enough for everything. */
@ -3605,7 +3611,7 @@ aarch64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
static void
aarch64_dump_tdep (struct gdbarch *gdbarch, struct ui_file *file)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
aarch64_gdbarch_tdep *tdep = (aarch64_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (tdep == NULL)
return;
@ -3825,7 +3831,9 @@ aarch64_record_data_proc_imm (insn_decode_record *aarch64_insn_r)
static unsigned int
aarch64_record_branch_except_sys (insn_decode_record *aarch64_insn_r)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (aarch64_insn_r->gdbarch);
aarch64_gdbarch_tdep *tdep
= (aarch64_gdbarch_tdep *) gdbarch_tdep (aarch64_insn_r->gdbarch);
uint8_t insn_bits24_27, insn_bits28_31, insn_bits22_23;
uint32_t record_buf[4];

View File

@ -25,6 +25,7 @@
#include "arch/aarch64.h"
#include "displaced-stepping.h"
#include "infrun.h"
#include "gdbarch.h"
/* Forward declarations. */
struct gdbarch;
@ -60,31 +61,32 @@ struct regset;
#define AARCH64_DISPLACED_MODIFIED_INSNS 1
/* Target-dependent structure in gdbarch. */
struct gdbarch_tdep
struct aarch64_gdbarch_tdep : gdbarch_tdep
{
/* Lowest address at which instructions will appear. */
CORE_ADDR lowest_pc;
CORE_ADDR lowest_pc = 0;
/* Offset to PC value in jump buffer. If this is negative, longjmp
support will be disabled. */
int jb_pc;
int jb_pc = 0;
/* And the size of each entry in the buf. */
size_t jb_elt_size;
size_t jb_elt_size = 0;
/* Types for AdvSISD registers. */
struct type *vnq_type;
struct type *vnd_type;
struct type *vns_type;
struct type *vnh_type;
struct type *vnb_type;
struct type *vnv_type;
struct type *vnq_type = nullptr;
struct type *vnd_type = nullptr;
struct type *vns_type = nullptr;
struct type *vnh_type = nullptr;
struct type *vnb_type = nullptr;
struct type *vnv_type = nullptr;
/* syscall record. */
int (*aarch64_syscall_record) (struct regcache *regcache, unsigned long svc_number);
int (*aarch64_syscall_record) (struct regcache *regcache,
unsigned long svc_number) = nullptr;
/* The VQ value for SVE targets, or zero if SVE is not supported. */
uint64_t vq;
uint64_t vq = 0;
/* Returns true if the target supports SVE. */
bool has_sve () const
@ -92,8 +94,8 @@ struct gdbarch_tdep
return vq != 0;
}
int pauth_reg_base;
int pauth_ra_state_regnum;
int pauth_reg_base = 0;
int pauth_ra_state_regnum = 0;
/* Returns true if the target supports pauth. */
bool has_pauth () const
@ -102,7 +104,7 @@ struct gdbarch_tdep
}
/* First MTE register. This is -1 if no MTE registers are available. */
int mte_reg_base;
int mte_reg_base = 0;
/* Returns true if the target supports MTE. */
bool has_mte () const

View File

@ -354,8 +354,6 @@ alpha_linux_gdb_signal_to_target (struct gdbarch *gdbarch,
static void
alpha_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep;
linux_init_abi (info, gdbarch, 0);
/* Hook into the DWARF CFI frame unwinder. */
@ -364,7 +362,7 @@ alpha_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* Hook into the MDEBUG frame unwinder. */
alpha_mdebug_init_abi (info, gdbarch);
tdep = gdbarch_tdep (gdbarch);
alpha_gdbarch_tdep *tdep = (alpha_gdbarch_tdep *) gdbarch_tdep (gdbarch);
tdep->dynamic_sigtramp_offset = alpha_linux_sigtramp_offset;
tdep->sigcontext_addr = alpha_linux_sigcontext_addr;
tdep->pc_in_sigtramp = alpha_linux_pc_in_sigtramp;

View File

@ -250,7 +250,7 @@ static void
alphanbsd_init_abi (struct gdbarch_info info,
struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
alpha_gdbarch_tdep *tdep = (alpha_gdbarch_tdep *) gdbarch_tdep (gdbarch);
/* Hook into the DWARF CFI frame unwinder. */
alpha_dwarf2_init_abi (info, gdbarch);

View File

@ -97,7 +97,7 @@ alphaobsd_sigcontext_addr (struct frame_info *this_frame)
static void
alphaobsd_init_abi(struct gdbarch_info info, struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
alpha_gdbarch_tdep *tdep = (alpha_gdbarch_tdep *) gdbarch_tdep (gdbarch);
/* Hook into the DWARF CFI frame unwinder. */
alpha_dwarf2_init_abi (info, gdbarch);

View File

@ -615,11 +615,12 @@ alpha_return_value (struct gdbarch *gdbarch, struct value *function,
gdb_byte *readbuf, const gdb_byte *writebuf)
{
enum type_code code = type->code ();
alpha_gdbarch_tdep *tdep = (alpha_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if ((code == TYPE_CODE_STRUCT
|| code == TYPE_CODE_UNION
|| code == TYPE_CODE_ARRAY)
&& gdbarch_tdep (gdbarch)->return_in_memory (type))
&& tdep->return_in_memory (type))
{
if (readbuf)
{
@ -850,7 +851,7 @@ static int
alpha_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc)
{
struct gdbarch *gdbarch = get_frame_arch (frame);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
alpha_gdbarch_tdep *tdep = (alpha_gdbarch_tdep *) gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR jb_addr;
gdb_byte raw_buffer[ALPHA_REGISTER_SIZE];
@ -882,7 +883,6 @@ alpha_sigtramp_frame_unwind_cache (struct frame_info *this_frame,
void **this_prologue_cache)
{
struct alpha_sigtramp_unwind_cache *info;
struct gdbarch_tdep *tdep;
if (*this_prologue_cache)
return (struct alpha_sigtramp_unwind_cache *) *this_prologue_cache;
@ -890,7 +890,8 @@ alpha_sigtramp_frame_unwind_cache (struct frame_info *this_frame,
info = FRAME_OBSTACK_ZALLOC (struct alpha_sigtramp_unwind_cache);
*this_prologue_cache = info;
tdep = gdbarch_tdep (get_frame_arch (this_frame));
gdbarch *arch = get_frame_arch (this_frame);
alpha_gdbarch_tdep *tdep = (alpha_gdbarch_tdep *) gdbarch_tdep (arch);
info->sigcontext_addr = tdep->sigcontext_addr (this_frame);
return info;
@ -903,7 +904,7 @@ static CORE_ADDR
alpha_sigtramp_register_address (struct gdbarch *gdbarch,
CORE_ADDR sigcontext_addr, int regnum)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
alpha_gdbarch_tdep *tdep = (alpha_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (regnum >= 0 && regnum < 32)
return sigcontext_addr + tdep->sc_regs_offset + regnum * 8;
@ -924,7 +925,7 @@ alpha_sigtramp_frame_this_id (struct frame_info *this_frame,
struct frame_id *this_id)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
alpha_gdbarch_tdep *tdep = (alpha_gdbarch_tdep *) gdbarch_tdep (gdbarch);
struct alpha_sigtramp_unwind_cache *info
= alpha_sigtramp_frame_unwind_cache (this_frame, this_prologue_cache);
CORE_ADDR stack_addr, code_addr;
@ -999,14 +1000,16 @@ alpha_sigtramp_frame_sniffer (const struct frame_unwind *self,
/* We shouldn't even bother to try if the OSABI didn't register a
sigcontext_addr handler or pc_in_sigtramp handler. */
if (gdbarch_tdep (gdbarch)->sigcontext_addr == NULL)
alpha_gdbarch_tdep *tdep = (alpha_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (tdep->sigcontext_addr == NULL)
return 0;
if (gdbarch_tdep (gdbarch)->pc_in_sigtramp == NULL)
if (tdep->pc_in_sigtramp == NULL)
return 0;
/* Otherwise we should be in a signal frame. */
find_pc_partial_function (pc, &name, NULL, NULL);
if (gdbarch_tdep (gdbarch)->pc_in_sigtramp (gdbarch, pc, name))
if (tdep->pc_in_sigtramp (gdbarch, pc, name))
return 1;
return 0;
@ -1038,7 +1041,7 @@ static int heuristic_fence_post = 0;
static CORE_ADDR
alpha_heuristic_proc_start (struct gdbarch *gdbarch, CORE_ADDR pc)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
alpha_gdbarch_tdep *tdep = (alpha_gdbarch_tdep *) gdbarch_tdep (gdbarch);
CORE_ADDR last_non_nop = pc;
CORE_ADDR fence = pc - heuristic_fence_post;
CORE_ADDR orig_pc = pc;
@ -1724,7 +1727,6 @@ alpha_software_single_step (struct regcache *regcache)
static struct gdbarch *
alpha_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
struct gdbarch_tdep *tdep;
struct gdbarch *gdbarch;
/* Find a candidate among extant architectures. */
@ -1732,7 +1734,7 @@ alpha_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
if (arches != NULL)
return arches->gdbarch;
tdep = XCNEW (struct gdbarch_tdep);
alpha_gdbarch_tdep *tdep = new alpha_gdbarch_tdep;
gdbarch = gdbarch_alloc (&info, tdep);
/* Lowest text address. This is used by heuristic_proc_start()

View File

@ -19,6 +19,8 @@
#ifndef ALPHA_TDEP_H
#define ALPHA_TDEP_H
#include "gdbarch.h"
struct regcache;
/* Say how long (ordinary) registers are. This is a piece of bogosity
@ -68,38 +70,38 @@ struct regcache;
#define ALPHA_NUM_ARG_REGS 6
/* Target-dependent structure in gdbarch. */
struct gdbarch_tdep
struct alpha_gdbarch_tdep : gdbarch_tdep
{
CORE_ADDR vm_min_address; /* Used by alpha_heuristic_proc_start. */
CORE_ADDR vm_min_address = 0; /* Used by alpha_heuristic_proc_start. */
/* If PC is inside a dynamically-generated signal trampoline function
(i.e. one copied onto the user stack at run-time), return how many
bytes PC is beyond the start of that function. Otherwise, return -1. */
LONGEST (*dynamic_sigtramp_offset) (struct gdbarch *, CORE_ADDR);
LONGEST (*dynamic_sigtramp_offset) (struct gdbarch *, CORE_ADDR) = nullptr;
/* Translate a signal handler stack base address into the address of
the sigcontext structure for that signal handler. */
CORE_ADDR (*sigcontext_addr) (struct frame_info *);
CORE_ADDR (*sigcontext_addr) (struct frame_info *) = nullptr;
/* Does the PC fall in a signal trampoline. */
/* NOTE: cagney/2004-04-30: Do not copy/clone this code. Instead
look at tramp-frame.h and other simpler per-architecture
sigtramp unwinders. */
int (*pc_in_sigtramp) (struct gdbarch *gdbarch, CORE_ADDR pc,
const char *name);
const char *name) = nullptr;
/* If TYPE will be returned in memory, return true. */
int (*return_in_memory) (struct type *type);
int (*return_in_memory) (struct type *type) = nullptr;
/* Offset of registers in `struct sigcontext'. */
int sc_pc_offset;
int sc_regs_offset;
int sc_fpregs_offset;
int sc_pc_offset = 0;
int sc_regs_offset = 0;
int sc_fpregs_offset = 0;
int jb_pc; /* Offset to PC value in jump buffer.
int jb_pc = 0; /* Offset to PC value in jump buffer.
If htis is negative, longjmp support
will be disabled. */
size_t jb_elt_size; /* And the size of each entry in the buf. */
size_t jb_elt_size = 0; /* And the size of each entry in the buf. */
};
extern unsigned int alpha_read_insn (struct gdbarch *gdbarch, CORE_ADDR pc);

View File

@ -97,7 +97,7 @@ amd64_darwin_sigcontext_addr (struct frame_info *this_frame)
static void
x86_darwin_init_abi_64 (struct gdbarch_info info, struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
amd64_init_abi (info, gdbarch,
amd64_target_description (X86_XSTATE_SSE_MASK, true));

View File

@ -195,7 +195,7 @@ amd64fbsd_iterate_over_regset_sections (struct gdbarch *gdbarch,
void *cb_data,
const struct regcache *regcache)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
cb (".reg", tdep->sizeof_gregset, tdep->sizeof_gregset, &i386_gregset, NULL,
cb_data);
@ -229,7 +229,7 @@ amd64fbsd_get_thread_local_address (struct gdbarch *gdbarch, ptid_t ptid,
static void
amd64fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
/* Generic FreeBSD support. */
fbsd_init_abi (info, gdbarch);

View File

@ -1650,7 +1650,7 @@ amd64_linux_iterate_over_regset_sections (struct gdbarch *gdbarch,
void *cb_data,
const struct regcache *regcache)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
cb (".reg", 27 * 8, 27 * 8, &i386_gregset, NULL, cb_data);
cb (".reg2", 512, 512, &amd64_fpregset, NULL, cb_data);
@ -1787,7 +1787,7 @@ static void
amd64_linux_init_abi_common(struct gdbarch_info info, struct gdbarch *gdbarch,
int num_disp_step_buffers)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
linux_init_abi (info, gdbarch, num_disp_step_buffers);
@ -1840,7 +1840,7 @@ amd64_linux_init_abi_common(struct gdbarch_info info, struct gdbarch *gdbarch,
static void
amd64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
struct tdesc_arch_data *tdesc_data = info.tdesc_data;
const struct tdesc_feature *feature;
int valid_p;
@ -2054,7 +2054,7 @@ amd64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
static void
amd64_x32_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
struct tdesc_arch_data *tdesc_data = info.tdesc_data;
const struct tdesc_feature *feature;
int valid_p;

View File

@ -97,7 +97,7 @@ int amd64nbsd_r_reg_offset[] =
static void
amd64nbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
/* Initialize general-purpose register set details first. */
tdep->gregset_reg_offset = amd64nbsd_r_reg_offset;

View File

@ -420,7 +420,7 @@ static const struct frame_unwind amd64obsd_trapframe_unwind =
static void
amd64obsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
amd64_init_abi (info, gdbarch,
amd64_target_description (X86_XSTATE_SSE_MASK, true));

View File

@ -80,7 +80,7 @@ amd64_sol2_mcontext_addr (struct frame_info *this_frame)
static void
amd64_sol2_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
tdep->gregset_reg_offset = amd64_sol2_gregset_reg_offset;
tdep->gregset_num_regs = ARRAY_SIZE (amd64_sol2_gregset_reg_offset);

View File

@ -247,7 +247,7 @@ static const int amd64_dwarf_regmap_len =
static int
amd64_dwarf_reg_to_regnum (struct gdbarch *gdbarch, int reg)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int ymm0_regnum = tdep->ymm0_regnum;
int regnum = -1;
@ -331,7 +331,7 @@ static const char * const amd64_dword_names[] =
static const char *
amd64_pseudo_register_name (struct gdbarch *gdbarch, int regnum)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (i386_byte_regnum_p (gdbarch, regnum))
return amd64_byte_names[regnum - tdep->al_regnum];
else if (i386_zmm_regnum_p (gdbarch, regnum))
@ -353,7 +353,7 @@ amd64_pseudo_register_read_value (struct gdbarch *gdbarch,
readable_regcache *regcache,
int regnum)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
value *result_value = allocate_value (register_type (gdbarch, regnum));
VALUE_LVAL (result_value) = lval_register;
@ -413,7 +413,7 @@ amd64_pseudo_register_write (struct gdbarch *gdbarch,
struct regcache *regcache,
int regnum, const gdb_byte *buf)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (i386_byte_regnum_p (gdbarch, regnum))
{
@ -465,7 +465,7 @@ static int
amd64_ax_pseudo_register_collect (struct gdbarch *gdbarch,
struct agent_expr *ax, int regnum)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (i386_byte_regnum_p (gdbarch, regnum))
{
@ -2739,7 +2739,7 @@ static struct amd64_frame_cache *
amd64_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct amd64_frame_cache *cache;
CORE_ADDR addr;
@ -2821,7 +2821,8 @@ amd64_sigtramp_frame_sniffer (const struct frame_unwind *self,
struct frame_info *this_frame,
void **this_cache)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (this_frame));
gdbarch *arch = get_frame_arch (this_frame);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (arch);
/* We shouldn't even bother if we don't have a sigcontext_addr
handler. */
@ -3021,7 +3022,7 @@ amd64_supply_fpregset (const struct regset *regset, struct regcache *regcache,
int regnum, const void *fpregs, size_t len)
{
struct gdbarch *gdbarch = regcache->arch ();
const struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
const i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
gdb_assert (len >= tdep->sizeof_fpregset);
amd64_supply_fxsave (regcache, regnum, fpregs);
@ -3038,7 +3039,7 @@ amd64_collect_fpregset (const struct regset *regset,
int regnum, void *fpregs, size_t len)
{
struct gdbarch *gdbarch = regcache->arch ();
const struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
const i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
gdb_assert (len >= tdep->sizeof_fpregset);
amd64_collect_fxsave (regcache, regnum, fpregs);
@ -3062,7 +3063,8 @@ amd64_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc)
gdb_byte buf[8];
CORE_ADDR jb_addr;
struct gdbarch *gdbarch = get_frame_arch (frame);
int jb_pc_offset = gdbarch_tdep (gdbarch)->jb_pc_offset;
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int jb_pc_offset = tdep->jb_pc_offset;
int len = TYPE_LENGTH (builtin_type (gdbarch)->builtin_func_ptr);
/* If JB_PC_OFFSET is -1, we have no way to find out where the
@ -3105,7 +3107,7 @@ void
amd64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch,
const target_desc *default_tdesc)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
const struct target_desc *tdesc = info.target_desc;
static const char *const stap_integer_prefixes[] = { "$", NULL };
static const char *const stap_register_prefixes[] = { "%", NULL };
@ -3284,7 +3286,7 @@ amd64_none_init_abi (gdbarch_info info, gdbarch *arch)
static struct type *
amd64_x32_pseudo_register_type (struct gdbarch *gdbarch, int regnum)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
switch (regnum - tdep->eax_regnum)
{
@ -3302,7 +3304,7 @@ void
amd64_x32_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch,
const target_desc *default_tdesc)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
amd64_init_abi (info, gdbarch, default_tdesc);
@ -3372,7 +3374,7 @@ amd64_supply_fxsave (struct regcache *regcache, int regnum,
const void *fxsave)
{
struct gdbarch *gdbarch = regcache->arch ();
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
i387_supply_fxsave (regcache, regnum, fxsave);
@ -3395,7 +3397,7 @@ amd64_supply_xsave (struct regcache *regcache, int regnum,
const void *xsave)
{
struct gdbarch *gdbarch = regcache->arch ();
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
i387_supply_xsave (regcache, regnum, xsave);
@ -3430,7 +3432,7 @@ amd64_collect_fxsave (const struct regcache *regcache, int regnum,
void *fxsave)
{
struct gdbarch *gdbarch = regcache->arch ();
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
gdb_byte *regs = (gdb_byte *) fxsave;
i387_collect_fxsave (regcache, regnum, fxsave);
@ -3451,7 +3453,7 @@ amd64_collect_xsave (const struct regcache *regcache, int regnum,
void *xsave, int gcore)
{
struct gdbarch *gdbarch = regcache->arch ();
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
gdb_byte *regs = (gdb_byte *) xsave;
i387_collect_xsave (regcache, regnum, xsave, gcore);

View File

@ -1277,7 +1277,7 @@ amd64_windows_auto_wide_charset (void)
static void
amd64_windows_init_abi_common (gdbarch_info info, struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
/* The dwarf2 unwinder (appended very early by i386_gdbarch_init) is
preferred over the SEH one. The reasons are:

View File

@ -410,7 +410,7 @@ static std::vector<CORE_ADDR>
arc_linux_software_single_step (struct regcache *regcache)
{
struct gdbarch *gdbarch = regcache->arch ();
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
arc_gdbarch_tdep *tdep = (arc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
struct disassemble_info di = arc_disassemble_info (gdbarch);
/* Read current instruction. */
@ -692,7 +692,7 @@ arc_linux_core_read_description (struct gdbarch *gdbarch,
static void
arc_linux_init_osabi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
arc_gdbarch_tdep *tdep = (arc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
arc_linux_debug_printf ("GNU/Linux OS/ABI initialization.");

View File

@ -1002,7 +1002,7 @@ arc_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc)
arc_debug_printf ("called");
struct gdbarch *gdbarch = get_frame_arch (frame);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
arc_gdbarch_tdep *tdep = (arc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int pc_offset = tdep->jb_pc * ARC_REGISTER_SIZE;
gdb_byte buf[ARC_REGISTER_SIZE];
CORE_ADDR jb_addr = get_frame_register_unsigned (frame, ARC_FIRST_ARG_REGNUM);
@ -1832,7 +1832,8 @@ arc_make_sigtramp_frame_cache (struct frame_info *this_frame)
{
arc_debug_printf ("called");
struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (this_frame));
gdbarch *arch = get_frame_arch (this_frame);
arc_gdbarch_tdep *tdep = (arc_gdbarch_tdep *) gdbarch_tdep (arch);
/* Allocate new frame cache instance and space for saved register info. */
struct arc_frame_cache *cache = FRAME_OBSTACK_ZALLOC (struct arc_frame_cache);
@ -1906,11 +1907,10 @@ arc_sigtramp_frame_sniffer (const struct frame_unwind *self,
struct frame_info *this_frame,
void **this_cache)
{
struct gdbarch_tdep *tdep;
arc_debug_printf ("called");
tdep = gdbarch_tdep (get_frame_arch (this_frame));
gdbarch *arch = get_frame_arch (this_frame);
arc_gdbarch_tdep *tdep = (arc_gdbarch_tdep *) gdbarch_tdep (arch);
/* If we have a sigcontext_addr handler, then just return 1 (same as the
"default_frame_sniffer ()"). */
@ -2295,11 +2295,11 @@ arc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* Allocate the ARC-private target-dependent information structure, and the
GDB target-independent information structure. */
gdb::unique_xmalloc_ptr<struct gdbarch_tdep> tdep
(XCNEW (struct gdbarch_tdep));
std::unique_ptr<arc_gdbarch_tdep> tdep_holder (new arc_gdbarch_tdep);
arc_gdbarch_tdep *tdep = tdep_holder.get ();
tdep->jb_pc = -1; /* No longjmp support by default. */
tdep->has_hw_loops = arc_check_for_hw_loops (tdesc, tdesc_data.get ());
struct gdbarch *gdbarch = gdbarch_alloc (&info, tdep.release ());
struct gdbarch *gdbarch = gdbarch_alloc (&info, tdep_holder.release ());
/* Data types. */
set_gdbarch_short_bit (gdbarch, 16);
@ -2384,7 +2384,7 @@ arc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
It can override functions set earlier. */
gdbarch_init_osabi (info, gdbarch);
if (gdbarch_tdep (gdbarch)->jb_pc >= 0)
if (tdep->jb_pc >= 0)
set_gdbarch_get_longjmp_target (gdbarch, arc_get_longjmp_target);
/* Disassembler options. Enforce CPU if it was specified in XML target
@ -2454,7 +2454,7 @@ arc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
static void
arc_dump_tdep (struct gdbarch *gdbarch, struct ui_file *file)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
arc_gdbarch_tdep *tdep = (arc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
fprintf_unfiltered (file, "arc_dump_tdep: jb_pc = %i\n", tdep->jb_pc);

View File

@ -121,27 +121,27 @@ extern bool arc_debug;
/* Target-dependent information. */
struct gdbarch_tdep
struct arc_gdbarch_tdep : gdbarch_tdep
{
/* Offset to PC value in jump buffer. If this is negative, longjmp
support will be disabled. */
int jb_pc;
int jb_pc = 0;
/* Whether target has hardware (aka zero-delay) loops. */
bool has_hw_loops;
bool has_hw_loops = false;
/* Detect sigtramp. */
bool (*is_sigtramp) (struct frame_info *);
bool (*is_sigtramp) (struct frame_info *) = nullptr;
/* Get address of sigcontext for sigtramp. */
CORE_ADDR (*sigcontext_addr) (struct frame_info *);
CORE_ADDR (*sigcontext_addr) (struct frame_info *) = nullptr;
/* Offset of registers in `struct sigcontext'. */
const int *sc_reg_offset;
const int *sc_reg_offset = nullptr;
/* Number of registers in sc_reg_offsets. Most likely a ARC_LAST_REGNUM,
but in theory it could be less, so it is kept separate. */
int sc_num_regs;
int sc_num_regs = 0;
};
/* Utility functions used by other ARC-specific modules. */

View File

@ -158,7 +158,7 @@ arm_fbsd_iterate_over_regset_sections (struct gdbarch *gdbarch,
void *cb_data,
const struct regcache *regcache)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
arm_gdbarch_tdep *tdep = (arm_gdbarch_tdep *) gdbarch_tdep (gdbarch);
cb (".reg", ARM_FBSD_SIZEOF_GREGSET, ARM_FBSD_SIZEOF_GREGSET,
&arm_fbsd_gregset, NULL, cb_data);
@ -211,7 +211,7 @@ arm_fbsd_core_read_description (struct gdbarch *gdbarch,
static void
arm_fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
arm_gdbarch_tdep *tdep = (arm_gdbarch_tdep *) gdbarch_tdep (gdbarch);
/* Generic FreeBSD support. */
fbsd_init_abi (info, gdbarch);

View File

@ -712,7 +712,7 @@ arm_linux_iterate_over_regset_sections (struct gdbarch *gdbarch,
void *cb_data,
const struct regcache *regcache)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
arm_gdbarch_tdep *tdep = (arm_gdbarch_tdep *) gdbarch_tdep (gdbarch);
cb (".reg", ARM_LINUX_SIZEOF_GREGSET, ARM_LINUX_SIZEOF_GREGSET,
&arm_linux_gregset, NULL, cb_data);
@ -1714,7 +1714,7 @@ arm_linux_init_abi (struct gdbarch_info info,
NULL };
static const char *const stap_register_indirection_suffixes[] = { "]",
NULL };
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
arm_gdbarch_tdep *tdep = (arm_gdbarch_tdep *) gdbarch_tdep (gdbarch);
linux_init_abi (info, gdbarch, 1);

View File

@ -111,7 +111,7 @@ static void
arm_netbsd_init_abi_common (struct gdbarch_info info,
struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
arm_gdbarch_tdep *tdep = (arm_gdbarch_tdep *) gdbarch_tdep (gdbarch);
tdep->lowest_pc = 0x8000;
switch (info.byte_order)
@ -148,7 +148,7 @@ static void
arm_netbsd_elf_init_abi (struct gdbarch_info info,
struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
arm_gdbarch_tdep *tdep = (arm_gdbarch_tdep *) gdbarch_tdep (gdbarch);
arm_netbsd_init_abi_common (info, gdbarch);

View File

@ -177,7 +177,7 @@ arm_none_iterate_over_regset_sections (struct gdbarch *gdbarch,
void *cb_data,
const struct regcache *regcache)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
arm_gdbarch_tdep *tdep = (arm_gdbarch_tdep *) gdbarch_tdep (gdbarch);
cb (".reg", ARM_NONE_SIZEOF_GREGSET, ARM_NONE_SIZEOF_GREGSET,
&arm_none_gregset, nullptr, cb_data);

View File

@ -76,7 +76,7 @@ static void
armobsd_init_abi (struct gdbarch_info info,
struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
arm_gdbarch_tdep *tdep = (arm_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (tdep->fp_model == ARM_FLOAT_AUTO)
tdep->fp_model = ARM_FLOAT_SOFT_VFP;

View File

@ -332,7 +332,9 @@ bool arm_apcs_32 = true;
int
arm_psr_thumb_bit (struct gdbarch *gdbarch)
{
if (gdbarch_tdep (gdbarch)->is_m)
arm_gdbarch_tdep *tdep = (arm_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (tdep->is_m)
return XPSR_T;
else
return CPSR_T;
@ -438,6 +440,7 @@ arm_pc_is_thumb (struct gdbarch *gdbarch, CORE_ADDR memaddr)
struct bound_minimal_symbol sym;
char type;
arm_displaced_step_copy_insn_closure *dsc = nullptr;
arm_gdbarch_tdep *tdep = (arm_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (gdbarch_displaced_step_copy_insn_closure_by_addr_p (gdbarch))
dsc = ((arm_displaced_step_copy_insn_closure * )
@ -465,7 +468,7 @@ arm_pc_is_thumb (struct gdbarch *gdbarch, CORE_ADDR memaddr)
return 1;
/* ARM v6-M and v7-M are always in Thumb mode. */
if (gdbarch_tdep (gdbarch)->is_m)
if (tdep->is_m)
return 1;
/* If there are mapping symbols, consult them. */
@ -568,10 +571,11 @@ arm_m_addr_is_magic (CORE_ADDR addr)
static CORE_ADDR
arm_addr_bits_remove (struct gdbarch *gdbarch, CORE_ADDR val)
{
arm_gdbarch_tdep *tdep = (arm_gdbarch_tdep *) gdbarch_tdep (gdbarch);
/* On M-profile devices, do not strip the low bit from EXC_RETURN
(the magic exception return address). */
if (gdbarch_tdep (gdbarch)->is_m
&& arm_m_addr_is_magic (val))
if (tdep->is_m && arm_m_addr_is_magic (val))
return val;
if (arm_apcs_32)
@ -1557,6 +1561,7 @@ arm_analyze_prologue (struct gdbarch *gdbarch,
CORE_ADDR offset, current_pc;
pv_t regs[ARM_FPS_REGNUM];
CORE_ADDR unrecognized_pc = 0;
arm_gdbarch_tdep *tdep = (arm_gdbarch_tdep *) gdbarch_tdep (gdbarch);
/* Search the prologue looking for instructions that set up the
frame pointer, adjust the stack pointer, and save registers.
@ -1661,7 +1666,7 @@ arm_analyze_prologue (struct gdbarch *gdbarch,
}
else if ((insn & 0xffff7fff) == 0xed6d0103 /* stfe f?,
[sp, -#c]! */
&& gdbarch_tdep (gdbarch)->have_fpa_registers)
&& tdep->have_fpa_registers)
{
if (stack.store_would_trash (regs[ARM_SP_REGNUM]))
break;
@ -1672,7 +1677,7 @@ arm_analyze_prologue (struct gdbarch *gdbarch,
}
else if ((insn & 0xffbf0fff) == 0xec2d0200 /* sfmfd f0, 4,
[sp!] */
&& gdbarch_tdep (gdbarch)->have_fpa_registers)
&& tdep->have_fpa_registers)
{
int n_saved_fp_regs;
unsigned int fp_start_reg, fp_bound_reg;
@ -1800,6 +1805,7 @@ arm_scan_prologue (struct frame_info *this_frame,
CORE_ADDR prologue_start, prologue_end;
CORE_ADDR prev_pc = get_frame_pc (this_frame);
CORE_ADDR block_addr = get_frame_address_in_block (this_frame);
arm_gdbarch_tdep *tdep = (arm_gdbarch_tdep *) gdbarch_tdep (gdbarch);
/* Assume there is no frame until proven otherwise. */
cache->framereg = ARM_SP_REGNUM;
@ -1865,7 +1871,7 @@ arm_scan_prologue (struct frame_info *this_frame,
ULONGEST return_value;
/* AAPCS does not use a frame register, so we can abort here. */
if (gdbarch_tdep (gdbarch)->arm_abi == ARM_ABI_AAPCS)
if (tdep->arm_abi == ARM_ABI_AAPCS)
return;
frame_loc = get_frame_register_unsigned (this_frame, ARM_FP_REGNUM);
@ -1930,7 +1936,9 @@ arm_prologue_unwind_stop_reason (struct frame_info *this_frame,
/* This is meant to halt the backtrace at "_start". */
pc = get_frame_pc (this_frame);
if (pc <= gdbarch_tdep (get_frame_arch (this_frame))->lowest_pc)
gdbarch *arch = get_frame_arch (this_frame);
arm_gdbarch_tdep *tdep = (arm_gdbarch_tdep *) gdbarch_tdep (arch);
if (pc <= tdep->lowest_pc)
return UNWIND_OUTERMOST;
/* If we've hit a wall, stop. */
@ -3739,15 +3747,18 @@ arm_vfp_call_candidate (struct type *t, enum arm_vfp_cprc_base_type *base_type,
static int
arm_vfp_abi_for_function (struct gdbarch *gdbarch, struct type *func_type)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
arm_gdbarch_tdep *tdep = (arm_gdbarch_tdep *) gdbarch_tdep (gdbarch);
/* Variadic functions always use the base ABI. Assume that functions
without debug info are not variadic. */
if (func_type && check_typedef (func_type)->has_varargs ())
return 0;
/* The VFP ABI is only supported as a variant of AAPCS. */
if (tdep->arm_abi != ARM_ABI_AAPCS)
return 0;
return gdbarch_tdep (gdbarch)->fp_model == ARM_FLOAT_VFP;
return tdep->fp_model == ARM_FLOAT_VFP;
}
/* We currently only support passing parameters in integer registers, which
@ -3770,6 +3781,7 @@ arm_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
int use_vfp_abi;
struct type *ftype;
unsigned vfp_regs_free = (1 << 16) - 1;
arm_gdbarch_tdep *tdep = (arm_gdbarch_tdep *) gdbarch_tdep (gdbarch);
/* Determine the type of this function and whether the VFP ABI
applies. */
@ -3827,7 +3839,7 @@ arm_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
align = (align + ARM_INT_REGISTER_SIZE - 1)
& ~(ARM_INT_REGISTER_SIZE - 1);
/* Different ABIs have different maximum alignments. */
if (gdbarch_tdep (gdbarch)->arm_abi == ARM_ABI_APCS)
if (tdep->arm_abi == ARM_ABI_APCS)
{
/* The APCS ABI only requires word alignment. */
align = ARM_INT_REGISTER_SIZE;
@ -4041,7 +4053,7 @@ arm_print_float_info (struct gdbarch *gdbarch, struct ui_file *file,
static struct type *
arm_ext_type (struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
arm_gdbarch_tdep *tdep = (arm_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (!tdep->arm_ext_type)
tdep->arm_ext_type
@ -4054,7 +4066,7 @@ arm_ext_type (struct gdbarch *gdbarch)
static struct type *
arm_neon_double_type (struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
arm_gdbarch_tdep *tdep = (arm_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (tdep->neon_double_type == NULL)
{
@ -4093,7 +4105,7 @@ arm_neon_double_type (struct gdbarch *gdbarch)
static struct type *
arm_neon_quad_type (struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
arm_gdbarch_tdep *tdep = (arm_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (tdep->neon_quad_type == NULL)
{
@ -4131,7 +4143,7 @@ arm_neon_quad_type (struct gdbarch *gdbarch)
static bool
is_q_pseudo (struct gdbarch *gdbarch, int regnum)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
arm_gdbarch_tdep *tdep = (arm_gdbarch_tdep *) gdbarch_tdep (gdbarch);
/* Q pseudo registers are available for both NEON (Q0~Q15) and
MVE (Q0~Q7) features. */
@ -4152,7 +4164,7 @@ is_q_pseudo (struct gdbarch *gdbarch, int regnum)
static bool
is_s_pseudo (struct gdbarch *gdbarch, int regnum)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
arm_gdbarch_tdep *tdep = (arm_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (tdep->have_s_pseudos
&& regnum >= tdep->s_pseudo_base
@ -4171,7 +4183,7 @@ is_s_pseudo (struct gdbarch *gdbarch, int regnum)
static bool
is_mve_pseudo (struct gdbarch *gdbarch, int regnum)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
arm_gdbarch_tdep *tdep = (arm_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (tdep->have_mve
&& regnum >= tdep->mve_pseudo_base
@ -4187,7 +4199,7 @@ is_mve_pseudo (struct gdbarch *gdbarch, int regnum)
static struct type *
arm_register_type (struct gdbarch *gdbarch, int regnum)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
arm_gdbarch_tdep *tdep = (arm_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (is_s_pseudo (gdbarch, regnum))
return builtin_type (gdbarch)->builtin_float;
@ -4369,9 +4381,10 @@ arm_adjust_breakpoint_address (struct gdbarch *gdbarch, CORE_ADDR bpaddr)
int buf_len;
enum bfd_endian order = gdbarch_byte_order_for_code (gdbarch);
int i, any, last_it, last_it_count;
arm_gdbarch_tdep *tdep = (arm_gdbarch_tdep *) gdbarch_tdep (gdbarch);
/* If we are using BKPT breakpoints, none of this is necessary. */
if (gdbarch_tdep (gdbarch)->thumb2_breakpoint == NULL)
if (tdep->thumb2_breakpoint == NULL)
return bpaddr;
/* ARM mode does not have this problem. */
@ -7676,7 +7689,7 @@ arm_displaced_init_closure (struct gdbarch *gdbarch, CORE_ADDR from,
CORE_ADDR to,
arm_displaced_step_copy_insn_closure *dsc)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
arm_gdbarch_tdep *tdep = (arm_gdbarch_tdep *) gdbarch_tdep (gdbarch);
unsigned int i, len, offset;
enum bfd_endian byte_order_for_code = gdbarch_byte_order_for_code (gdbarch);
int size = dsc->is_thumb? 2 : 4;
@ -7839,7 +7852,7 @@ static const gdb_byte arm_default_thumb_be_breakpoint[] = THUMB_BE_BREAKPOINT;
static int
arm_breakpoint_kind_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
arm_gdbarch_tdep *tdep = (arm_gdbarch_tdep *) gdbarch_tdep (gdbarch);
enum bfd_endian byte_order_for_code = gdbarch_byte_order_for_code (gdbarch);
if (arm_pc_is_thumb (gdbarch, *pcptr))
@ -7874,7 +7887,7 @@ arm_breakpoint_kind_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr)
static const gdb_byte *
arm_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
arm_gdbarch_tdep *tdep = (arm_gdbarch_tdep *) gdbarch_tdep (gdbarch);
switch (kind)
{
@ -7946,10 +7959,11 @@ arm_extract_return_value (struct type *type, struct regcache *regs,
{
struct gdbarch *gdbarch = regs->arch ();
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
arm_gdbarch_tdep *tdep = (arm_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (TYPE_CODE_FLT == type->code ())
{
switch (gdbarch_tdep (gdbarch)->fp_model)
switch (tdep->fp_model)
{
case ARM_FLOAT_FPA:
{
@ -8055,7 +8069,8 @@ arm_return_in_memory (struct gdbarch *gdbarch, struct type *type)
return (TYPE_LENGTH (type) > 16);
}
if (gdbarch_tdep (gdbarch)->arm_abi != ARM_ABI_APCS)
arm_gdbarch_tdep *tdep = (arm_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (tdep->arm_abi != ARM_ABI_APCS)
{
/* The AAPCS says all aggregates not larger than a word are returned
in a register. */
@ -8158,8 +8173,9 @@ arm_store_return_value (struct type *type, struct regcache *regs,
if (type->code () == TYPE_CODE_FLT)
{
gdb_byte buf[ARM_FP_REGISTER_SIZE];
arm_gdbarch_tdep *tdep = (arm_gdbarch_tdep *) gdbarch_tdep (gdbarch);
switch (gdbarch_tdep (gdbarch)->fp_model)
switch (tdep->fp_model)
{
case ARM_FLOAT_FPA:
@ -8246,7 +8262,7 @@ arm_return_value (struct gdbarch *gdbarch, struct value *function,
struct type *valtype, struct regcache *regcache,
gdb_byte *readbuf, const gdb_byte *writebuf)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
arm_gdbarch_tdep *tdep = (arm_gdbarch_tdep *) gdbarch_tdep (gdbarch);
struct type *func_type = function ? value_type (function) : NULL;
enum arm_vfp_cprc_base_type vfp_base_type;
int vfp_base_count;
@ -8314,7 +8330,7 @@ static int
arm_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc)
{
struct gdbarch *gdbarch = get_frame_arch (frame);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
arm_gdbarch_tdep *tdep = (arm_gdbarch_tdep *) gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR jb_addr;
gdb_byte buf[ARM_INT_REGISTER_SIZE];
@ -8503,7 +8519,8 @@ static void
show_fp_model (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (target_gdbarch ());
arm_gdbarch_tdep *tdep
= (arm_gdbarch_tdep *) gdbarch_tdep (target_gdbarch ());
if (arm_fp_model == ARM_FLOAT_AUTO
&& gdbarch_bfd_arch_info (target_gdbarch ())->arch == bfd_arch_arm)
@ -8540,7 +8557,8 @@ static void
arm_show_abi (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (target_gdbarch ());
arm_gdbarch_tdep *tdep
= (arm_gdbarch_tdep *) gdbarch_tdep (target_gdbarch ());
if (arm_abi_global == ARM_ABI_AUTO
&& gdbarch_bfd_arch_info (target_gdbarch ())->arch == bfd_arch_arm)
@ -8611,7 +8629,7 @@ show_disassembly_style_sfunc (struct ui_file *file, int from_tty,
static const char *
arm_register_name (struct gdbarch *gdbarch, int i)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
arm_gdbarch_tdep *tdep = (arm_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (is_s_pseudo (gdbarch, i))
{
@ -8778,7 +8796,7 @@ static enum register_status
arm_mve_pseudo_read (struct gdbarch *gdbarch, readable_regcache *regcache,
int regnum, gdb_byte *buf)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
arm_gdbarch_tdep *tdep = (arm_gdbarch_tdep *) gdbarch_tdep (gdbarch);
/* P0 is the first 16 bits of VPR. */
return regcache->raw_read_part (tdep->mve_vpr_regnum, 0, 2, buf);
@ -8792,11 +8810,10 @@ arm_pseudo_read (struct gdbarch *gdbarch, readable_regcache *regcache,
char name_buf[4];
gdb_byte reg_buf[8];
int offset, double_regnum;
arm_gdbarch_tdep *tdep = (arm_gdbarch_tdep *) gdbarch_tdep (gdbarch);
gdb_assert (regnum >= num_regs);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
if (is_q_pseudo (gdbarch, regnum))
{
/* Quad-precision register. */
@ -8865,7 +8882,7 @@ static void
arm_mve_pseudo_write (struct gdbarch *gdbarch, struct regcache *regcache,
int regnum, const gdb_byte *buf)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
arm_gdbarch_tdep *tdep = (arm_gdbarch_tdep *) gdbarch_tdep (gdbarch);
/* P0 is the first 16 bits of VPR. */
regcache->raw_write_part (tdep->mve_vpr_regnum, 0, 2, buf);
@ -8879,11 +8896,10 @@ arm_pseudo_write (struct gdbarch *gdbarch, struct regcache *regcache,
char name_buf[4];
gdb_byte reg_buf[8];
int offset, double_regnum;
arm_gdbarch_tdep *tdep = (arm_gdbarch_tdep *) gdbarch_tdep (gdbarch);
gdb_assert (regnum >= num_regs);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
if (is_q_pseudo (gdbarch, regnum))
{
/* Quad-precision register. */
@ -8968,7 +8984,9 @@ arm_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
static void
arm_register_g_packet_guesses (struct gdbarch *gdbarch)
{
if (gdbarch_tdep (gdbarch)->is_m)
arm_gdbarch_tdep *tdep = (arm_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (tdep->is_m)
{
const target_desc *tdesc;
@ -9005,8 +9023,9 @@ arm_register_g_packet_guesses (struct gdbarch *gdbarch)
static int
arm_code_of_frame_writable (struct gdbarch *gdbarch, struct frame_info *frame)
{
if (gdbarch_tdep (gdbarch)->is_m
&& get_frame_type (frame) == SIGTRAMP_FRAME)
arm_gdbarch_tdep *tdep = (arm_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (tdep->is_m && get_frame_type (frame) == SIGTRAMP_FRAME)
{
/* M-profile exception frames return to some magic PCs, where
isn't writable at all. */
@ -9037,7 +9056,6 @@ arm_gnu_triplet_regexp (struct gdbarch *gdbarch)
static struct gdbarch *
arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
struct gdbarch_tdep *tdep;
struct gdbarch *gdbarch;
struct gdbarch_list *best_arch;
enum arm_abi_kind arm_abi = arm_abi_global;
@ -9406,12 +9424,13 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
best_arch != NULL;
best_arch = gdbarch_list_lookup_by_info (best_arch->next, &info))
{
if (arm_abi != ARM_ABI_AUTO
&& arm_abi != gdbarch_tdep (best_arch->gdbarch)->arm_abi)
arm_gdbarch_tdep *tdep
= (arm_gdbarch_tdep *) gdbarch_tdep (best_arch->gdbarch);
if (arm_abi != ARM_ABI_AUTO && arm_abi != tdep->arm_abi)
continue;
if (fp_model != ARM_FLOAT_AUTO
&& fp_model != gdbarch_tdep (best_arch->gdbarch)->fp_model)
if (fp_model != ARM_FLOAT_AUTO && fp_model != tdep->fp_model)
continue;
/* There are various other properties in tdep that we do not
@ -9420,7 +9439,7 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
automatically disqualified. */
/* Do check is_m, though, since it might come from the binary. */
if (is_m != gdbarch_tdep (best_arch->gdbarch)->is_m)
if (is_m != tdep->is_m)
continue;
/* Found a match. */
@ -9430,7 +9449,7 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
if (best_arch != NULL)
return best_arch->gdbarch;
tdep = XCNEW (struct gdbarch_tdep);
arm_gdbarch_tdep *tdep = new arm_gdbarch_tdep;
gdbarch = gdbarch_alloc (&info, tdep);
/* Record additional information about the architecture we are defining.
@ -9546,7 +9565,7 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* This "info float" is FPA-specific. Use the generic version if we
do not have FPA. */
if (gdbarch_tdep (gdbarch)->have_fpa_registers)
if (tdep->have_fpa_registers)
set_gdbarch_print_float_info (gdbarch, arm_print_float_info);
/* Internal <-> external register number maps. */
@ -9692,7 +9711,7 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
static void
arm_dump_tdep (struct gdbarch *gdbarch, struct ui_file *file)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
arm_gdbarch_tdep *tdep = (arm_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (tdep == NULL)
return;
@ -11868,7 +11887,8 @@ static int
arm_record_coproc_data_proc (insn_decode_record *arm_insn_r)
{
uint32_t op, op1_ebit, coproc, bits_24_25;
struct gdbarch_tdep *tdep = gdbarch_tdep (arm_insn_r->gdbarch);
arm_gdbarch_tdep *tdep
= (arm_gdbarch_tdep *) gdbarch_tdep (arm_insn_r->gdbarch);
struct regcache *reg_cache = arm_insn_r->regcache;
arm_insn_r->opcode = bits (arm_insn_r->arm_insn, 24, 27);
@ -12354,7 +12374,8 @@ thumb_record_misc (insn_decode_record *thumb_insn_r)
static int
thumb_record_ldm_stm_swi (insn_decode_record *thumb_insn_r)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (thumb_insn_r->gdbarch);
arm_gdbarch_tdep *tdep
= (arm_gdbarch_tdep *) gdbarch_tdep (thumb_insn_r->gdbarch);
struct regcache *reg_cache = thumb_insn_r->regcache;
uint32_t ret = 0; /* function return value: -1:record failure ; 0:success */

View File

@ -87,69 +87,70 @@ enum struct_return
};
/* Target-dependent structure in gdbarch. */
struct gdbarch_tdep
struct arm_gdbarch_tdep : gdbarch_tdep
{
/* The ABI for this architecture. It should never be set to
ARM_ABI_AUTO. */
enum arm_abi_kind arm_abi;
enum arm_abi_kind arm_abi {};
enum arm_float_model fp_model; /* Floating point calling conventions. */
enum arm_float_model fp_model {}; /* Floating point calling conventions. */
bool have_fpa_registers; /* Does the target report the FPA registers? */
bool have_wmmx_registers; /* Does the target report the WMMX registers? */
bool have_fpa_registers = false; /* Does the target report the FPA registers? */
bool have_wmmx_registers = false; /* Does the target report the WMMX registers? */
/* The number of VFP registers reported by the target. It is zero
if VFP registers are not supported. */
int vfp_register_count;
bool have_s_pseudos; /* Are we synthesizing the single precision
int vfp_register_count = 0;
bool have_s_pseudos = false; /* Are we synthesizing the single precision
VFP registers? */
int s_pseudo_base; /* Register number for the first S pseudo
int s_pseudo_base = 0; /* Register number for the first S pseudo
register. */
int s_pseudo_count; /* Number of S pseudo registers. */
bool have_q_pseudos; /* Are we synthesizing the quad precision
int s_pseudo_count = 0; /* Number of S pseudo registers. */
bool have_q_pseudos = false; /* Are we synthesizing the quad precision
Q (NEON or MVE) registers? Requires
have_s_pseudos. */
int q_pseudo_base; /* Register number for the first quad
int q_pseudo_base = 0; /* Register number for the first quad
precision pseudo register. */
int q_pseudo_count; /* Number of quad precision pseudo
int q_pseudo_count = 0; /* Number of quad precision pseudo
registers. */
bool have_neon; /* Do we have a NEON unit? */
bool have_neon = false; /* Do we have a NEON unit? */
bool have_mve; /* Do we have a MVE extension? */
int mve_vpr_regnum; /* MVE VPR register number. */
int mve_pseudo_base; /* Number of the first MVE pseudo register. */
int mve_pseudo_count; /* Total number of MVE pseudo registers. */
bool have_mve = false; /* Do we have a MVE extension? */
int mve_vpr_regnum = 0; /* MVE VPR register number. */
int mve_pseudo_base = 0; /* Number of the first MVE pseudo register. */
int mve_pseudo_count = 0; /* Total number of MVE pseudo registers. */
bool is_m; /* Does the target follow the "M" profile. */
CORE_ADDR lowest_pc; /* Lowest address at which instructions
bool is_m = false; /* Does the target follow the "M" profile. */
CORE_ADDR lowest_pc = 0; /* Lowest address at which instructions
will appear. */
const gdb_byte *arm_breakpoint; /* Breakpoint pattern for an ARM insn. */
int arm_breakpoint_size; /* And its size. */
const gdb_byte *thumb_breakpoint; /* Breakpoint pattern for a Thumb insn. */
int thumb_breakpoint_size; /* And its size. */
const gdb_byte *arm_breakpoint = nullptr; /* Breakpoint pattern for an ARM insn. */
int arm_breakpoint_size = 0; /* And its size. */
const gdb_byte *thumb_breakpoint = nullptr; /* Breakpoint pattern for a Thumb insn. */
int thumb_breakpoint_size = 0; /* And its size. */
/* If the Thumb breakpoint is an undefined instruction (which is
affected by IT blocks) rather than a BKPT instruction (which is
not), then we need a 32-bit Thumb breakpoint to preserve the
instruction count in IT blocks. */
const gdb_byte *thumb2_breakpoint;
int thumb2_breakpoint_size;
const gdb_byte *thumb2_breakpoint = nullptr;
int thumb2_breakpoint_size = 0;
int jb_pc; /* Offset to PC value in jump buffer.
int jb_pc = 0; /* Offset to PC value in jump buffer.
If this is negative, longjmp support
will be disabled. */
size_t jb_elt_size; /* And the size of each entry in the buf. */
size_t jb_elt_size = 0; /* And the size of each entry in the buf. */
/* Convention for returning structures. */
enum struct_return struct_return;
enum struct_return struct_return {};
/* ISA-specific data types. */
struct type *arm_ext_type;
struct type *neon_double_type;
struct type *neon_quad_type;
struct type *arm_ext_type = nullptr;
struct type *neon_double_type = nullptr;
struct type *neon_quad_type = nullptr;
/* syscall record. */
int (*arm_syscall_record) (struct regcache *regcache, unsigned long svc_number);
int (*arm_syscall_record) (struct regcache *regcache,
unsigned long svc_number) = nullptr;
};
/* Structures used for displaced stepping. */

View File

@ -115,7 +115,7 @@ arm_wince_skip_main_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
static void
arm_wince_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
arm_gdbarch_tdep *tdep = (arm_gdbarch_tdep *) gdbarch_tdep (gdbarch);
windows_init_abi (info, gdbarch);

View File

@ -188,18 +188,18 @@ struct avr_unwind_cache
trad_frame_saved_reg *saved_regs;
};
struct gdbarch_tdep
struct avr_gdbarch_tdep : gdbarch_tdep
{
/* Number of bytes stored to the stack by call instructions.
2 bytes for avr1-5 and avrxmega1-5, 3 bytes for avr6 and avrxmega6-7. */
int call_length;
int call_length = 0;
/* Type for void. */
struct type *void_type;
struct type *void_type = nullptr;
/* Type for a function returning void. */
struct type *func_void_type;
struct type *func_void_type = nullptr;
/* Type for a pointer to a function. Used for the type of PC. */
struct type *pc_type;
struct type *pc_type = nullptr;
};
/* Lookup the name of a register given it's number. */
@ -230,10 +230,14 @@ avr_register_type (struct gdbarch *gdbarch, int reg_nr)
{
if (reg_nr == AVR_PC_REGNUM)
return builtin_type (gdbarch)->builtin_uint32;
avr_gdbarch_tdep *tdep = (avr_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (reg_nr == AVR_PSEUDO_PC_REGNUM)
return gdbarch_tdep (gdbarch)->pc_type;
return tdep->pc_type;
if (reg_nr == AVR_SP_REGNUM)
return builtin_type (gdbarch)->builtin_data_ptr;
return builtin_type (gdbarch)->builtin_uint8;
}
@ -745,13 +749,13 @@ avr_scan_prologue (struct gdbarch *gdbarch, CORE_ADDR pc_beg, CORE_ADDR pc_end,
gdb_assert (vpc < AVR_MAX_PROLOGUE_SIZE);
/* Handle static small stack allocation using rcall or push. */
avr_gdbarch_tdep *tdep = (avr_gdbarch_tdep *) gdbarch_tdep (gdbarch);
while (scan_stage == 1 && vpc < len)
{
insn = extract_unsigned_integer (&prologue[vpc], 2, byte_order);
if (insn == 0xd000) /* rcall .+0 */
{
info->size += gdbarch_tdep (gdbarch)->call_length;
info->size += tdep->call_length;
vpc += 2;
}
else if (insn == 0x920f || insn == 0x921f) /* push r0 or push r1 */
@ -984,7 +988,6 @@ avr_frame_unwind_cache (struct frame_info *this_frame,
ULONGEST this_base;
struct avr_unwind_cache *info;
struct gdbarch *gdbarch;
struct gdbarch_tdep *tdep;
int i;
if (*this_prologue_cache)
@ -1049,7 +1052,7 @@ avr_frame_unwind_cache (struct frame_info *this_frame,
/* The previous frame's SP needed to be computed. Save the computed
value. */
tdep = gdbarch_tdep (gdbarch);
avr_gdbarch_tdep *tdep = (avr_gdbarch_tdep *) gdbarch_tdep (gdbarch);
info->saved_regs[AVR_SP_REGNUM].set_value (info->prev_sp
- 1 + tdep->call_length);
@ -1131,7 +1134,7 @@ avr_frame_prev_register (struct frame_info *this_frame,
int i;
gdb_byte buf[3];
struct gdbarch *gdbarch = get_frame_arch (this_frame);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
avr_gdbarch_tdep *tdep = (avr_gdbarch_tdep *) gdbarch_tdep (gdbarch);
read_memory (info->saved_regs[AVR_PC_REGNUM].addr (),
buf, tdep->call_length);
@ -1273,7 +1276,8 @@ avr_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
{
int i;
gdb_byte buf[3];
int call_length = gdbarch_tdep (gdbarch)->call_length;
avr_gdbarch_tdep *tdep = (avr_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int call_length = tdep->call_length;
CORE_ADDR return_pc = avr_convert_iaddr_to_raw (bp_addr);
int regnum = AVR_ARGN_REGNUM;
struct stack_item *si = NULL;
@ -1424,7 +1428,6 @@ static struct gdbarch *
avr_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
struct gdbarch *gdbarch;
struct gdbarch_tdep *tdep;
struct gdbarch_list *best_arch;
int call_length;
@ -1456,12 +1459,15 @@ avr_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
best_arch != NULL;
best_arch = gdbarch_list_lookup_by_info (best_arch->next, &info))
{
if (gdbarch_tdep (best_arch->gdbarch)->call_length == call_length)
avr_gdbarch_tdep *tdep
= (avr_gdbarch_tdep *) gdbarch_tdep (best_arch->gdbarch);
if (tdep->call_length == call_length)
return best_arch->gdbarch;
}
/* None found, create a new architecture from the information provided. */
tdep = XCNEW (struct gdbarch_tdep);
avr_gdbarch_tdep *tdep = new avr_gdbarch_tdep;
gdbarch = gdbarch_alloc (&info, tdep);
tdep->call_length = call_length;

View File

@ -766,7 +766,8 @@ bfin_frame_align (struct gdbarch *gdbarch, CORE_ADDR address)
enum bfin_abi
bfin_abi (struct gdbarch *gdbarch)
{
return gdbarch_tdep (gdbarch)->bfin_abi;
bfin_gdbarch_tdep *tdep = (bfin_gdbarch_tdep *) gdbarch_tdep (gdbarch);
return tdep->bfin_abi;
}
/* Initialize the current architecture based on INFO. If possible,
@ -779,7 +780,6 @@ bfin_abi (struct gdbarch *gdbarch)
static struct gdbarch *
bfin_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
struct gdbarch_tdep *tdep;
struct gdbarch *gdbarch;
enum bfin_abi abi;
@ -791,12 +791,16 @@ bfin_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
arches != NULL;
arches = gdbarch_list_lookup_by_info (arches->next, &info))
{
if (gdbarch_tdep (arches->gdbarch)->bfin_abi != abi)
bfin_gdbarch_tdep *tdep
= (bfin_gdbarch_tdep *) gdbarch_tdep (arches->gdbarch);
if (tdep->bfin_abi != abi)
continue;
return arches->gdbarch;
}
tdep = XCNEW (struct gdbarch_tdep);
bfin_gdbarch_tdep *tdep = new bfin_gdbarch_tdep;
gdbarch = gdbarch_alloc (&info, tdep);
tdep->bfin_abi = abi;

View File

@ -94,10 +94,10 @@ enum bfin_abi
};
/* Target-dependent structure in gdbarch. */
struct gdbarch_tdep
struct bfin_gdbarch_tdep : gdbarch_tdep
{
/* Which ABI is in use? */
enum bfin_abi bfin_abi;
enum bfin_abi bfin_abi {};
};
/* Return the Blackfin ABI associated with GDBARCH. */

View File

@ -57,7 +57,7 @@ enum bpf_regnum
#define BPF_NUM_REGS (BPF_PC_REGNUM + 1)
/* Target-dependent structure in gdbarch. */
struct gdbarch_tdep
struct bpf_gdbarch_tdep : gdbarch_tdep
{
};
@ -321,7 +321,7 @@ bpf_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
return arches->gdbarch;
/* Allocate space for the new architecture. */
struct gdbarch_tdep *tdep = XCNEW (struct gdbarch_tdep);
bpf_gdbarch_tdep *tdep = new bpf_gdbarch_tdep;
struct gdbarch *gdbarch = gdbarch_alloc (&info, tdep);
/* Information about registers, etc. */

View File

@ -33,7 +33,7 @@
static void
cris_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
cris_gdbarch_tdep *tdep = (cris_gdbarch_tdep *) gdbarch_tdep (gdbarch);
linux_init_abi (info, gdbarch, 0);

View File

@ -313,7 +313,7 @@ cris_sigtramp_frame_unwind_cache (struct frame_info *this_frame,
void **this_cache)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
cris_gdbarch_tdep *tdep = (cris_gdbarch_tdep *) gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct cris_unwind_cache *info;
CORE_ADDR addr;
@ -450,7 +450,7 @@ static int
crisv32_single_step_through_delay (struct gdbarch *gdbarch,
struct frame_info *this_frame)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
cris_gdbarch_tdep *tdep = (cris_gdbarch_tdep *) gdbarch_tdep (gdbarch);
ULONGEST erp;
int ret = 0;
@ -695,7 +695,7 @@ cris_frame_unwind_cache (struct frame_info *this_frame,
void **this_prologue_cache)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
cris_gdbarch_tdep *tdep = (cris_gdbarch_tdep *) gdbarch_tdep (gdbarch);
struct cris_unwind_cache *info;
if ((*this_prologue_cache))
@ -1333,7 +1333,7 @@ crisv32_scan_prologue (CORE_ADDR pc, struct frame_info *this_frame,
static CORE_ADDR
cris_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
cris_gdbarch_tdep *tdep = (cris_gdbarch_tdep *) gdbarch_tdep (gdbarch);
CORE_ADDR func_addr, func_end;
struct symtab_and_line sal;
CORE_ADDR pc_after_prologue;
@ -1368,7 +1368,7 @@ cris_breakpoint_kind_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr)
static const gdb_byte *
cris_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
cris_gdbarch_tdep *tdep = (cris_gdbarch_tdep *) gdbarch_tdep (gdbarch);
static unsigned char break8_insn[] = {0x38, 0xe9};
static unsigned char break15_insn[] = {0x3f, 0xe9};
@ -1387,7 +1387,7 @@ static int
cris_spec_reg_applicable (struct gdbarch *gdbarch,
struct cris_spec_reg spec_reg)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
cris_gdbarch_tdep *tdep = (cris_gdbarch_tdep *) gdbarch_tdep (gdbarch);
unsigned int version = tdep->cris_version;
switch (spec_reg.applicable_version)
@ -3766,7 +3766,7 @@ cris_supply_gregset (const struct regset *regset, struct regcache *regcache,
int regnum, const void *gregs, size_t len)
{
struct gdbarch *gdbarch = regcache->arch ();
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
cris_gdbarch_tdep *tdep = (cris_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int i;
const cris_elf_greg_t *regp = static_cast<const cris_elf_greg_t *>(gregs);
@ -3860,7 +3860,7 @@ Makes GDB use the NRP register instead of the ERP register in certain cases."),
static void
cris_dump_tdep (struct gdbarch *gdbarch, struct ui_file *file)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
cris_gdbarch_tdep *tdep = (cris_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (tdep != NULL)
{
fprintf_unfiltered (file, "cris_dump_tdep: tdep->cris_version = %i\n",
@ -3914,7 +3914,6 @@ static struct gdbarch *
cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
struct gdbarch *gdbarch;
struct gdbarch_tdep *tdep;
unsigned int cris_version;
if (usr_cmd_cris_version_valid)
@ -3940,17 +3939,17 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
arches != NULL;
arches = gdbarch_list_lookup_by_info (arches->next, &info))
{
if ((gdbarch_tdep (arches->gdbarch)->cris_version
== usr_cmd_cris_version)
&& (gdbarch_tdep (arches->gdbarch)->cris_mode
== usr_cmd_cris_mode)
&& (gdbarch_tdep (arches->gdbarch)->cris_dwarf2_cfi
== usr_cmd_cris_dwarf2_cfi))
cris_gdbarch_tdep *tdep
= (cris_gdbarch_tdep *) gdbarch_tdep (arches->gdbarch);
if (tdep->cris_version == usr_cmd_cris_version
&& tdep->cris_mode == usr_cmd_cris_mode
&& tdep->cris_dwarf2_cfi == usr_cmd_cris_dwarf2_cfi)
return arches->gdbarch;
}
/* No matching architecture was found. Create a new one. */
tdep = XCNEW (struct gdbarch_tdep);
cris_gdbarch_tdep *tdep = new cris_gdbarch_tdep;
info.byte_order = BFD_ENDIAN_LITTLE;
gdbarch = gdbarch_alloc (&info, tdep);

View File

@ -24,11 +24,11 @@
#define CRIS_TDEP_H
/* CRIS architecture specific information. */
struct gdbarch_tdep
struct cris_gdbarch_tdep : gdbarch_tdep
{
unsigned int cris_version;
const char *cris_mode;
int cris_dwarf2_cfi;
unsigned int cris_version = 0;
const char *cris_mode = nullptr;
int cris_dwarf2_cfi = 0;
};
#endif /* CRIS_TDEP_H */

View File

@ -2164,7 +2164,6 @@ static struct gdbarch *
csky_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
struct gdbarch *gdbarch;
struct gdbarch_tdep *tdep;
/* Find a candidate among the list of pre-declared architectures. */
arches = gdbarch_list_lookup_by_info (arches, &info);
@ -2173,7 +2172,7 @@ csky_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* None found, create a new architecture from the information
provided. */
tdep = XCNEW (struct gdbarch_tdep);
csky_gdbarch_tdep *tdep = new csky_gdbarch_tdep;
gdbarch = gdbarch_alloc (&info, tdep);
/* Target data types. */

View File

@ -29,7 +29,7 @@ enum lr_type_t
};
/* Target-dependent structure in gdbarch. */
struct gdbarch_tdep
struct csky_gdbarch_tdep : gdbarch_tdep
{
/* This is Unused. */
};

View File

@ -67,32 +67,33 @@ struct frv_unwind_cache /* was struct frame_extra_info */
of structures, each of which gives all the necessary info for one
register. Don't stick parallel arrays in here --- that's so
Fortran. */
struct gdbarch_tdep
struct frv_gdbarch_tdep : gdbarch_tdep
{
/* Which ABI is in use? */
enum frv_abi frv_abi;
enum frv_abi frv_abi {};
/* How many general-purpose registers does this variant have? */
int num_gprs;
int num_gprs = 0;
/* How many floating-point registers does this variant have? */
int num_fprs;
int num_fprs = 0;
/* How many hardware watchpoints can it support? */
int num_hw_watchpoints;
int num_hw_watchpoints = 0;
/* How many hardware breakpoints can it support? */
int num_hw_breakpoints;
int num_hw_breakpoints = 0;
/* Register names. */
const char **register_names;
const char **register_names = nullptr;
};
/* Return the FR-V ABI associated with GDBARCH. */
enum frv_abi
frv_abi (struct gdbarch *gdbarch)
{
return gdbarch_tdep (gdbarch)->frv_abi;
frv_gdbarch_tdep *tdep = (frv_gdbarch_tdep *) gdbarch_tdep (gdbarch);
return tdep->frv_abi;
}
/* Fetch the interpreter and executable loadmap addresses (for shared
@ -128,13 +129,12 @@ frv_fdpic_loadmap_addresses (struct gdbarch *gdbarch, CORE_ADDR *interp_addr,
/* Allocate a new variant structure, and set up default values for all
the fields. */
static struct gdbarch_tdep *
static frv_gdbarch_tdep *
new_variant (void)
{
struct gdbarch_tdep *var;
int r;
var = XCNEW (struct gdbarch_tdep);
frv_gdbarch_tdep *var = new frv_gdbarch_tdep;
var->frv_abi = FRV_ABI_EABI;
var->num_gprs = 64;
@ -219,7 +219,7 @@ new_variant (void)
/* Indicate that the variant VAR has NUM_GPRS general-purpose
registers, and fill in the names array appropriately. */
static void
set_variant_num_gprs (struct gdbarch_tdep *var, int num_gprs)
set_variant_num_gprs (frv_gdbarch_tdep *var, int num_gprs)
{
int r;
@ -238,7 +238,7 @@ set_variant_num_gprs (struct gdbarch_tdep *var, int num_gprs)
/* Indicate that the variant VAR has NUM_FPRS floating-point
registers, and fill in the names array appropriately. */
static void
set_variant_num_fprs (struct gdbarch_tdep *var, int num_fprs)
set_variant_num_fprs (frv_gdbarch_tdep *var, int num_fprs)
{
int r;
@ -254,7 +254,7 @@ set_variant_num_fprs (struct gdbarch_tdep *var, int num_fprs)
}
static void
set_variant_abi_fdpic (struct gdbarch_tdep *var)
set_variant_abi_fdpic (frv_gdbarch_tdep *var)
{
var->frv_abi = FRV_ABI_FDPIC;
var->register_names[fdpic_loadmap_exec_regnum] = xstrdup ("loadmap_exec");
@ -263,7 +263,7 @@ set_variant_abi_fdpic (struct gdbarch_tdep *var)
}
static void
set_variant_scratch_registers (struct gdbarch_tdep *var)
set_variant_scratch_registers (frv_gdbarch_tdep *var)
{
var->register_names[scr0_regnum] = xstrdup ("scr0");
var->register_names[scr1_regnum] = xstrdup ("scr1");
@ -276,10 +276,12 @@ frv_register_name (struct gdbarch *gdbarch, int reg)
{
if (reg < 0)
return "?toosmall?";
if (reg >= frv_num_regs + frv_num_pseudo_regs)
return "?toolarge?";
return gdbarch_tdep (gdbarch)->register_names[reg];
frv_gdbarch_tdep *tdep = (frv_gdbarch_tdep *) gdbarch_tdep (gdbarch);
return tdep->register_names[reg];
}
@ -1439,7 +1441,6 @@ static struct gdbarch *
frv_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
struct gdbarch *gdbarch;
struct gdbarch_tdep *var;
int elf_flags = 0;
/* Check to see if we've already built an appropriate architecture
@ -1449,7 +1450,7 @@ frv_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
return arches->gdbarch;
/* Select the right tdep structure for this variant. */
var = new_variant ();
frv_gdbarch_tdep *var = new_variant ();
switch (info.bfd_arch_info->mach)
{
case bfd_mach_frv:

View File

@ -109,7 +109,10 @@ static struct type *
ft32_register_type (struct gdbarch *gdbarch, int reg_nr)
{
if (reg_nr == FT32_PC_REGNUM)
return gdbarch_tdep (gdbarch)->pc_type;
{
ft32_gdbarch_tdep *tdep = (ft32_gdbarch_tdep *) gdbarch_tdep (gdbarch);
return tdep->pc_type;
}
else if (reg_nr == FT32_SP_REGNUM || reg_nr == FT32_FP_REGNUM)
return builtin_type (gdbarch)->builtin_data_ptr;
else
@ -559,7 +562,6 @@ static struct gdbarch *
ft32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
struct gdbarch *gdbarch;
struct gdbarch_tdep *tdep;
struct type *void_type;
struct type *func_void_type;
@ -569,7 +571,7 @@ ft32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
return arches->gdbarch;
/* Allocate space for the new architecture. */
tdep = XCNEW (struct gdbarch_tdep);
ft32_gdbarch_tdep *tdep = new ft32_gdbarch_tdep;
gdbarch = gdbarch_alloc (&info, tdep);
/* Create a type for PC. We can't use builtin types here, as they may not

View File

@ -20,10 +20,10 @@
#ifndef FT32_TDEP_H
#define FT32_TDEP_H
struct gdbarch_tdep
struct ft32_gdbarch_tdep : gdbarch_tdep
{
/* Type for a pointer to a function. Used for the type of PC. */
struct type *pc_type;
struct type *pc_type = nullptr;
};
#endif /* FT32_TDEP_H */

View File

@ -62,6 +62,8 @@ struct inferior;
#include "regcache.h"
struct gdbarch_tdep {};
/* The architecture associated with the inferior through the
connection to the target.

View File

@ -1333,6 +1333,8 @@ struct inferior;
#include "regcache.h"
struct gdbarch_tdep {};
/* The architecture associated with the inferior through the
connection to the target.

View File

@ -118,7 +118,7 @@ hppabsd_dwarf2_frame_init_reg (struct gdbarch *gdbarch, int regnum,
void
hppabsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
hppa_gdbarch_tdep *tdep = (hppa_gdbarch_tdep *) gdbarch_tdep (gdbarch);
/* OpenBSD and NetBSD have a 64-bit 'long double'. */
set_gdbarch_long_double_bit (gdbarch, 64);

View File

@ -476,7 +476,7 @@ hppa_linux_iterate_over_regset_sections (struct gdbarch *gdbarch,
void *cb_data,
const struct regcache *regcache)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
hppa_gdbarch_tdep *tdep = (hppa_gdbarch_tdep *) gdbarch_tdep (gdbarch);
cb (".reg", 80 * tdep->bytes_per_address, 80 * tdep->bytes_per_address,
&hppa_linux_regset, NULL, cb_data);
@ -486,7 +486,7 @@ hppa_linux_iterate_over_regset_sections (struct gdbarch *gdbarch,
static void
hppa_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
hppa_gdbarch_tdep *tdep = (hppa_gdbarch_tdep *) gdbarch_tdep (gdbarch);
linux_init_abi (info, gdbarch, 0);

View File

@ -259,6 +259,7 @@ internalize_unwinds (struct objfile *objfile, struct unwind_table_entry *table,
if (size > 0)
{
struct gdbarch *gdbarch = objfile->arch ();
hppa_gdbarch_tdep *tdep = (hppa_gdbarch_tdep *) gdbarch_tdep (gdbarch);
unsigned long tmp;
unsigned i;
char *buf = (char *) alloca (size);
@ -270,7 +271,7 @@ internalize_unwinds (struct objfile *objfile, struct unwind_table_entry *table,
Note that when loading a shared library (text_offset != 0) the
unwinds are already relative to the text_offset that will be
passed in. */
if (gdbarch_tdep (gdbarch)->is_elf && text_offset == 0)
if (tdep->is_elf && text_offset == 0)
{
low_text_segment_address = -1;
@ -280,9 +281,9 @@ internalize_unwinds (struct objfile *objfile, struct unwind_table_entry *table,
text_offset = low_text_segment_address;
}
else if (gdbarch_tdep (gdbarch)->solib_get_text_base)
else if (tdep->solib_get_text_base)
{
text_offset = gdbarch_tdep (gdbarch)->solib_get_text_base (objfile);
text_offset = tdep->solib_get_text_base (objfile);
}
bfd_get_section_contents (objfile->obfd, section, buf, 0, size);
@ -730,7 +731,7 @@ hppa32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* Global pointer (r19) of the function we are trying to call. */
CORE_ADDR gp;
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
hppa_gdbarch_tdep *tdep = (hppa_gdbarch_tdep *) gdbarch_tdep (gdbarch);
for (write_pass = 0; write_pass < 2; write_pass++)
{
@ -967,7 +968,7 @@ hppa64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
function_call_return_method return_method,
CORE_ADDR struct_addr)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
hppa_gdbarch_tdep *tdep = (hppa_gdbarch_tdep *) gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int i, offset = 0;
CORE_ADDR gp;
@ -2253,9 +2254,7 @@ hppa_frame_cache (struct frame_info *this_frame, void **this_cache)
}
{
struct gdbarch_tdep *tdep;
tdep = gdbarch_tdep (gdbarch);
hppa_gdbarch_tdep *tdep = (hppa_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (tdep->unwind_adjust_stub)
tdep->unwind_adjust_stub (this_frame, cache->base, cache->saved_regs);
@ -2485,7 +2484,7 @@ hppa_stub_unwind_sniffer (const struct frame_unwind *self,
{
CORE_ADDR pc = get_frame_address_in_block (this_frame);
struct gdbarch *gdbarch = get_frame_arch (this_frame);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
hppa_gdbarch_tdep *tdep = (hppa_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (pc == 0
|| (tdep->in_solib_call_trampoline != NULL
@ -3029,7 +3028,6 @@ hppa_skip_trampoline_code (struct frame_info *frame, CORE_ADDR pc)
static struct gdbarch *
hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
struct gdbarch_tdep *tdep;
struct gdbarch *gdbarch;
/* find a candidate among the list of pre-declared architectures. */
@ -3038,7 +3036,7 @@ hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
return (arches->gdbarch);
/* If none found, then allocate and initialize one. */
tdep = XCNEW (struct gdbarch_tdep);
hppa_gdbarch_tdep *tdep = new hppa_gdbarch_tdep;
gdbarch = gdbarch_alloc (&info, tdep);
/* Determine from the bfd_arch_info structure if we are dealing with
@ -3162,7 +3160,7 @@ hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
static void
hppa_dump_tdep (struct gdbarch *gdbarch, struct ui_file *file)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
hppa_gdbarch_tdep *tdep = (hppa_gdbarch_tdep *) gdbarch_tdep (gdbarch);
fprintf_unfiltered (file, "bytes_per_address = %d\n",
tdep->bytes_per_address);

View File

@ -20,6 +20,8 @@
#ifndef HPPA_TDEP_H
#define HPPA_TDEP_H
#include "gdbarch.h"
struct trad_frame_saved_reg;
struct objfile;
struct so_list;
@ -82,24 +84,25 @@ enum hppa_regnum
#define HPPA_INSN_SIZE 4
/* Target-dependent structure in gdbarch. */
struct gdbarch_tdep
struct hppa_gdbarch_tdep : gdbarch_tdep
{
/* The number of bytes in an address. For now, this field is designed
to allow us to differentiate hppa32 from hppa64 targets. */
int bytes_per_address;
int bytes_per_address = 0;
/* Is this an ELF target? This can be 64-bit HP-UX, or a 32/64-bit GNU/Linux
system. */
int is_elf;
int is_elf = 0;
/* Given a function address, try to find the global pointer for the
corresponding shared object. */
CORE_ADDR (*find_global_pointer) (struct gdbarch *, struct value *);
CORE_ADDR (*find_global_pointer) (struct gdbarch *, struct value *) = nullptr;
/* For shared libraries, each call goes through a small piece of
trampoline code in the ".plt" section. IN_SOLIB_CALL_TRAMPOLINE
evaluates to nonzero if we are currently stopped in one of these. */
int (*in_solib_call_trampoline) (struct gdbarch *gdbarch, CORE_ADDR pc);
int (*in_solib_call_trampoline) (struct gdbarch *gdbarch,
CORE_ADDR pc) = nullptr;
/* For targets that support multiple spaces, we may have additional stubs
in the return path. These stubs are internal to the ABI, and users are
@ -107,14 +110,14 @@ struct gdbarch_tdep
adjust the pc to the real caller. This improves the behavior of commands
that traverse frames such as "up" and "finish". */
void (*unwind_adjust_stub) (struct frame_info *this_frame, CORE_ADDR base,
trad_frame_saved_reg *saved_regs);
trad_frame_saved_reg *saved_regs) = nullptr;
/* These are solib-dependent methods. They are really HPUX only, but
we don't have a HPUX-specific tdep vector at the moment. */
CORE_ADDR (*solib_thread_start_addr) (struct so_list *so);
CORE_ADDR (*solib_get_got_by_pc) (CORE_ADDR addr);
CORE_ADDR (*solib_get_solib_by_pc) (CORE_ADDR addr);
CORE_ADDR (*solib_get_text_base) (struct objfile *objfile);
CORE_ADDR (*solib_thread_start_addr) (struct so_list *so) = nullptr;
CORE_ADDR (*solib_get_got_by_pc) (CORE_ADDR addr) = nullptr;
CORE_ADDR (*solib_get_solib_by_pc) (CORE_ADDR addr) = nullptr;
CORE_ADDR (*solib_get_text_base) (struct objfile *objfile) = nullptr;
};
/*

View File

@ -74,7 +74,7 @@ int i386bsd_sc_reg_offset[] =
void
i386bsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
tdep->jb_pc_offset = 0;

View File

@ -156,7 +156,7 @@ i386_darwin_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
function_call_return_method return_method,
CORE_ADDR struct_addr)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
gdb_byte buf[4];
int i;
@ -248,7 +248,7 @@ i386_darwin_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
static void
i386_darwin_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
/* We support the SSE registers. */
tdep->num_xmm_regs = I386_NUM_XREGS - 1;

View File

@ -308,7 +308,7 @@ i386fbsd_iterate_over_regset_sections (struct gdbarch *gdbarch,
void *cb_data,
const struct regcache *regcache)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
cb (".reg", tdep->sizeof_gregset, tdep->sizeof_gregset, &i386_gregset, NULL,
cb_data);
@ -327,7 +327,7 @@ static CORE_ADDR
i386fbsd_get_thread_local_address (struct gdbarch *gdbarch, ptid_t ptid,
CORE_ADDR lm_addr, CORE_ADDR offset)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
struct regcache *regcache;
if (tdep->fsbase_regnum == -1)
@ -349,7 +349,7 @@ i386fbsd_get_thread_local_address (struct gdbarch *gdbarch, ptid_t ptid,
static void
i386fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
/* Obviously FreeBSD is BSD-based. */
i386bsd_init_abi (info, gdbarch);
@ -418,7 +418,7 @@ int i386fbsd4_sc_reg_offset[] =
static void
i386fbsd4_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
/* Generic FreeBSD support. */
fbsd_init_abi (info, gdbarch);

View File

@ -173,7 +173,7 @@ static int i386gnu_gregset_reg_offset[] =
static void
i386gnu_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
/* GNU uses ELF. */
i386_elf_init_abi (info, gdbarch);

View File

@ -26,7 +26,7 @@
static void
i386_go32_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
/* DJGPP doesn't have any special frames for signal handlers. */
tdep->sigtramp_p = NULL;

View File

@ -762,7 +762,7 @@ i386_linux_iterate_over_regset_sections (struct gdbarch *gdbarch,
void *cb_data,
const struct regcache *regcache)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
cb (".reg", 68, 68, &i386_gregset, NULL, cb_data);
@ -824,7 +824,7 @@ i386_linux_displaced_step_copy_insn (struct gdbarch *gdbarch,
static void
i386_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
const struct target_desc *tdesc = info.target_desc;
struct tdesc_arch_data *tdesc_data = info.tdesc_data;
const struct tdesc_feature *feature;

View File

@ -372,7 +372,7 @@ i386nbsd_sigtramp_cache_init (const struct tramp_frame *self,
static void
i386nbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
/* Obviously NetBSD is BSD-based. */
i386bsd_init_abi (info, gdbarch);
@ -407,7 +407,7 @@ i386nbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
static void
i386nbsdelf_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
/* It's still NetBSD. */
i386nbsd_init_abi (info, gdbarch);

View File

@ -77,7 +77,7 @@ static void
i386nto_supply_gregset (struct regcache *regcache, char *gpregs)
{
struct gdbarch *gdbarch = regcache->arch ();
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
gdb_assert (tdep->gregset_reg_offset == i386nto_gregset_reg_offset);
i386_gregset.supply_regset (&i386_gregset, regcache, -1,
@ -126,7 +126,7 @@ static int
i386nto_register_area (struct gdbarch *gdbarch,
int regno, int regset, unsigned *off)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
*off = 0;
if (regset == NTO_REG_GENERAL)
@ -315,7 +315,7 @@ init_i386nto_ops (void)
static void
i386nto_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
static struct target_so_ops nto_svr4_so_ops;
/* Deal with our strange signals. */

View File

@ -407,7 +407,7 @@ static const struct frame_unwind i386obsd_trapframe_unwind = {
static void
i386obsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
/* Obviously OpenBSD is BSD-based. */
i386bsd_init_abi (info, gdbarch);

View File

@ -65,7 +65,7 @@ i386_sol2_mcontext_addr (struct frame_info *this_frame)
static void
i386_sol2_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
/* Solaris is SVR4-based. */
i386_svr4_init_abi (info, gdbarch);

View File

@ -167,7 +167,7 @@ const int num_lower_zmm_regs = 16;
static int
i386_mmx_regnum_p (struct gdbarch *gdbarch, int regnum)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int mm0_regnum = tdep->mm0_regnum;
if (mm0_regnum < 0)
@ -182,7 +182,7 @@ i386_mmx_regnum_p (struct gdbarch *gdbarch, int regnum)
int
i386_byte_regnum_p (struct gdbarch *gdbarch, int regnum)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
regnum -= tdep->al_regnum;
return regnum >= 0 && regnum < tdep->num_byte_regs;
@ -193,7 +193,7 @@ i386_byte_regnum_p (struct gdbarch *gdbarch, int regnum)
int
i386_word_regnum_p (struct gdbarch *gdbarch, int regnum)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
regnum -= tdep->ax_regnum;
return regnum >= 0 && regnum < tdep->num_word_regs;
@ -204,7 +204,7 @@ i386_word_regnum_p (struct gdbarch *gdbarch, int regnum)
int
i386_dword_regnum_p (struct gdbarch *gdbarch, int regnum)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int eax_regnum = tdep->eax_regnum;
if (eax_regnum < 0)
@ -219,7 +219,7 @@ i386_dword_regnum_p (struct gdbarch *gdbarch, int regnum)
int
i386_zmmh_regnum_p (struct gdbarch *gdbarch, int regnum)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int zmm0h_regnum = tdep->zmm0h_regnum;
if (zmm0h_regnum < 0)
@ -232,7 +232,7 @@ i386_zmmh_regnum_p (struct gdbarch *gdbarch, int regnum)
int
i386_zmm_regnum_p (struct gdbarch *gdbarch, int regnum)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int zmm0_regnum = tdep->zmm0_regnum;
if (zmm0_regnum < 0)
@ -245,7 +245,7 @@ i386_zmm_regnum_p (struct gdbarch *gdbarch, int regnum)
int
i386_k_regnum_p (struct gdbarch *gdbarch, int regnum)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int k0_regnum = tdep->k0_regnum;
if (k0_regnum < 0)
@ -258,7 +258,7 @@ i386_k_regnum_p (struct gdbarch *gdbarch, int regnum)
static int
i386_ymmh_regnum_p (struct gdbarch *gdbarch, int regnum)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int ymm0h_regnum = tdep->ymm0h_regnum;
if (ymm0h_regnum < 0)
@ -273,7 +273,7 @@ i386_ymmh_regnum_p (struct gdbarch *gdbarch, int regnum)
int
i386_ymm_regnum_p (struct gdbarch *gdbarch, int regnum)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int ymm0_regnum = tdep->ymm0_regnum;
if (ymm0_regnum < 0)
@ -286,7 +286,7 @@ i386_ymm_regnum_p (struct gdbarch *gdbarch, int regnum)
static int
i386_ymmh_avx512_regnum_p (struct gdbarch *gdbarch, int regnum)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int ymm16h_regnum = tdep->ymm16h_regnum;
if (ymm16h_regnum < 0)
@ -299,7 +299,7 @@ i386_ymmh_avx512_regnum_p (struct gdbarch *gdbarch, int regnum)
int
i386_ymm_avx512_regnum_p (struct gdbarch *gdbarch, int regnum)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int ymm16_regnum = tdep->ymm16_regnum;
if (ymm16_regnum < 0)
@ -314,7 +314,7 @@ i386_ymm_avx512_regnum_p (struct gdbarch *gdbarch, int regnum)
int
i386_bnd_regnum_p (struct gdbarch *gdbarch, int regnum)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int bnd0_regnum = tdep->bnd0_regnum;
if (bnd0_regnum < 0)
@ -329,7 +329,7 @@ i386_bnd_regnum_p (struct gdbarch *gdbarch, int regnum)
int
i386_xmm_regnum_p (struct gdbarch *gdbarch, int regnum)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int num_xmm_regs = I387_NUM_XMM_REGS (tdep);
if (num_xmm_regs == 0)
@ -344,7 +344,7 @@ i386_xmm_regnum_p (struct gdbarch *gdbarch, int regnum)
int
i386_xmm_avx512_regnum_p (struct gdbarch *gdbarch, int regnum)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int num_xmm_avx512_regs = I387_NUM_XMM_AVX512_REGS (tdep);
if (num_xmm_avx512_regs == 0)
@ -357,7 +357,7 @@ i386_xmm_avx512_regnum_p (struct gdbarch *gdbarch, int regnum)
static int
i386_mxcsr_regnum_p (struct gdbarch *gdbarch, int regnum)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (I387_NUM_XMM_REGS (tdep) == 0)
return 0;
@ -370,7 +370,7 @@ i386_mxcsr_regnum_p (struct gdbarch *gdbarch, int regnum)
int
i386_fp_regnum_p (struct gdbarch *gdbarch, int regnum)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (I387_ST0_REGNUM (tdep) < 0)
return 0;
@ -382,7 +382,7 @@ i386_fp_regnum_p (struct gdbarch *gdbarch, int regnum)
int
i386_fpc_regnum_p (struct gdbarch *gdbarch, int regnum)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (I387_ST0_REGNUM (tdep) < 0)
return 0;
@ -396,7 +396,7 @@ i386_fpc_regnum_p (struct gdbarch *gdbarch, int regnum)
static int
i386_bndr_regnum_p (struct gdbarch *gdbarch, int regnum)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (I387_BND0R_REGNUM (tdep) < 0)
return 0;
@ -410,7 +410,7 @@ i386_bndr_regnum_p (struct gdbarch *gdbarch, int regnum)
static int
i386_mpx_ctrl_regnum_p (struct gdbarch *gdbarch, int regnum)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (I387_BNDCFGU_REGNUM (tdep) < 0)
return 0;
@ -424,7 +424,7 @@ i386_mpx_ctrl_regnum_p (struct gdbarch *gdbarch, int regnum)
bool
i386_pkru_regnum_p (struct gdbarch *gdbarch, int regnum)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int pkru_regnum = tdep->pkru_regnum;
if (pkru_regnum < 0)
@ -460,7 +460,7 @@ i386_register_name (struct gdbarch *gdbarch, int regnum)
const char *
i386_pseudo_register_name (struct gdbarch *gdbarch, int regnum)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) 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))
@ -483,7 +483,7 @@ i386_pseudo_register_name (struct gdbarch *gdbarch, int regnum)
static int
i386_dbx_reg_to_regnum (struct gdbarch *gdbarch, int reg)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
/* This implements what GCC calls the "default" register map
(dbx_register_map[]). */
@ -530,7 +530,7 @@ i386_dbx_reg_to_regnum (struct gdbarch *gdbarch, int reg)
static int
i386_svr4_dwarf_reg_to_regnum (struct gdbarch *gdbarch, int reg)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) 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[]). */
@ -2432,7 +2432,7 @@ static struct i386_frame_cache *
i386_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct i386_frame_cache *cache;
CORE_ADDR addr;
@ -2521,7 +2521,8 @@ i386_sigtramp_frame_sniffer (const struct frame_unwind *self,
struct frame_info *this_frame,
void **this_prologue_cache)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (this_frame));
gdbarch *arch = get_frame_arch (this_frame);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (arch);
/* We shouldn't even bother if we don't have a sigcontext_addr
handler. */
@ -2608,7 +2609,8 @@ i386_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc)
CORE_ADDR sp, jb_addr;
struct gdbarch *gdbarch = get_frame_arch (frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int jb_pc_offset = gdbarch_tdep (gdbarch)->jb_pc_offset;
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) 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
longjmp will land. */
@ -2815,7 +2817,7 @@ static void
i386_extract_return_value (struct gdbarch *gdbarch, struct type *type,
struct regcache *regcache, gdb_byte *valbuf)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int len = TYPE_LENGTH (type);
gdb_byte buf[I386_MAX_REGISTER_SIZE];
@ -2873,7 +2875,7 @@ static void
i386_store_return_value (struct gdbarch *gdbarch, struct type *type,
struct regcache *regcache, const gdb_byte *valbuf)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int len = TYPE_LENGTH (type);
if (type->code () == TYPE_CODE_FLT)
@ -2952,7 +2954,7 @@ static const char *struct_convention = default_struct_convention;
static int
i386_reg_struct_return_p (struct gdbarch *gdbarch, struct type *type)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
enum type_code code = type->code ();
int len = TYPE_LENGTH (type);
@ -3054,7 +3056,7 @@ i386_return_value (struct gdbarch *gdbarch, struct value *function,
struct type *
i387_ext_type (struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (!tdep->i387_ext_type)
{
@ -3072,7 +3074,7 @@ i387_ext_type (struct gdbarch *gdbarch)
static struct type *
i386_bnd_type (struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (!tdep->i386_bnd_type)
@ -3108,7 +3110,7 @@ i386_bnd_type (struct gdbarch *gdbarch)
static struct type *
i386_zmm_type (struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (!tdep->i386_zmm_type)
{
@ -3167,7 +3169,7 @@ i386_zmm_type (struct gdbarch *gdbarch)
static struct type *
i386_ymm_type (struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (!tdep->i386_ymm_type)
{
@ -3224,7 +3226,7 @@ i386_ymm_type (struct gdbarch *gdbarch)
static struct type *
i386_mmx_type (struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (!tdep->i386_mmx_type)
{
@ -3300,7 +3302,8 @@ i386_pseudo_register_type (struct gdbarch *gdbarch, int regnum)
static int
i386_mmx_regnum_to_fp_regnum (readable_regcache *regcache, int regnum)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (regcache->arch ());
gdbarch *arch = regcache->arch ();
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (arch);
int mmxreg, fpreg;
ULONGEST fstat;
int tos;
@ -3341,7 +3344,7 @@ i386_pseudo_register_read_into_value (struct gdbarch *gdbarch,
}
else
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (i386_bnd_regnum_p (gdbarch, regnum))
{
regnum -= tdep->bnd0_regnum;
@ -3531,7 +3534,7 @@ i386_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
}
else
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (i386_bnd_regnum_p (gdbarch, regnum))
{
@ -3639,7 +3642,7 @@ int
i386_ax_pseudo_register_collect (struct gdbarch *gdbarch,
struct agent_expr *ax, int regnum)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (i386_mmx_regnum_p (gdbarch, regnum))
{
@ -3856,7 +3859,7 @@ i386_supply_gregset (const struct regset *regset, struct regcache *regcache,
int regnum, const void *gregs, size_t len)
{
struct gdbarch *gdbarch = regcache->arch ();
const struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
const i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
const gdb_byte *regs = (const gdb_byte *) gregs;
int i;
@ -3881,7 +3884,7 @@ i386_collect_gregset (const struct regset *regset,
int regnum, void *gregs, size_t len)
{
struct gdbarch *gdbarch = regcache->arch ();
const struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
const i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
gdb_byte *regs = (gdb_byte *) gregs;
int i;
@ -3904,7 +3907,7 @@ i386_supply_fpregset (const struct regset *regset, struct regcache *regcache,
int regnum, const void *fpregs, size_t len)
{
struct gdbarch *gdbarch = regcache->arch ();
const struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
const i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (len == I387_SIZEOF_FXSAVE)
{
@ -3927,7 +3930,7 @@ i386_collect_fpregset (const struct regset *regset,
int regnum, void *fpregs, size_t len)
{
struct gdbarch *gdbarch = regcache->arch ();
const struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
const i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (len == I387_SIZEOF_FXSAVE)
{
@ -3959,7 +3962,7 @@ i386_iterate_over_regset_sections (struct gdbarch *gdbarch,
void *cb_data,
const struct regcache *regcache)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
cb (".reg", tdep->sizeof_gregset, tdep->sizeof_gregset, &i386_gregset, NULL,
cb_data);
@ -4464,7 +4467,7 @@ i386_elf_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
void
i386_svr4_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
/* System V Release 4 uses ELF. */
i386_elf_init_abi (info, gdbarch);
@ -4513,7 +4516,7 @@ int
i386_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
struct reggroup *group)
{
const struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
const i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) 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,
@ -4958,7 +4961,7 @@ static int i386_record_floats (struct gdbarch *gdbarch,
struct i386_record_s *ir,
uint32_t iregnum)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int i;
/* Oza: Because of floating point insn push/pop of fpu stack is going to
@ -5029,7 +5032,7 @@ i386_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
ULONGEST addr;
gdb_byte buf[I386_MAX_REGISTER_SIZE];
struct i386_record_s ir;
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
uint8_t rex_w = -1;
uint8_t rex_r = 0;
@ -8191,7 +8194,7 @@ i386_floatformat_for_type (struct gdbarch *gdbarch,
}
static int
i386_validate_tdesc_p (struct gdbarch_tdep *tdep,
i386_validate_tdesc_p (i386_gdbarch_tdep *tdep,
struct tdesc_arch_data *tdesc_data)
{
const struct target_desc *tdesc = tdep->tdesc;
@ -8393,7 +8396,6 @@ i386_type_align (struct gdbarch *gdbarch, struct type *type)
static struct gdbarch *
i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
struct gdbarch_tdep *tdep;
struct gdbarch *gdbarch;
const struct target_desc *tdesc;
int mm0_regnum;
@ -8407,7 +8409,7 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
return arches->gdbarch;
/* Allocate space for the new architecture. Assume i386 for now. */
tdep = XCNEW (struct gdbarch_tdep);
i386_gdbarch_tdep *tdep = new i386_gdbarch_tdep;
gdbarch = gdbarch_alloc (&info, tdep);
/* General-purpose registers. */
@ -8651,7 +8653,7 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
if (!i386_validate_tdesc_p (tdep, tdesc_data.get ()))
{
xfree (tdep);
delete tdep;
gdbarch_free (gdbarch);
return NULL;
}
@ -8784,12 +8786,12 @@ static unsigned long
i386_mpx_bd_base (void)
{
struct regcache *rcache;
struct gdbarch_tdep *tdep;
ULONGEST ret;
enum register_status regstatus;
rcache = get_current_regcache ();
tdep = gdbarch_tdep (rcache->arch ());
gdbarch *arch = rcache->arch ();
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (arch);
regstatus = regcache_raw_read_unsigned (rcache, tdep->bndcfgu_regnum, &ret);
@ -8802,7 +8804,8 @@ i386_mpx_bd_base (void)
int
i386_mpx_enabled (void)
{
const struct gdbarch_tdep *tdep = gdbarch_tdep (get_current_arch ());
gdbarch *arch = get_current_arch ();
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (arch);
const struct target_desc *tdesc = tdep->tdesc;
return (tdesc_find_feature (tdesc, "org.gnu.gdb.i386.mpx") != NULL);

View File

@ -57,206 +57,206 @@ enum struct_return
};
/* i386 architecture specific information. */
struct gdbarch_tdep
struct i386_gdbarch_tdep : gdbarch_tdep
{
/* General-purpose registers. */
int *gregset_reg_offset;
int gregset_num_regs;
size_t sizeof_gregset;
int *gregset_reg_offset = 0;
int gregset_num_regs = 0;
size_t sizeof_gregset = 0;
/* Floating-point registers. */
size_t sizeof_fpregset;
size_t sizeof_fpregset = 0;
/* Register number for %st(0). The register numbers for the other
registers follow from this one. Set this to -1 to indicate the
absence of an FPU. */
int st0_regnum;
int st0_regnum = 0;
/* Number of MMX registers. */
int num_mmx_regs;
int num_mmx_regs = 0;
/* Register number for %mm0. Set this to -1 to indicate the absence
of MMX support. */
int mm0_regnum;
int mm0_regnum = 0;
/* Number of pseudo YMM registers. */
int num_ymm_regs;
int num_ymm_regs = 0;
/* Register number for %ymm0. Set this to -1 to indicate the absence
of pseudo YMM register support. */
int ymm0_regnum;
int ymm0_regnum = 0;
/* Number of AVX512 OpMask registers (K-registers) */
int num_k_regs;
int num_k_regs = 0;
/* Register number for %k0. Set this to -1 to indicate the absence
of AVX512 OpMask register support. */
int k0_regnum;
int k0_regnum = 0;
/* Number of pseudo ZMM registers ($zmm0-$zmm31). */
int num_zmm_regs;
int num_zmm_regs = 0;
/* Register number for %zmm0. Set this to -1 to indicate the absence
of pseudo ZMM register support. */
int zmm0_regnum;
int zmm0_regnum = 0;
/* Number of byte registers. */
int num_byte_regs;
int num_byte_regs = 0;
/* Register pseudo number for %al. */
int al_regnum;
int al_regnum = 0;
/* Number of pseudo word registers. */
int num_word_regs;
int num_word_regs = 0;
/* Register number for %ax. */
int ax_regnum;
int ax_regnum = 0;
/* Number of pseudo dword registers. */
int num_dword_regs;
int num_dword_regs = 0;
/* Register number for %eax. Set this to -1 to indicate the absence
of pseudo dword register support. */
int eax_regnum;
int eax_regnum = 0;
/* Number of core registers. */
int num_core_regs;
int num_core_regs = 0;
/* Number of SSE registers. */
int num_xmm_regs;
int num_xmm_regs = 0;
/* Number of SSE registers added in AVX512. */
int num_xmm_avx512_regs;
int num_xmm_avx512_regs = 0;
/* Register number of XMM16, the first XMM register added in AVX512. */
int xmm16_regnum;
int xmm16_regnum = 0;
/* Number of YMM registers added in AVX512. */
int num_ymm_avx512_regs;
int num_ymm_avx512_regs = 0;
/* Register number of YMM16, the first YMM register added in AVX512. */
int ymm16_regnum;
int ymm16_regnum = 0;
/* Bits of the extended control register 0 (the XFEATURE_ENABLED_MASK
register), excluding the x87 bit, which are supported by this GDB. */
uint64_t xcr0;
uint64_t xcr0 = 0;
/* Offset of XCR0 in XSAVE extended state. */
int xsave_xcr0_offset;
int xsave_xcr0_offset = 0;
/* Register names. */
const char * const *register_names;
const char * const *register_names = nullptr;
/* Register number for %ymm0h. Set this to -1 to indicate the absence
of upper YMM register support. */
int ymm0h_regnum;
int ymm0h_regnum = 0;
/* Upper YMM register names. Only used for tdesc_numbered_register. */
const char * const *ymmh_register_names;
const char * const *ymmh_register_names = nullptr;
/* Register number for %ymm16h. Set this to -1 to indicate the absence
of support for YMM16-31. */
int ymm16h_regnum;
int ymm16h_regnum = 0;
/* YMM16-31 register names. Only used for tdesc_numbered_register. */
const char * const *ymm16h_register_names;
const char * const *ymm16h_register_names = nullptr;
/* Register number for %bnd0r. Set this to -1 to indicate the absence
bound registers. */
int bnd0r_regnum;
int bnd0r_regnum = 0;
/* Register number for pseudo register %bnd0. Set this to -1 to indicate the absence
bound registers. */
int bnd0_regnum;
int bnd0_regnum = 0;
/* Register number for %bndcfgu. Set this to -1 to indicate the absence
bound control registers. */
int bndcfgu_regnum;
int bndcfgu_regnum = 0;
/* MPX register names. Only used for tdesc_numbered_register. */
const char * const *mpx_register_names;
const char * const *mpx_register_names = nullptr;
/* Register number for %zmm0h. Set this to -1 to indicate the absence
of ZMM_HI256 register support. */
int zmm0h_regnum;
int zmm0h_regnum = 0;
/* OpMask register names. */
const char * const *k_register_names;
const char * const *k_register_names = nullptr;
/* ZMM register names. Only used for tdesc_numbered_register. */
const char * const *zmmh_register_names;
const char * const *zmmh_register_names = nullptr;
/* XMM16-31 register names. Only used for tdesc_numbered_register. */
const char * const *xmm_avx512_register_names;
const char * const *xmm_avx512_register_names = nullptr;
/* YMM16-31 register names. Only used for tdesc_numbered_register. */
const char * const *ymm_avx512_register_names;
const char * const *ymm_avx512_register_names = nullptr;
/* Number of PKEYS registers. */
int num_pkeys_regs;
int num_pkeys_regs = 0;
/* Register number for PKRU register. */
int pkru_regnum;
int pkru_regnum = 0;
/* PKEYS register names. */
const char * const *pkeys_register_names;
const char * const *pkeys_register_names = nullptr;
/* Register number for %fsbase. Set this to -1 to indicate the
absence of segment base registers. */
int fsbase_regnum;
int fsbase_regnum = 0;
/* Target description. */
const struct target_desc *tdesc;
const struct target_desc *tdesc = nullptr;
/* Register group function. */
gdbarch_register_reggroup_p_ftype *register_reggroup_p;
gdbarch_register_reggroup_p_ftype *register_reggroup_p = nullptr;
/* Offset of saved PC in jmp_buf. */
int jb_pc_offset;
int jb_pc_offset = 0;
/* Convention for returning structures. */
enum struct_return struct_return;
enum struct_return struct_return {};
/* Address range where sigtramp lives. */
CORE_ADDR sigtramp_start;
CORE_ADDR sigtramp_end;
CORE_ADDR sigtramp_start = 0;
CORE_ADDR sigtramp_end = 0;
/* Detect sigtramp. */
int (*sigtramp_p) (struct frame_info *);
int (*sigtramp_p) (struct frame_info *) = nullptr;
/* Get address of sigcontext for sigtramp. */
CORE_ADDR (*sigcontext_addr) (struct frame_info *);
CORE_ADDR (*sigcontext_addr) (struct frame_info *) = nullptr;
/* Offset of registers in `struct sigcontext'. */
int *sc_reg_offset;
int sc_num_regs;
int *sc_reg_offset = 0;
int sc_num_regs = 0;
/* Offset of saved PC and SP in `struct sigcontext'. Usage of these
is deprecated, please use `sc_reg_offset' instead. */
int sc_pc_offset;
int sc_sp_offset;
int sc_pc_offset = 0;
int sc_sp_offset = 0;
/* ISA-specific data types. */
struct type *i386_mmx_type;
struct type *i386_ymm_type;
struct type *i386_zmm_type;
struct type *i387_ext_type;
struct type *i386_bnd_type;
struct type *i386_mmx_type = nullptr;
struct type *i386_ymm_type = nullptr;
struct type *i386_zmm_type = nullptr;
struct type *i387_ext_type = nullptr;
struct type *i386_bnd_type = nullptr;
/* Process record/replay target. */
/* The map for registers because the AMD64's registers order
in GDB is not same as I386 instructions. */
const int *record_regmap;
const int *record_regmap = nullptr;
/* Parse intx80 args. */
int (*i386_intx80_record) (struct regcache *regcache);
int (*i386_intx80_record) (struct regcache *regcache) = nullptr;
/* Parse sysenter args. */
int (*i386_sysenter_record) (struct regcache *regcache);
int (*i386_sysenter_record) (struct regcache *regcache) = nullptr;
/* Parse syscall args. */
int (*i386_syscall_record) (struct regcache *regcache);
int (*i386_syscall_record) (struct regcache *regcache) = nullptr;
/* Regsets. */
const struct regset *fpregset;
const struct regset *fpregset = nullptr;
};
/* Floating-point registers. */

View File

@ -136,7 +136,7 @@ i386_windows_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
static void
i386_windows_init_abi_common (struct gdbarch_info info, struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
set_gdbarch_skip_trampoline_code (gdbarch, i386_windows_skip_trampoline_code);

View File

@ -204,7 +204,7 @@ void
i387_print_float_info (struct gdbarch *gdbarch, struct ui_file *file,
struct frame_info *frame, const char *args)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (frame));
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
ULONGEST fctrl;
int fctrl_p;
ULONGEST fstat;
@ -440,7 +440,7 @@ void
i387_supply_fsave (struct regcache *regcache, int regnum, const void *fsave)
{
struct gdbarch *gdbarch = regcache->arch ();
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
const gdb_byte *regs = (const gdb_byte *) fsave;
int i;
@ -494,7 +494,8 @@ i387_supply_fsave (struct regcache *regcache, int regnum, const void *fsave)
void
i387_collect_fsave (const struct regcache *regcache, int regnum, void *fsave)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (regcache->arch ());
gdbarch *arch = regcache->arch ();
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (arch);
gdb_byte *regs = (gdb_byte *) fsave;
int i;
@ -587,7 +588,8 @@ static int i387_tag (const gdb_byte *raw);
void
i387_supply_fxsave (struct regcache *regcache, int regnum, const void *fxsave)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (regcache->arch ());
gdbarch *arch = regcache->arch ();
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (arch);
const gdb_byte *regs = (const gdb_byte *) fxsave;
int i;
@ -670,7 +672,8 @@ i387_supply_fxsave (struct regcache *regcache, int regnum, const void *fxsave)
void
i387_collect_fxsave (const struct regcache *regcache, int regnum, void *fxsave)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (regcache->arch ());
gdbarch *arch = regcache->arch ();
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (arch);
gdb_byte *regs = (gdb_byte *) fxsave;
int i;
@ -903,7 +906,7 @@ i387_xsave_get_clear_bv (struct gdbarch *gdbarch, const void *xsave)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
const gdb_byte *regs = (const gdb_byte *) xsave;
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
/* Get `xstat_bv'. The supported bits in `xstat_bv' are 8 bytes. */
ULONGEST xstate_bv = extract_unsigned_integer (XSAVE_XSTATE_BV_ADDR (regs),
@ -923,7 +926,7 @@ i387_supply_xsave (struct regcache *regcache, int regnum,
{
struct gdbarch *gdbarch = regcache->arch ();
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
const gdb_byte *regs = (const gdb_byte *) xsave;
int i;
/* In 64-bit mode the split between "low" and "high" ZMM registers is at
@ -1346,7 +1349,7 @@ i387_collect_xsave (const struct regcache *regcache, int regnum,
{
struct gdbarch *gdbarch = regcache->arch ();
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
gdb_byte *p, *regs = (gdb_byte *) xsave;
gdb_byte raw[I386_MAX_REGISTER_SIZE];
ULONGEST initial_xstate_bv, clear_bv, xstate_bv = 0;
@ -1931,7 +1934,7 @@ i387_tag (const gdb_byte *raw)
void
i387_return_value (struct gdbarch *gdbarch, struct regcache *regcache)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
ULONGEST fstat;
/* Set the top of the floating-point register stack to 7. The
@ -1954,7 +1957,7 @@ i387_return_value (struct gdbarch *gdbarch, struct regcache *regcache)
void
i387_reset_bnd_regs (struct gdbarch *gdbarch, struct regcache *regcache)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (I387_BND0R_REGNUM (tdep) > 0)
{

View File

@ -216,7 +216,7 @@ ia64_linux_iterate_over_regset_sections (struct gdbarch *gdbarch,
static void
ia64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
ia64_gdbarch_tdep *tdep = (ia64_gdbarch_tdep *) gdbarch_tdep (gdbarch);
static const char *const stap_register_prefixes[] = { "r", NULL };
static const char *const stap_register_indirection_prefixes[] = { "[",
NULL };

View File

@ -310,7 +310,7 @@ static const struct floatformat *floatformats_ia64_ext[2] =
static struct type *
ia64_ext_type (struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
ia64_gdbarch_tdep *tdep = (ia64_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (!tdep->ia64_ext_type)
tdep->ia64_ext_type
@ -2177,7 +2177,7 @@ ia64_sigtramp_frame_init_saved_regs (struct frame_info *this_frame,
struct ia64_frame_cache *cache)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
ia64_gdbarch_tdep *tdep = (ia64_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (tdep->sigcontext_register_address)
{
@ -2335,7 +2335,8 @@ ia64_sigtramp_frame_sniffer (const struct frame_unwind *self,
struct frame_info *this_frame,
void **this_cache)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (this_frame));
gdbarch *arch = get_frame_arch (this_frame);
ia64_gdbarch_tdep *tdep = (ia64_gdbarch_tdep *) gdbarch_tdep (arch);
if (tdep->pc_in_sigtramp)
{
CORE_ADDR pc = get_frame_pc (this_frame);
@ -3482,7 +3483,7 @@ ia64_find_global_pointer_from_dynamic_section (struct gdbarch *gdbarch,
static CORE_ADDR
ia64_find_global_pointer (struct gdbarch *gdbarch, CORE_ADDR faddr)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
ia64_gdbarch_tdep *tdep = (ia64_gdbarch_tdep *) gdbarch_tdep (gdbarch);
CORE_ADDR addr = 0;
if (tdep->find_global_pointer_from_solib)
@ -3677,7 +3678,7 @@ ia64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
function_call_return_method return_method,
CORE_ADDR struct_addr)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
ia64_gdbarch_tdep *tdep = (ia64_gdbarch_tdep *) gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int argno;
struct value *arg;
@ -3917,14 +3918,13 @@ static struct gdbarch *
ia64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
struct gdbarch *gdbarch;
struct gdbarch_tdep *tdep;
/* If there is already a candidate, use it. */
arches = gdbarch_list_lookup_by_info (arches, &info);
if (arches != NULL)
return arches->gdbarch;
tdep = XCNEW (struct gdbarch_tdep);
ia64_gdbarch_tdep *tdep = new ia64_gdbarch_tdep;
gdbarch = gdbarch_alloc (&info, tdep);
tdep->size_of_register_frame = ia64_size_of_register_frame;

View File

@ -20,6 +20,8 @@
#ifndef IA64_TDEP_H
#define IA64_TDEP_H
#include "gdbarch.h"
#ifdef HAVE_LIBUNWIND_IA64_H
#include "libunwind-ia64.h"
#include "ia64-libunwind-tdep.h"
@ -214,30 +216,33 @@ struct ia64_infcall_ops
Should do nothing if this operation is not permitted by the OS. */
void (*allocate_new_rse_frame) (struct regcache *regcache, ULONGEST bsp,
int sof);
int sof) = nullptr;
/* Store the argument stored in BUF into the appropriate location
given the BSP and the SLOTNUM. */
void (*store_argument_in_slot) (struct regcache *regcache, CORE_ADDR bsp,
int slotnum, gdb_byte *buf);
int slotnum, gdb_byte *buf) = nullptr;
/* For targets where we cannot call the function directly, store
the address of the function we want to call at the location
expected by the calling sequence. */
void (*set_function_addr) (struct regcache *regcache, CORE_ADDR func_addr);
void (*set_function_addr) (struct regcache *regcache, CORE_ADDR func_addr)
= nullptr;
};
struct gdbarch_tdep
struct ia64_gdbarch_tdep : gdbarch_tdep
{
CORE_ADDR (*sigcontext_register_address) (struct gdbarch *, CORE_ADDR, int);
int (*pc_in_sigtramp) (CORE_ADDR);
CORE_ADDR (*sigcontext_register_address) (struct gdbarch *, CORE_ADDR, int)
= nullptr;
int (*pc_in_sigtramp) (CORE_ADDR) = nullptr;
/* Return the total size of THIS_FRAME's register frame.
CFM is THIS_FRAME's cfm register value.
Normally, the size of the register frame is always obtained by
extracting the lowest 7 bits ("cfm & 0x7f"). */
int (*size_of_register_frame) (struct frame_info *this_frame, ULONGEST cfm);
int (*size_of_register_frame) (struct frame_info *this_frame, ULONGEST cfm)
= nullptr;
/* Determine the function address FADDR belongs to a shared library.
If it does, then return the associated global pointer. If no shared
@ -245,10 +250,10 @@ struct gdbarch_tdep
This pointer may be NULL. */
CORE_ADDR (*find_global_pointer_from_solib) (struct gdbarch *gdbarch,
CORE_ADDR faddr);
CORE_ADDR faddr) = nullptr;
/* ISA-specific data types. */
struct type *ia64_ext_type;
struct type *ia64_ext_type = nullptr;
struct ia64_infcall_ops infcall_ops;
};

View File

@ -42,7 +42,7 @@
#define LM32_REG2(insn) ((insn >> 11) & 0x1f)
#define LM32_IMM16(insn) ((((long)insn & 0xffff) << 16) >> 16)
struct gdbarch_tdep
struct lm32_gdbarch_tdep : gdbarch_tdep
{
/* gdbarch target dependent data here. Currently unused for LM32. */
};
@ -491,7 +491,6 @@ static struct gdbarch *
lm32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
struct gdbarch *gdbarch;
struct gdbarch_tdep *tdep;
/* If there is already a candidate, use it. */
arches = gdbarch_list_lookup_by_info (arches, &info);
@ -499,7 +498,7 @@ lm32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
return arches->gdbarch;
/* None found, create a new architecture from the information provided. */
tdep = XCNEW (struct gdbarch_tdep);
lm32_gdbarch_tdep *tdep = new lm32_gdbarch_tdep;
gdbarch = gdbarch_alloc (&info, tdep);
/* Type sizes. */

View File

@ -95,42 +95,44 @@ struct m32c_reg
#define M32C_MAX_DWARF_REGNUM (40)
struct gdbarch_tdep
struct m32c_gdbarch_tdep : gdbarch_tdep
{
/* All the registers for this variant, indexed by GDB register
number, and the number of registers present. */
struct m32c_reg regs[M32C_MAX_NUM_REGS];
struct m32c_reg regs[M32C_MAX_NUM_REGS] {};
/* The number of valid registers. */
int num_regs;
int num_regs = 0;
/* Interesting registers. These are pointers into REGS. */
struct m32c_reg *pc, *flg;
struct m32c_reg *r0, *r1, *r2, *r3, *a0, *a1;
struct m32c_reg *r2r0, *r3r2r1r0, *r3r1r2r0;
struct m32c_reg *sb, *fb, *sp;
struct m32c_reg *pc = nullptr, *flg = nullptr;
struct m32c_reg *r0 = nullptr, *r1 = nullptr, *r2 = nullptr, *r3 = nullptr,
*a0 = nullptr, *a1 = nullptr;
struct m32c_reg *r2r0 = nullptr, *r3r2r1r0 = nullptr, *r3r1r2r0 = nullptr;
struct m32c_reg *sb = nullptr, *fb = nullptr, *sp = nullptr;
/* A table indexed by DWARF register numbers, pointing into
REGS. */
struct m32c_reg *dwarf_regs[M32C_MAX_DWARF_REGNUM + 1];
struct m32c_reg *dwarf_regs[M32C_MAX_DWARF_REGNUM + 1] {};
/* Types for this architecture. We can't use the builtin_type_foo
types, because they're not initialized when building a gdbarch
structure. */
struct type *voyd, *ptr_voyd, *func_voyd;
struct type *uint8, *uint16;
struct type *int8, *int16, *int32, *int64;
struct type *voyd = nullptr, *ptr_voyd = nullptr, *func_voyd = nullptr;
struct type *uint8 = nullptr, *uint16 = nullptr;
struct type *int8 = nullptr, *int16 = nullptr, *int32 = nullptr,
*int64 = nullptr;
/* The types for data address and code address registers. */
struct type *data_addr_reg_type, *code_addr_reg_type;
struct type *data_addr_reg_type = nullptr, *code_addr_reg_type = nullptr;
/* The number of bytes a return address pushed by a 'jsr' instruction
occupies on the stack. */
int ret_addr_bytes;
int ret_addr_bytes = 0;
/* The number of bytes an address register occupies on the stack
when saved by an 'enter' or 'pushm' instruction. */
int push_addr_bytes;
int push_addr_bytes = 0;
};
@ -139,7 +141,7 @@ struct gdbarch_tdep
static void
make_types (struct gdbarch *arch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (arch);
m32c_gdbarch_tdep *tdep = (m32c_gdbarch_tdep *) gdbarch_tdep (arch);
unsigned long mach = gdbarch_bfd_arch_info (arch)->mach;
int data_addr_reg_bits, code_addr_reg_bits;
char type_name[50];
@ -212,28 +214,31 @@ make_types (struct gdbarch *arch)
static const char *
m32c_register_name (struct gdbarch *gdbarch, int num)
{
return gdbarch_tdep (gdbarch)->regs[num].name;
m32c_gdbarch_tdep *tdep = (m32c_gdbarch_tdep *) gdbarch_tdep (gdbarch);
return tdep->regs[num].name;
}
static struct type *
m32c_register_type (struct gdbarch *arch, int reg_nr)
{
return gdbarch_tdep (arch)->regs[reg_nr].type;
m32c_gdbarch_tdep *tdep = (m32c_gdbarch_tdep *) gdbarch_tdep (arch);
return tdep->regs[reg_nr].type;
}
static int
m32c_register_sim_regno (struct gdbarch *gdbarch, int reg_nr)
{
return gdbarch_tdep (gdbarch)->regs[reg_nr].sim_num;
m32c_gdbarch_tdep *tdep = (m32c_gdbarch_tdep *) gdbarch_tdep (gdbarch);
return tdep->regs[reg_nr].sim_num;
}
static int
m32c_debug_info_reg_to_regnum (struct gdbarch *gdbarch, int reg_nr)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
m32c_gdbarch_tdep *tdep = (m32c_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (0 <= reg_nr && reg_nr <= M32C_MAX_DWARF_REGNUM
&& tdep->dwarf_regs[reg_nr])
return tdep->dwarf_regs[reg_nr]->num;
@ -248,7 +253,7 @@ static int
m32c_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
struct reggroup *group)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
m32c_gdbarch_tdep *tdep = (m32c_gdbarch_tdep *) gdbarch_tdep (gdbarch);
struct m32c_reg *reg = &tdep->regs[regnum];
/* The anonymous raw registers aren't in any groups. */
@ -323,7 +328,8 @@ m32c_raw_write (struct m32c_reg *reg, struct regcache *cache,
static int
m32c_read_flg (readable_regcache *cache)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (cache->arch ());
gdbarch *arch = cache->arch ();
m32c_gdbarch_tdep *tdep = (m32c_gdbarch_tdep *) gdbarch_tdep (arch);
ULONGEST flg;
cache->raw_read (tdep->flg->num, &flg);
@ -522,7 +528,8 @@ m32c_cat_write (struct m32c_reg *reg, struct regcache *cache,
static enum register_status
m32c_r3r2r1r0_read (struct m32c_reg *reg, readable_regcache *cache, gdb_byte *buf)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (reg->arch);
gdbarch *arch = reg->arch;
m32c_gdbarch_tdep *tdep = (m32c_gdbarch_tdep *) gdbarch_tdep (arch);
int len = TYPE_LENGTH (tdep->r0->type);
enum register_status status;
@ -558,7 +565,8 @@ static enum register_status
m32c_r3r2r1r0_write (struct m32c_reg *reg, struct regcache *cache,
const gdb_byte *buf)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (reg->arch);
gdbarch *arch = reg->arch;
m32c_gdbarch_tdep *tdep = (m32c_gdbarch_tdep *) gdbarch_tdep (arch);
int len = TYPE_LENGTH (tdep->r0->type);
if (gdbarch_byte_order (reg->arch) == BFD_ENDIAN_BIG)
@ -586,7 +594,7 @@ m32c_pseudo_register_read (struct gdbarch *arch,
int cookednum,
gdb_byte *buf)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (arch);
m32c_gdbarch_tdep *tdep = (m32c_gdbarch_tdep *) gdbarch_tdep (arch);
struct m32c_reg *reg;
gdb_assert (0 <= cookednum && cookednum < tdep->num_regs);
@ -604,7 +612,7 @@ m32c_pseudo_register_write (struct gdbarch *arch,
int cookednum,
const gdb_byte *buf)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (arch);
m32c_gdbarch_tdep *tdep = (m32c_gdbarch_tdep *) gdbarch_tdep (arch);
struct m32c_reg *reg;
gdb_assert (0 <= cookednum && cookednum < tdep->num_regs);
@ -629,7 +637,7 @@ add_reg (struct gdbarch *arch,
struct m32c_reg *ry,
int n)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (arch);
m32c_gdbarch_tdep *tdep = (m32c_gdbarch_tdep *) gdbarch_tdep (arch);
struct m32c_reg *r = &tdep->regs[tdep->num_regs];
gdb_assert (tdep->num_regs < M32C_MAX_NUM_REGS);
@ -668,7 +676,9 @@ set_dwarf_regnum (struct m32c_reg *reg, int num)
reg->dwarf_num = num;
/* Update the DWARF->reg mapping. */
gdbarch_tdep (reg->arch)->dwarf_regs[num] = reg;
gdbarch *arch = reg->arch;
m32c_gdbarch_tdep *tdep = (m32c_gdbarch_tdep *) gdbarch_tdep (arch);
tdep->dwarf_regs[num] = reg;
}
@ -789,7 +799,7 @@ mark_save_restore (struct m32c_reg *reg)
static void
make_regs (struct gdbarch *arch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (arch);
m32c_gdbarch_tdep *tdep = (m32c_gdbarch_tdep *) gdbarch_tdep (arch);
int mach = gdbarch_bfd_arch_info (arch)->mach;
int num_raw_regs;
int num_cooked_regs;
@ -1336,16 +1346,17 @@ m32c_decode_sd23 (struct m32c_pv_state *st, int code, int size, int ind)
static int
m32c_pv_enter (struct m32c_pv_state *state, int size)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (state->arch);
/* If simulating this store would require us to forget
everything we know about the stack frame in the name of
accuracy, it would be better to just quit now. */
if (state->stack->store_would_trash (state->sp))
return 1;
gdbarch *arch = state->arch;
m32c_gdbarch_tdep *tdep = (m32c_gdbarch_tdep *) gdbarch_tdep (arch);
if (m32c_pv_push (state, state->fb, tdep->push_addr_bytes))
return 1;
state->fb = state->sp;
state->sp = pv_add_constant (state->sp, -size);
@ -1371,7 +1382,8 @@ m32c_pv_pushm_one (struct m32c_pv_state *state, pv_t reg,
static int
m32c_pv_pushm (struct m32c_pv_state *state, int src)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (state->arch);
gdbarch *arch = state->arch;
m32c_gdbarch_tdep *tdep = (m32c_gdbarch_tdep *) gdbarch_tdep (arch);
/* The bits in SRC indicating which registers to save are:
r0 r1 r2 r3 a0 a1 sb fb */
@ -1391,7 +1403,9 @@ m32c_pv_pushm (struct m32c_pv_state *state, int src)
static int
m32c_is_1st_arg_reg (struct m32c_pv_state *state, pv_t value)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (state->arch);
gdbarch *arch = state->arch;
m32c_gdbarch_tdep *tdep = (m32c_gdbarch_tdep *) gdbarch_tdep (arch);
return (value.kind == pvk_register
&& (gdbarch_bfd_arch_info (state->arch)->mach == bfd_mach_m16c
? (value.reg == tdep->r1->num)
@ -1404,7 +1418,9 @@ m32c_is_1st_arg_reg (struct m32c_pv_state *state, pv_t value)
static int
m32c_is_arg_reg (struct m32c_pv_state *state, pv_t value)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (state->arch);
gdbarch *arch = state->arch;
m32c_gdbarch_tdep *tdep = (m32c_gdbarch_tdep *) gdbarch_tdep (arch);
return (value.kind == pvk_register
&& (gdbarch_bfd_arch_info (state->arch)->mach == bfd_mach_m16c
? (value.reg == tdep->r1->num || value.reg == tdep->r2->num)
@ -1427,7 +1443,8 @@ m32c_is_arg_spill (struct m32c_pv_state *st,
struct srcdest loc,
pv_t value)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (st->arch);
gdbarch *arch = st->arch;
m32c_gdbarch_tdep *tdep = (m32c_gdbarch_tdep *) gdbarch_tdep (arch);
return (m32c_is_arg_reg (st, value)
&& loc.kind == srcdest_mem
@ -1450,7 +1467,8 @@ m32c_is_struct_return (struct m32c_pv_state *st,
struct srcdest loc,
pv_t value)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (st->arch);
gdbarch *arch = st->arch;
m32c_gdbarch_tdep *tdep = (m32c_gdbarch_tdep *) gdbarch_tdep (arch);
return (m32c_is_1st_arg_reg (st, value)
&& !st->stack->find_reg (st->arch, value.reg, 0)
@ -1467,7 +1485,9 @@ m32c_is_struct_return (struct m32c_pv_state *st,
static int
m32c_pushm_is_reg_save (struct m32c_pv_state *st, int src)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (st->arch);
gdbarch *arch = st->arch;
m32c_gdbarch_tdep *tdep = (m32c_gdbarch_tdep *) gdbarch_tdep (arch);
/* The bits in SRC indicating which registers to save are:
r0 r1 r2 r3 a0 a1 sb fb */
return
@ -1494,7 +1514,7 @@ check_for_saved (void *prologue_untyped, pv_t addr, CORE_ADDR size, pv_t value)
{
struct m32c_prologue *prologue = (struct m32c_prologue *) prologue_untyped;
struct gdbarch *arch = prologue->arch;
struct gdbarch_tdep *tdep = gdbarch_tdep (arch);
m32c_gdbarch_tdep *tdep = (m32c_gdbarch_tdep *) gdbarch_tdep (arch);
/* Is this the unchanged value of some register being saved on the
stack? */
@ -1534,7 +1554,7 @@ m32c_analyze_prologue (struct gdbarch *arch,
CORE_ADDR start, CORE_ADDR limit,
struct m32c_prologue *prologue)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (arch);
m32c_gdbarch_tdep *tdep = (m32c_gdbarch_tdep *) gdbarch_tdep (arch);
unsigned long mach = gdbarch_bfd_arch_info (arch)->mach;
CORE_ADDR after_last_frame_related_insn;
struct m32c_pv_state st;
@ -1864,7 +1884,8 @@ m32c_frame_base (struct frame_info *this_frame,
{
struct m32c_prologue *p
= m32c_analyze_frame_prologue (this_frame, this_prologue_cache);
struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (this_frame));
gdbarch *arch = get_frame_arch (this_frame);
m32c_gdbarch_tdep *tdep = (m32c_gdbarch_tdep *) gdbarch_tdep (arch);
/* In functions that use alloca, the distance between the stack
pointer and the frame base varies dynamically, so we can't use
@ -1914,7 +1935,8 @@ static struct value *
m32c_prev_register (struct frame_info *this_frame,
void **this_prologue_cache, int regnum)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (this_frame));
gdbarch *arch = get_frame_arch (this_frame);
m32c_gdbarch_tdep *tdep = (m32c_gdbarch_tdep *) gdbarch_tdep (arch);
struct m32c_prologue *p
= m32c_analyze_frame_prologue (this_frame, this_prologue_cache);
CORE_ADDR frame_base = m32c_frame_base (this_frame, this_prologue_cache);
@ -1997,7 +2019,7 @@ m32c_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
function_call_return_method return_method,
CORE_ADDR struct_addr)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
m32c_gdbarch_tdep *tdep = (m32c_gdbarch_tdep *) gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
unsigned long mach = gdbarch_bfd_arch_info (gdbarch)->mach;
CORE_ADDR cfa;
@ -2160,7 +2182,7 @@ m32c_return_value (struct gdbarch *gdbarch,
gdb_byte *readbuf,
const gdb_byte *writebuf)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
m32c_gdbarch_tdep *tdep = (m32c_gdbarch_tdep *) gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
enum return_value_convention conv;
ULONGEST valtype_len = TYPE_LENGTH (valtype);
@ -2291,7 +2313,7 @@ static CORE_ADDR
m32c_skip_trampoline_code (struct frame_info *frame, CORE_ADDR stop_pc)
{
struct gdbarch *gdbarch = get_frame_arch (frame);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
m32c_gdbarch_tdep *tdep = (m32c_gdbarch_tdep *) gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
/* It would be nicer to simply look up the addresses of known
@ -2537,7 +2559,7 @@ m32c_virtual_frame_pointer (struct gdbarch *gdbarch, CORE_ADDR pc,
struct m32c_prologue p;
struct regcache *regcache = get_current_regcache ();
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
m32c_gdbarch_tdep *tdep = (m32c_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (!find_pc_partial_function (pc, &name, &func_addr, &func_end))
internal_error (__FILE__, __LINE__,
@ -2572,7 +2594,6 @@ static struct gdbarch *
m32c_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
struct gdbarch *gdbarch;
struct gdbarch_tdep *tdep;
unsigned long mach = info.bfd_arch_info->mach;
/* Find a candidate among the list of architectures we've created
@ -2582,7 +2603,7 @@ m32c_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
arches = gdbarch_list_lookup_by_info (arches->next, &info))
return arches->gdbarch;
tdep = XCNEW (struct gdbarch_tdep);
m32c_gdbarch_tdep *tdep = new m32c_gdbarch_tdep;
gdbarch = gdbarch_alloc (&info, tdep);
/* Essential types. */

View File

@ -865,7 +865,6 @@ static struct gdbarch *
m32r_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
struct gdbarch *gdbarch;
struct gdbarch_tdep *tdep;
/* If there is already a candidate, use it. */
arches = gdbarch_list_lookup_by_info (arches, &info);
@ -873,7 +872,7 @@ m32r_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
return arches->gdbarch;
/* Allocate space for the new architecture. */
tdep = XCNEW (struct gdbarch_tdep);
m32r_gdbarch_tdep *tdep = new m32r_gdbarch_tdep;
gdbarch = gdbarch_alloc (&info, tdep);
set_gdbarch_wchar_bit (gdbarch, 16);

View File

@ -20,7 +20,9 @@
#ifndef M32R_TDEP_H
#define M32R_TDEP_H
struct gdbarch_tdep
#include "gdbarch.h"
struct m32r_gdbarch_tdep : gdbarch_tdep
{
/* gdbarch target dependent data here. Currently unused for M32R. */
};

View File

@ -123,27 +123,38 @@ enum insn_return_kind {
#define M68HC12_HARD_PC_REGNUM (SOFT_D32_REGNUM+1)
struct insn_sequence;
struct gdbarch_tdep
struct m68gc11_gdbarch_tdep : gdbarch_tdep
{
/* Stack pointer correction value. For 68hc11, the stack pointer points
to the next push location. An offset of 1 must be applied to obtain
the address where the last value is saved. For 68hc12, the stack
pointer points to the last value pushed. No offset is necessary. */
int stack_correction;
int stack_correction = 0;
/* Description of instructions in the prologue. */
struct insn_sequence *prologue;
struct insn_sequence *prologue = nullptr;
/* True if the page memory bank register is available
and must be used. */
int use_page_register;
int use_page_register = 0;
/* ELF flags for ABI. */
int elf_flags;
int elf_flags = 0;
};
#define STACK_CORRECTION(gdbarch) (gdbarch_tdep (gdbarch)->stack_correction)
#define USE_PAGE_REGISTER(gdbarch) (gdbarch_tdep (gdbarch)->use_page_register)
static int
stack_correction (gdbarch *arch)
{
m68gc11_gdbarch_tdep *tdep = (m68gc11_gdbarch_tdep *) gdbarch_tdep (arch);
return tdep->stack_correction;
}
static int
use_page_register (gdbarch *arch)
{
m68gc11_gdbarch_tdep *tdep = (m68gc11_gdbarch_tdep *) gdbarch_tdep (arch);
return tdep->stack_correction;
}
struct m68hc11_unwind_cache
{
@ -371,13 +382,15 @@ m68hc11_pseudo_register_write (struct gdbarch *gdbarch,
static const char *
m68hc11_register_name (struct gdbarch *gdbarch, int reg_nr)
{
if (reg_nr == M68HC12_HARD_PC_REGNUM && USE_PAGE_REGISTER (gdbarch))
if (reg_nr == M68HC12_HARD_PC_REGNUM && use_page_register (gdbarch))
return "pc";
if (reg_nr == HARD_PC_REGNUM && USE_PAGE_REGISTER (gdbarch))
if (reg_nr == HARD_PC_REGNUM && use_page_register (gdbarch))
return "ppc";
if (reg_nr < 0)
return NULL;
if (reg_nr >= M68HC11_ALL_REGS)
return NULL;
@ -387,6 +400,7 @@ m68hc11_register_name (struct gdbarch *gdbarch, int reg_nr)
does not exist. */
if (reg_nr > M68HC11_LAST_HARD_REG && soft_regs[reg_nr].name == 0)
return NULL;
return m68hc11_register_names[reg_nr];
}
@ -627,7 +641,8 @@ m68hc11_scan_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
return pc;
}
seq_table = gdbarch_tdep (gdbarch)->prologue;
m68gc11_gdbarch_tdep *tdep = (m68gc11_gdbarch_tdep *) gdbarch_tdep (gdbarch);
seq_table = tdep->prologue;
/* The 68hc11 stack is as follows:
@ -807,7 +822,7 @@ m68hc11_frame_unwind_cache (struct frame_info *this_frame,
info->saved_regs[HARD_PC_REGNUM].set_addr (info->sp_offset);
this_base = get_frame_register_unsigned (this_frame, HARD_SP_REGNUM);
prev_sp = this_base + info->sp_offset + 2;
this_base += STACK_CORRECTION (gdbarch);
this_base += stack_correction (gdbarch);
}
else
{
@ -815,7 +830,7 @@ m68hc11_frame_unwind_cache (struct frame_info *this_frame,
to before the first saved register giving the SP. */
prev_sp = this_base + info->size + 2;
this_base += STACK_CORRECTION (gdbarch);
this_base += stack_correction (gdbarch);
if (soft_regs[SOFT_FP_REGNUM].name)
info->saved_regs[SOFT_FP_REGNUM].set_addr (info->size - 2);
}
@ -898,7 +913,7 @@ m68hc11_frame_prev_register (struct frame_info *this_frame,
/* Take into account the 68HC12 specific call (PC + page). */
if (regnum == HARD_PC_REGNUM
&& info->return_kind == RETURN_RTC
&& USE_PAGE_REGISTER (get_frame_arch (this_frame)))
&& use_page_register (get_frame_arch (this_frame)))
{
CORE_ADDR pc = value_as_long (value);
if (pc >= 0x08000 && pc < 0x0c000)
@ -1003,7 +1018,10 @@ m68hc11_print_register (struct gdbarch *gdbarch, struct ui_file *file,
}
else
{
if (regno == HARD_PC_REGNUM && gdbarch_tdep (gdbarch)->use_page_register)
m68gc11_gdbarch_tdep *tdep
= (m68gc11_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (regno == HARD_PC_REGNUM && tdep->use_page_register)
{
ULONGEST page;
@ -1106,7 +1124,9 @@ m68hc11_print_registers_info (struct gdbarch *gdbarch, struct ui_file *file,
fprintf_filtered (file, " Y=");
m68hc11_print_register (gdbarch, file, frame, HARD_Y_REGNUM);
if (gdbarch_tdep (gdbarch)->use_page_register)
m68gc11_gdbarch_tdep *tdep = (m68gc11_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (tdep->use_page_register)
{
fprintf_filtered (file, "\nPage=");
m68hc11_print_register (gdbarch, file, frame, HARD_PAGE_REGNUM);
@ -1194,7 +1214,7 @@ m68hc11_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
write_memory (sp, buf, 2);
/* Finally, update the stack pointer... */
sp -= STACK_CORRECTION (gdbarch);
sp -= stack_correction (gdbarch);
regcache_cooked_write_unsigned (regcache, HARD_SP_REGNUM, sp);
/* ...and fake a frame pointer. */
@ -1386,7 +1406,6 @@ m68hc11_gdbarch_init (struct gdbarch_info info,
struct gdbarch_list *arches)
{
struct gdbarch *gdbarch;
struct gdbarch_tdep *tdep;
int elf_flags;
soft_reg_initialized = 0;
@ -1403,14 +1422,17 @@ m68hc11_gdbarch_init (struct gdbarch_info info,
arches != NULL;
arches = gdbarch_list_lookup_by_info (arches->next, &info))
{
if (gdbarch_tdep (arches->gdbarch)->elf_flags != elf_flags)
m68gc11_gdbarch_tdep *tdep
= (m68gc11_gdbarch_tdep *) gdbarch_tdep (arches->gdbarch);
if (tdep->elf_flags != elf_flags)
continue;
return arches->gdbarch;
}
/* Need a new architecture. Fill in a target specific vector. */
tdep = XCNEW (struct gdbarch_tdep);
m68gc11_gdbarch_tdep *tdep = new m68gc11_gdbarch_tdep;
gdbarch = gdbarch_alloc (&info, tdep);
tdep->elf_flags = elf_flags;

View File

@ -133,7 +133,7 @@ m68kbsd_iterate_over_regset_sections (struct gdbarch *gdbarch,
static void
m68kbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
m68k_gdbarch_tdep *tdep = (m68k_gdbarch_tdep *) gdbarch_tdep (gdbarch);
tdep->jb_pc = 5;
tdep->jb_elt_size = 4;

View File

@ -384,7 +384,7 @@ m68k_linux_iterate_over_regset_sections (struct gdbarch *gdbarch,
static void
m68k_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
m68k_gdbarch_tdep *tdep = (m68k_gdbarch_tdep *) gdbarch_tdep (gdbarch);
linux_init_abi (info, gdbarch, 0);

View File

@ -70,7 +70,7 @@ typedef BP_MANIPULATION (m68k_break_insn) m68k_breakpoint;
static struct type *
m68k_ps_type (struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
m68k_gdbarch_tdep *tdep = (m68k_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (!tdep->m68k_ps_type)
{
@ -99,7 +99,7 @@ m68k_ps_type (struct gdbarch *gdbarch)
static struct type *
m68881_ext_type (struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
m68k_gdbarch_tdep *tdep = (m68k_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (!tdep->m68881_ext_type)
tdep->m68881_ext_type
@ -120,7 +120,7 @@ m68881_ext_type (struct gdbarch *gdbarch)
static struct type *
m68k_register_type (struct gdbarch *gdbarch, int regnum)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
m68k_gdbarch_tdep *tdep = (m68k_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (tdep->fpregs_present)
{
@ -171,12 +171,14 @@ static const char * const m68k_register_names[] = {
static const char *
m68k_register_name (struct gdbarch *gdbarch, int regnum)
{
m68k_gdbarch_tdep *tdep = (m68k_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (regnum < 0 || regnum >= ARRAY_SIZE (m68k_register_names))
internal_error (__FILE__, __LINE__,
_("m68k_register_name: illegal register number %d"),
regnum);
else if (regnum >= M68K_FP0_REGNUM && regnum <= M68K_FPI_REGNUM
&& gdbarch_tdep (gdbarch)->fpregs_present == 0)
&& tdep->fpregs_present == 0)
return "";
else
return m68k_register_names[regnum];
@ -189,7 +191,9 @@ static int
m68k_convert_register_p (struct gdbarch *gdbarch,
int regnum, struct type *type)
{
if (!gdbarch_tdep (gdbarch)->fpregs_present)
m68k_gdbarch_tdep *tdep = (m68k_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (!tdep->fpregs_present)
return 0;
return (regnum >= M68K_FP0_REGNUM && regnum <= M68K_FP0_REGNUM + 7
/* We only support floating-point values. */
@ -296,7 +300,7 @@ m68k_extract_return_value (struct type *type, struct regcache *regcache,
if (type->code () == TYPE_CODE_PTR && len == 4)
{
struct gdbarch *gdbarch = regcache->arch ();
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
m68k_gdbarch_tdep *tdep = (m68k_gdbarch_tdep *) gdbarch_tdep (gdbarch);
regcache->raw_read (tdep->pointer_result_regnum, valbuf);
}
else if (len <= 4)
@ -321,7 +325,7 @@ m68k_svr4_extract_return_value (struct type *type, struct regcache *regcache,
{
gdb_byte buf[M68K_MAX_REGISTER_SIZE];
struct gdbarch *gdbarch = regcache->arch ();
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
m68k_gdbarch_tdep *tdep = (m68k_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (tdep->float_return && type->code () == TYPE_CODE_FLT)
{
@ -344,7 +348,7 @@ m68k_store_return_value (struct type *type, struct regcache *regcache,
if (type->code () == TYPE_CODE_PTR && len == 4)
{
struct gdbarch *gdbarch = regcache->arch ();
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
m68k_gdbarch_tdep *tdep = (m68k_gdbarch_tdep *) gdbarch_tdep (gdbarch);
regcache->raw_write (tdep->pointer_result_regnum, valbuf);
/* gdb historically also set D0 in the SVR4 case. */
if (tdep->pointer_result_regnum != M68K_D0_REGNUM)
@ -367,7 +371,7 @@ m68k_svr4_store_return_value (struct type *type, struct regcache *regcache,
const gdb_byte *valbuf)
{
struct gdbarch *gdbarch = regcache->arch ();
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
m68k_gdbarch_tdep *tdep = (m68k_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (tdep->float_return && type->code () == TYPE_CODE_FLT)
{
@ -387,7 +391,7 @@ m68k_svr4_store_return_value (struct type *type, struct regcache *regcache,
static int
m68k_reg_struct_return_p (struct gdbarch *gdbarch, struct type *type)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
m68k_gdbarch_tdep *tdep = (m68k_gdbarch_tdep *) gdbarch_tdep (gdbarch);
enum type_code code = type->code ();
int len = TYPE_LENGTH (type);
@ -465,6 +469,7 @@ m68k_svr4_return_value (struct gdbarch *gdbarch, struct value *function,
gdb_byte *readbuf, const gdb_byte *writebuf)
{
enum type_code code = type->code ();
m68k_gdbarch_tdep *tdep = (m68k_gdbarch_tdep *) gdbarch_tdep (gdbarch);
/* Aggregates with a single member are always returned like their
sole element. */
@ -480,7 +485,7 @@ m68k_svr4_return_value (struct gdbarch *gdbarch, struct value *function,
|| code == TYPE_CODE_COMPLEX || code == TYPE_CODE_ARRAY)
&& !m68k_reg_struct_return_p (gdbarch, type))
/* GCC may return a `long double' in memory too. */
|| (!gdbarch_tdep (gdbarch)->float_return
|| (!tdep->float_return
&& code == TYPE_CODE_FLT
&& TYPE_LENGTH (type) == 12))
{
@ -500,7 +505,6 @@ m68k_svr4_return_value (struct gdbarch *gdbarch, struct value *function,
if (readbuf)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
ULONGEST addr;
regcache_raw_read_unsigned (regcache, tdep->pointer_result_regnum,
@ -537,7 +541,7 @@ m68k_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
function_call_return_method return_method,
CORE_ADDR struct_addr)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
m68k_gdbarch_tdep *tdep = (m68k_gdbarch_tdep *) gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
gdb_byte buf[4];
int i;
@ -592,13 +596,15 @@ m68k_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
static int
m68k_dwarf_reg_to_regnum (struct gdbarch *gdbarch, int num)
{
m68k_gdbarch_tdep *tdep = (m68k_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (num < 8)
/* d0..7 */
return (num - 0) + M68K_D0_REGNUM;
else if (num < 16)
/* a0..7 */
return (num - 8) + M68K_A0_REGNUM;
else if (num < 24 && gdbarch_tdep (gdbarch)->fpregs_present)
else if (num < 24 && tdep->fpregs_present)
/* fp0..7 */
return (num - 16) + M68K_FP0_REGNUM;
else if (num == 25)
@ -760,6 +766,7 @@ m68k_analyze_register_saves (struct gdbarch *gdbarch, CORE_ADDR pc,
struct m68k_frame_cache *cache)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
m68k_gdbarch_tdep *tdep = (m68k_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (cache->locals >= 0)
{
@ -772,7 +779,7 @@ m68k_analyze_register_saves (struct gdbarch *gdbarch, CORE_ADDR pc,
{
op = read_memory_unsigned_integer (pc, 2, byte_order);
if (op == P_FMOVEMX_SP
&& gdbarch_tdep (gdbarch)->fpregs_present)
&& tdep->fpregs_present)
{
/* fmovem.x REGS,-(%sp) */
op = read_memory_unsigned_integer (pc + 2, 2, byte_order);
@ -1051,7 +1058,7 @@ m68k_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc)
gdb_byte *buf;
CORE_ADDR sp, jb_addr;
struct gdbarch *gdbarch = get_frame_arch (frame);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
m68k_gdbarch_tdep *tdep = (m68k_gdbarch_tdep *) gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
if (tdep->jb_pc < 0)
@ -1097,7 +1104,7 @@ m68k_return_in_first_hidden_param_p (struct gdbarch *gdbarch,
void
m68k_svr4_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
m68k_gdbarch_tdep *tdep = (m68k_gdbarch_tdep *) gdbarch_tdep (gdbarch);
/* SVR4 uses a different calling convention. */
set_gdbarch_return_value (gdbarch, m68k_svr4_return_value);
@ -1115,7 +1122,7 @@ m68k_svr4_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
static void
m68k_embedded_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
m68k_gdbarch_tdep *tdep = (m68k_gdbarch_tdep *) gdbarch_tdep (gdbarch);
m68k_svr4_init_abi (info, gdbarch);
tdep->pointer_result_regnum = M68K_D0_REGNUM;
@ -1130,7 +1137,6 @@ m68k_embedded_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
static struct gdbarch *
m68k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
struct gdbarch_tdep *tdep = NULL;
struct gdbarch *gdbarch;
struct gdbarch_list *best_arch;
tdesc_arch_data_up tdesc_data;
@ -1230,13 +1236,16 @@ m68k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
best_arch != NULL;
best_arch = gdbarch_list_lookup_by_info (best_arch->next, &info))
{
if (flavour != gdbarch_tdep (best_arch->gdbarch)->flavour)
m68k_gdbarch_tdep *tdep
= (m68k_gdbarch_tdep *) gdbarch_tdep (best_arch->gdbarch);
if (flavour != tdep->flavour)
continue;
if (has_fp != gdbarch_tdep (best_arch->gdbarch)->fpregs_present)
if (has_fp != tdep->fpregs_present)
continue;
if (float_return != gdbarch_tdep (best_arch->gdbarch)->float_return)
if (float_return != tdep->float_return)
continue;
break;
@ -1245,7 +1254,7 @@ m68k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
if (best_arch != NULL)
return best_arch->gdbarch;
tdep = XCNEW (struct gdbarch_tdep);
m68k_gdbarch_tdep *tdep = new m68k_gdbarch_tdep;
gdbarch = gdbarch_alloc (&info, tdep);
tdep->fpregs_present = has_fp;
tdep->float_return = float_return;
@ -1330,7 +1339,7 @@ m68k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
static void
m68k_dump_tdep (struct gdbarch *gdbarch, struct ui_file *file)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
m68k_gdbarch_tdep *tdep = (m68k_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (tdep == NULL)
return;

View File

@ -67,38 +67,38 @@ enum m68k_flavour
/* Target-dependent structure in gdbarch. */
struct gdbarch_tdep
struct m68k_gdbarch_tdep : gdbarch_tdep
{
/* Offset to PC value in the jump buffer. If this is negative,
longjmp support will be disabled. */
int jb_pc;
int jb_pc = 0;
/* The size of each entry in the jump buffer. */
size_t jb_elt_size;
size_t jb_elt_size = 0;
/* Register in which the address to store a structure value is
passed to a function. */
int struct_value_regnum;
int struct_value_regnum = 0;
/* Register in which a pointer value is returned. In the SVR4 ABI,
this is %a0, but in GCC's "embedded" ABI, this is %d0. */
int pointer_result_regnum;
int pointer_result_regnum = 0;
/* Convention for returning structures. */
enum struct_return struct_return;
enum struct_return struct_return {};
/* Convention for returning floats. zero in int regs, non-zero in float. */
int float_return;
int float_return = 0;
/* The particular flavour of m68k. */
enum m68k_flavour flavour;
enum m68k_flavour flavour {};
/* Flag set if the floating point registers are present, or assumed
to be present. */
int fpregs_present;
int fpregs_present = 0;
/* ISA-specific data types. */
struct type *m68k_ps_type;
struct type *m68881_ext_type;
struct type *m68k_ps_type = nullptr;
struct type *m68881_ext_type = nullptr;
};
/* Initialize a SVR4 architecture variant. */

View File

@ -116,7 +116,7 @@
options are present on the current processor. */
struct gdbarch_tdep
struct mep_gdbarch_tdep : gdbarch_tdep
{
/* A CGEN cpu descriptor for this BFD architecture and machine.
@ -124,7 +124,7 @@ struct gdbarch_tdep
MeP libopcodes machinery actually puts off module-specific
customization until the last minute. So this contains
information about all supported me_modules. */
CGEN_CPU_DESC cpu_desc;
CGEN_CPU_DESC cpu_desc = nullptr;
/* The me_module index from the ELF file we used to select this
architecture, or CONFIG_NONE if there was none.
@ -140,7 +140,7 @@ struct gdbarch_tdep
create a separate instance of the gdbarch structure for each
me_module value mep_gdbarch_init sees, and store the me_module
value from the ELF file here. */
CONFIG_ATTR me_module;
CONFIG_ATTR me_module {};
};
@ -259,7 +259,9 @@ me_module_register_set (CONFIG_ATTR me_module,
mask contains any of the me_module's coprocessor ISAs,
specifically excluding the generic coprocessor register sets. */
CGEN_CPU_DESC desc = gdbarch_tdep (target_gdbarch ())->cpu_desc;
mep_gdbarch_tdep *tdep
= (mep_gdbarch_tdep *) gdbarch_tdep (target_gdbarch ());
CGEN_CPU_DESC desc = tdep->cpu_desc;
const CGEN_HW_ENTRY *hw;
if (me_module == CONFIG_NONE)
@ -852,7 +854,11 @@ current_me_module (void)
return (CONFIG_ATTR) regval;
}
else
return gdbarch_tdep (target_gdbarch ())->me_module;
{
mep_gdbarch_tdep *tdep
= (mep_gdbarch_tdep *) gdbarch_tdep (target_gdbarch ());
return tdep->me_module;
}
}
@ -2326,7 +2332,6 @@ static struct gdbarch *
mep_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
struct gdbarch *gdbarch;
struct gdbarch_tdep *tdep;
/* Which me_module are we building a gdbarch object for? */
CONFIG_ATTR me_module;
@ -2384,10 +2389,15 @@ mep_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
for (arches = gdbarch_list_lookup_by_info (arches, &info);
arches != NULL;
arches = gdbarch_list_lookup_by_info (arches->next, &info))
if (gdbarch_tdep (arches->gdbarch)->me_module == me_module)
return arches->gdbarch;
{
mep_gdbarch_tdep *tdep
= (mep_gdbarch_tdep *) gdbarch_tdep (arches->gdbarch);
tdep = XCNEW (struct gdbarch_tdep);
if (tdep->me_module == me_module)
return arches->gdbarch;
}
mep_gdbarch_tdep *tdep = new mep_gdbarch_tdep;
gdbarch = gdbarch_alloc (&info, tdep);
/* Get a CGEN CPU descriptor for this architecture. */

View File

@ -650,7 +650,6 @@ microblaze_register_g_packet_guesses (struct gdbarch *gdbarch)
static struct gdbarch *
microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
struct gdbarch_tdep *tdep;
struct gdbarch *gdbarch;
tdesc_arch_data_up tdesc_data;
const struct target_desc *tdesc = info.target_desc;
@ -697,7 +696,7 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
}
/* Allocate space for the new architecture. */
tdep = XCNEW (struct gdbarch_tdep);
microblaze_gdbarch_tdep *tdep = new microblaze_gdbarch_tdep;
gdbarch = gdbarch_alloc (&info, tdep);
set_gdbarch_long_double_bit (gdbarch, 128);

View File

@ -22,7 +22,7 @@
/* Microblaze architecture-specific information. */
struct gdbarch_tdep
struct microblaze_gdbarch_tdep : gdbarch_tdep
{
};

View File

@ -1317,7 +1317,7 @@ mips_linux_get_syscall_number (struct gdbarch *gdbarch,
thread_info *thread)
{
struct regcache *regcache = get_thread_regcache (thread);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
mips_gdbarch_tdep *tdep = (mips_gdbarch_tdep *) gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int regsize = register_size (gdbarch, MIPS_V0_REGNUM);
/* The content of a register */
@ -1527,7 +1527,7 @@ static void
mips_linux_init_abi (struct gdbarch_info info,
struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
mips_gdbarch_tdep *tdep = (mips_gdbarch_tdep *) gdbarch_tdep (gdbarch);
enum mips_abi abi = mips_abi (gdbarch);
struct tdesc_arch_data *tdesc_data = info.tdesc_data;

View File

@ -227,7 +227,8 @@ static const char mips_disassembler_options_n64[] = "gpr-names=64";
const struct mips_regnum *
mips_regnum (struct gdbarch *gdbarch)
{
return gdbarch_tdep (gdbarch)->regnum;
mips_gdbarch_tdep *tdep = (mips_gdbarch_tdep *) gdbarch_tdep (gdbarch);
return tdep->regnum;
}
static int
@ -248,29 +249,47 @@ mips_float_register_p (struct gdbarch *gdbarch, int regnum)
&& rawnum < mips_regnum (gdbarch)->fp0 + 32);
}
#define MIPS_EABI(gdbarch) (gdbarch_tdep (gdbarch)->mips_abi \
== MIPS_ABI_EABI32 \
|| gdbarch_tdep (gdbarch)->mips_abi == MIPS_ABI_EABI64)
static bool
mips_eabi (gdbarch *arch)
{
mips_gdbarch_tdep *tdep = (mips_gdbarch_tdep *) gdbarch_tdep (arch);
return (tdep->mips_abi == MIPS_ABI_EABI32 \
|| tdep->mips_abi == MIPS_ABI_EABI64);
}
#define MIPS_LAST_FP_ARG_REGNUM(gdbarch) \
(gdbarch_tdep (gdbarch)->mips_last_fp_arg_regnum)
static int
mips_last_fp_arg_regnum (gdbarch *arch)
{
mips_gdbarch_tdep *tdep = (mips_gdbarch_tdep *) gdbarch_tdep (arch);
return tdep->mips_last_fp_arg_regnum;
}
#define MIPS_LAST_ARG_REGNUM(gdbarch) \
(gdbarch_tdep (gdbarch)->mips_last_arg_regnum)
static int
mips_last_arg_regnum (gdbarch *arch)
{
mips_gdbarch_tdep *tdep = (mips_gdbarch_tdep *) gdbarch_tdep (arch);
return tdep->mips_last_arg_regnum;
}
#define MIPS_FPU_TYPE(gdbarch) (gdbarch_tdep (gdbarch)->mips_fpu_type)
static enum mips_fpu_type
mips_get_fpu_type (gdbarch *arch)
{
mips_gdbarch_tdep *tdep = (mips_gdbarch_tdep *) gdbarch_tdep (arch);
return tdep->mips_fpu_type;
}
/* Return the MIPS ABI associated with GDBARCH. */
enum mips_abi
mips_abi (struct gdbarch *gdbarch)
{
return gdbarch_tdep (gdbarch)->mips_abi;
mips_gdbarch_tdep *tdep = (mips_gdbarch_tdep *) gdbarch_tdep (gdbarch);
return tdep->mips_abi;
}
int
mips_isa_regsize (struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
mips_gdbarch_tdep *tdep = (mips_gdbarch_tdep *) gdbarch_tdep (gdbarch);
/* If we know how big the registers are, use that size. */
if (tdep->register_size_valid_p)
@ -316,7 +335,8 @@ mips_abi_regsize (struct gdbarch *gdbarch)
static int
is_mips16_isa (struct gdbarch *gdbarch)
{
return gdbarch_tdep (gdbarch)->mips_isa == ISA_MIPS16;
mips_gdbarch_tdep *tdep = (mips_gdbarch_tdep *) gdbarch_tdep (gdbarch);
return tdep->mips_isa == ISA_MIPS16;
}
/* Return one iff compressed code is the microMIPS instruction set. */
@ -324,7 +344,8 @@ is_mips16_isa (struct gdbarch *gdbarch)
static int
is_micromips_isa (struct gdbarch *gdbarch)
{
return gdbarch_tdep (gdbarch)->mips_isa == ISA_MICROMIPS;
mips_gdbarch_tdep *tdep = (mips_gdbarch_tdep *) gdbarch_tdep (gdbarch);
return tdep->mips_isa == ISA_MICROMIPS;
}
/* Return one iff ADDR denotes compressed code. */
@ -615,7 +636,7 @@ static const char * const mips_linux_reg_names[NUM_MIPS_PROCESSOR_REGS] = {
static const char *
mips_register_name (struct gdbarch *gdbarch, int regno)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
mips_gdbarch_tdep *tdep = (mips_gdbarch_tdep *) gdbarch_tdep (gdbarch);
/* GPR names for all ABIs other than n32/n64. */
static const char *mips_gpr_names[] = {
"zero", "at", "v0", "v1", "a0", "a1", "a2", "a3",
@ -756,7 +777,9 @@ mips_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache,
else if (register_size (gdbarch, rawnum) >
register_size (gdbarch, cookednum))
{
if (gdbarch_tdep (gdbarch)->mips64_transfers_32bit_regs_p)
mips_gdbarch_tdep *tdep = (mips_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (tdep->mips64_transfers_32bit_regs_p)
return regcache->raw_read_part (rawnum, 0, 4, buf);
else
{
@ -787,7 +810,9 @@ mips_pseudo_register_write (struct gdbarch *gdbarch,
else if (register_size (gdbarch, rawnum) >
register_size (gdbarch, cookednum))
{
if (gdbarch_tdep (gdbarch)->mips64_transfers_32bit_regs_p)
mips_gdbarch_tdep *tdep = (mips_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (tdep->mips64_transfers_32bit_regs_p)
regcache->raw_write_part (rawnum, 0, 4, buf);
else
{
@ -829,7 +854,10 @@ mips_ax_pseudo_register_push_stack (struct gdbarch *gdbarch,
if (register_size (gdbarch, rawnum) > register_size (gdbarch, reg))
{
if (!gdbarch_tdep (gdbarch)->mips64_transfers_32bit_regs_p
mips_gdbarch_tdep *tdep
= (mips_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (!tdep->mips64_transfers_32bit_regs_p
|| gdbarch_byte_order (gdbarch) != BFD_ENDIAN_BIG)
{
ax_const_l (ax, 32);
@ -1031,6 +1059,7 @@ mips_register_type (struct gdbarch *gdbarch, int regnum)
else
{
int rawnum = regnum - gdbarch_num_regs (gdbarch);
mips_gdbarch_tdep *tdep = (mips_gdbarch_tdep *) gdbarch_tdep (gdbarch);
/* The cooked or ABI registers. These are sized according to
the ABI (with a few complications). */
@ -1043,7 +1072,7 @@ mips_register_type (struct gdbarch *gdbarch, int regnum)
/* The pseudo/cooked view of the embedded registers is always
32-bit. The raw view is handled below. */
return builtin_type (gdbarch)->builtin_int32;
else if (gdbarch_tdep (gdbarch)->mips64_transfers_32bit_regs_p)
else if (tdep->mips64_transfers_32bit_regs_p)
/* The target, while possibly using a 64-bit register buffer,
is only transfering 32-bits of each integer register.
Reflect this in the cooked/pseudo (ABI) register value. */
@ -1132,7 +1161,7 @@ mips_pseudo_register_type (struct gdbarch *gdbarch, int regnum)
static enum auto_boolean mask_address_var = AUTO_BOOLEAN_AUTO;
static int
mips_mask_address_p (struct gdbarch_tdep *tdep)
mips_mask_address_p (mips_gdbarch_tdep *tdep)
{
switch (mask_address_var)
{
@ -1154,7 +1183,8 @@ static void
show_mask_address (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (target_gdbarch ());
mips_gdbarch_tdep *tdep
= (mips_gdbarch_tdep *) gdbarch_tdep (target_gdbarch ());
deprecated_show_value_hack (file, from_tty, c, value);
switch (mask_address_var)
@ -1698,9 +1728,9 @@ mips32_next_pc (struct regcache *regcache, CORE_ADDR pc)
break;
case 12: /* SYSCALL */
{
struct gdbarch_tdep *tdep;
mips_gdbarch_tdep *tdep
= (mips_gdbarch_tdep *) gdbarch_tdep (gdbarch);
tdep = gdbarch_tdep (gdbarch);
if (tdep->syscall_next_pc != NULL)
pc = tdep->syscall_next_pc (get_current_frame ());
else
@ -1909,9 +1939,9 @@ micromips_next_pc (struct regcache *regcache, CORE_ADDR pc)
break;
case 0x22d: /* SYSCALL: 000000 1000101101 111100 */
{
struct gdbarch_tdep *tdep;
mips_gdbarch_tdep *tdep
= (mips_gdbarch_tdep *) gdbarch_tdep (gdbarch);
tdep = gdbarch_tdep (gdbarch);
if (tdep->syscall_next_pc != NULL)
pc = tdep->syscall_next_pc (get_current_frame ());
}
@ -3870,7 +3900,7 @@ mips_stub_frame_base_sniffer (struct frame_info *this_frame)
static CORE_ADDR
mips_addr_bits_remove (struct gdbarch *gdbarch, CORE_ADDR addr)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
mips_gdbarch_tdep *tdep = (mips_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (mips_mask_address_p (tdep) && (((ULONGEST) addr) >> 32 == 0xffffffffUL))
/* This hack is a work-around for existing boards using PMON, the
@ -4405,13 +4435,13 @@ fp_register_arg_p (struct gdbarch *gdbarch, enum type_code typecode,
struct type *arg_type)
{
return ((typecode == TYPE_CODE_FLT
|| (MIPS_EABI (gdbarch)
|| (mips_eabi (gdbarch)
&& (typecode == TYPE_CODE_STRUCT
|| typecode == TYPE_CODE_UNION)
&& arg_type->num_fields () == 1
&& check_typedef (arg_type->field (0).type ())->code ()
== TYPE_CODE_FLT))
&& MIPS_FPU_TYPE(gdbarch) != MIPS_FPU_NONE);
&& mips_get_fpu_type (gdbarch) != MIPS_FPU_NONE);
}
/* On o32, argument passing in GPRs depends on the alignment of the type being
@ -4611,7 +4641,7 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
point value into an FP register instead of pushing it onto the
stack. */
if (fp_register_arg_p (gdbarch, typecode, arg_type)
&& float_argreg <= MIPS_LAST_FP_ARG_REGNUM (gdbarch))
&& float_argreg <= mips_last_fp_arg_regnum (gdbarch))
{
/* EABI32 will pass doubles in consecutive registers, even on
64-bit cores. At one time, we used to check the size of
@ -4678,7 +4708,7 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
partial_len);
/* Write this portion of the argument to the stack. */
if (argreg > MIPS_LAST_ARG_REGNUM (gdbarch)
if (argreg > mips_last_arg_regnum (gdbarch)
|| odd_sized_struct
|| fp_register_arg_p (gdbarch, typecode, arg_type))
{
@ -4729,7 +4759,7 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
arguments will not. */
/* Write this portion of the argument to a general
purpose register. */
if (argreg <= MIPS_LAST_ARG_REGNUM (gdbarch)
if (argreg <= mips_last_arg_regnum (gdbarch)
&& !fp_register_arg_p (gdbarch, typecode, arg_type))
{
LONGEST regval =
@ -4773,7 +4803,7 @@ mips_eabi_return_value (struct gdbarch *gdbarch, struct value *function,
struct type *type, struct regcache *regcache,
gdb_byte *readbuf, const gdb_byte *writebuf)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
mips_gdbarch_tdep *tdep = (mips_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int fp_return_type = 0;
int offset, regnum, xfer;
@ -4845,7 +4875,7 @@ mips_n32n64_fp_arg_chunk_p (struct gdbarch *gdbarch, struct type *arg_type,
if (arg_type->code () != TYPE_CODE_STRUCT)
return 0;
if (MIPS_FPU_TYPE (gdbarch) != MIPS_FPU_DOUBLE)
if (mips_get_fpu_type (gdbarch) != MIPS_FPU_DOUBLE)
return 0;
if (TYPE_LENGTH (arg_type) < offset + MIPS64_REGSIZE)
@ -4973,7 +5003,7 @@ mips_n32n64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
}
if (fp_register_arg_p (gdbarch, typecode, arg_type)
&& argreg <= MIPS_LAST_ARG_REGNUM (gdbarch))
&& argreg <= mips_last_arg_regnum (gdbarch))
{
/* This is a floating point value that fits entirely
in a single register or a pair of registers. */
@ -5033,10 +5063,10 @@ mips_n32n64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
partial_len);
if (fp_register_arg_p (gdbarch, typecode, arg_type))
gdb_assert (argreg > MIPS_LAST_ARG_REGNUM (gdbarch));
gdb_assert (argreg > mips_last_arg_regnum (gdbarch));
/* Write this portion of the argument to the stack. */
if (argreg > MIPS_LAST_ARG_REGNUM (gdbarch))
if (argreg > mips_last_arg_regnum (gdbarch))
{
/* Should shorter than int integer values be
promoted to int before being stored? */
@ -5079,7 +5109,7 @@ mips_n32n64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
structs may go thru BOTH paths. */
/* Write this portion of the argument to a general
purpose register. */
if (argreg <= MIPS_LAST_ARG_REGNUM (gdbarch))
if (argreg <= mips_last_arg_regnum (gdbarch))
{
LONGEST regval;
@ -5164,7 +5194,7 @@ mips_n32n64_return_value (struct gdbarch *gdbarch, struct value *function,
struct type *type, struct regcache *regcache,
gdb_byte *readbuf, const gdb_byte *writebuf)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
mips_gdbarch_tdep *tdep = (mips_gdbarch_tdep *) gdbarch_tdep (gdbarch);
/* From MIPSpro N32 ABI Handbook, Document Number: 007-2816-004
@ -5451,7 +5481,7 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
registers are normally skipped. */
if (fp_register_arg_p (gdbarch, typecode, arg_type)
&& float_argreg <= MIPS_LAST_FP_ARG_REGNUM (gdbarch))
&& float_argreg <= mips_last_fp_arg_regnum (gdbarch))
{
if (register_size (gdbarch, float_argreg) < 8 && len == 8)
{
@ -5541,7 +5571,7 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
partial_len);
/* Write this portion of the argument to the stack. */
if (argreg > MIPS_LAST_ARG_REGNUM (gdbarch)
if (argreg > mips_last_arg_regnum (gdbarch)
|| odd_sized_struct)
{
/* Should shorter than int integer values be
@ -5577,7 +5607,7 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
structs may go thru BOTH paths. */
/* Write this portion of the argument to a general
purpose register. */
if (argreg <= MIPS_LAST_ARG_REGNUM (gdbarch))
if (argreg <= mips_last_arg_regnum (gdbarch))
{
LONGEST regval = extract_signed_integer (val, partial_len,
byte_order);
@ -5625,7 +5655,7 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* Prevent subsequent floating point arguments from
being passed in floating point registers. */
float_argreg = MIPS_LAST_FP_ARG_REGNUM (gdbarch) + 1;
float_argreg = mips_last_fp_arg_regnum (gdbarch) + 1;
}
len -= partial_len;
@ -5659,7 +5689,7 @@ mips_o32_return_value (struct gdbarch *gdbarch, struct value *function,
{
CORE_ADDR func_addr = function ? find_function_addr (function, NULL) : 0;
int mips16 = mips_pc_is_mips16 (gdbarch, func_addr);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
mips_gdbarch_tdep *tdep = (mips_gdbarch_tdep *) gdbarch_tdep (gdbarch);
enum mips_fval_reg fval_reg;
fval_reg = readbuf ? mips16 ? mips_fval_gpr : mips_fval_fpr : mips_fval_both;
@ -5960,7 +5990,7 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
functions because those registers are normally skipped. */
if (fp_register_arg_p (gdbarch, typecode, arg_type)
&& float_argreg <= MIPS_LAST_FP_ARG_REGNUM (gdbarch))
&& float_argreg <= mips_last_fp_arg_regnum (gdbarch))
{
LONGEST regval = extract_unsigned_integer (val, len, byte_order);
if (mips_debug)
@ -5995,7 +6025,7 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
partial_len);
/* Write this portion of the argument to the stack. */
if (argreg > MIPS_LAST_ARG_REGNUM (gdbarch)
if (argreg > mips_last_arg_regnum (gdbarch)
|| odd_sized_struct)
{
/* Should shorter than int integer values be
@ -6039,7 +6069,7 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
structs may go thru BOTH paths. */
/* Write this portion of the argument to a general
purpose register. */
if (argreg <= MIPS_LAST_ARG_REGNUM (gdbarch))
if (argreg <= mips_last_arg_regnum (gdbarch))
{
LONGEST regval = extract_signed_integer (val, partial_len,
byte_order);
@ -6071,7 +6101,7 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* Prevent subsequent floating point arguments from
being passed in floating point registers. */
float_argreg = MIPS_LAST_FP_ARG_REGNUM (gdbarch) + 1;
float_argreg = mips_last_fp_arg_regnum (gdbarch) + 1;
}
len -= partial_len;
@ -6403,7 +6433,7 @@ mips_print_float_info (struct gdbarch *gdbarch, struct ui_file *file,
struct frame_info *frame, const char *args)
{
int fcsr = mips_regnum (gdbarch)->fp_control_status;
enum mips_fpu_type type = MIPS_FPU_TYPE (gdbarch);
enum mips_fpu_type type = mips_get_fpu_type (gdbarch);
ULONGEST fcs = 0;
int i;
@ -6891,7 +6921,7 @@ show_mipsfpu_command (const char *args, int from_tty)
return;
}
switch (MIPS_FPU_TYPE (target_gdbarch ()))
switch (mips_get_fpu_type (target_gdbarch ()))
{
case MIPS_FPU_SINGLE:
fpu = "single-precision";
@ -8038,7 +8068,6 @@ static struct gdbarch *
mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
struct gdbarch *gdbarch;
struct gdbarch_tdep *tdep;
int elf_flags;
enum mips_abi mips_abi, found_abi, wanted_abi;
int i, num_regs;
@ -8055,7 +8084,11 @@ mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
if (info.abfd && bfd_get_flavour (info.abfd) == bfd_target_elf_flavour)
elf_flags = elf_elfheader (info.abfd)->e_flags;
else if (arches != NULL)
elf_flags = gdbarch_tdep (arches->gdbarch)->elf_flags;
{
mips_gdbarch_tdep *tdep
= (mips_gdbarch_tdep *) gdbarch_tdep (arches->gdbarch);
elf_flags = tdep->elf_flags;
}
else
elf_flags = 0;
if (gdbarch_debug)
@ -8092,7 +8125,11 @@ mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* If we have no useful BFD information, use the ABI from the last
MIPS architecture (if there is one). */
if (found_abi == MIPS_ABI_UNKNOWN && info.abfd == NULL && arches != NULL)
found_abi = gdbarch_tdep (arches->gdbarch)->found_abi;
{
mips_gdbarch_tdep *tdep
= (mips_gdbarch_tdep *) gdbarch_tdep (arches->gdbarch);
found_abi = tdep->found_abi;
}
/* Try the architecture for any hint of the correct ABI. */
if (found_abi == MIPS_ABI_UNKNOWN
@ -8223,7 +8260,7 @@ mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
break;
}
else if (arches != NULL)
fpu_type = MIPS_FPU_TYPE (arches->gdbarch);
fpu_type = mips_get_fpu_type (arches->gdbarch);
else
fpu_type = MIPS_FPU_DOUBLE;
if (gdbarch_debug)
@ -8406,28 +8443,31 @@ mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
arches != NULL;
arches = gdbarch_list_lookup_by_info (arches->next, &info))
{
mips_gdbarch_tdep *tdep
= (mips_gdbarch_tdep *) gdbarch_tdep (arches->gdbarch);
/* MIPS needs to be pedantic about which ABI and the compressed
ISA variation the object is using. */
if (gdbarch_tdep (arches->gdbarch)->elf_flags != elf_flags)
if (tdep->elf_flags != elf_flags)
continue;
if (gdbarch_tdep (arches->gdbarch)->mips_abi != mips_abi)
if (tdep->mips_abi != mips_abi)
continue;
if (gdbarch_tdep (arches->gdbarch)->mips_isa != mips_isa)
if (tdep->mips_isa != mips_isa)
continue;
/* Need to be pedantic about which register virtual size is
used. */
if (gdbarch_tdep (arches->gdbarch)->mips64_transfers_32bit_regs_p
if (tdep->mips64_transfers_32bit_regs_p
!= mips64_transfers_32bit_regs_p)
continue;
/* Be pedantic about which FPU is selected. */
if (MIPS_FPU_TYPE (arches->gdbarch) != fpu_type)
if (mips_get_fpu_type (arches->gdbarch) != fpu_type)
continue;
return arches->gdbarch;
}
/* Need a new architecture. Fill in a target specific vector. */
tdep = XCNEW (struct gdbarch_tdep);
mips_gdbarch_tdep *tdep = new mips_gdbarch_tdep;
gdbarch = gdbarch_alloc (&info, tdep);
tdep->elf_flags = elf_flags;
tdep->mips64_transfers_32bit_regs_p = mips64_transfers_32bit_regs_p;
@ -8862,7 +8902,7 @@ mips_fpu_type_str (enum mips_fpu_type fpu_type)
static void
mips_dump_tdep (struct gdbarch *gdbarch, struct ui_file *file)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
mips_gdbarch_tdep *tdep = (mips_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (tdep != NULL)
{
int ef_mips_arch;
@ -8911,11 +8951,11 @@ mips_dump_tdep (struct gdbarch *gdbarch, struct ui_file *file)
MIPS_DEFAULT_FPU_TYPE,
mips_fpu_type_str (MIPS_DEFAULT_FPU_TYPE));
fprintf_unfiltered (file, "mips_dump_tdep: MIPS_EABI = %d\n",
MIPS_EABI (gdbarch));
mips_eabi (gdbarch));
fprintf_unfiltered (file,
"mips_dump_tdep: MIPS_FPU_TYPE = %d (%s)\n",
MIPS_FPU_TYPE (gdbarch),
mips_fpu_type_str (MIPS_FPU_TYPE (gdbarch)));
mips_get_fpu_type (gdbarch),
mips_fpu_type_str (mips_get_fpu_type (gdbarch)));
}
void _initialize_mips_tdep ();

View File

@ -83,39 +83,39 @@ enum mips_fpu_type
};
/* MIPS specific per-architecture information. */
struct gdbarch_tdep
struct mips_gdbarch_tdep : gdbarch_tdep
{
/* from the elf header */
int elf_flags;
int elf_flags = 0;
/* mips options */
enum mips_abi mips_abi;
enum mips_abi found_abi;
enum mips_isa mips_isa;
enum mips_fpu_type mips_fpu_type;
int mips_last_arg_regnum;
int mips_last_fp_arg_regnum;
int default_mask_address_p;
enum mips_abi mips_abi {};
enum mips_abi found_abi {};
enum mips_isa mips_isa {};
enum mips_fpu_type mips_fpu_type {};
int mips_last_arg_regnum = 0;
int mips_last_fp_arg_regnum = 0;
int default_mask_address_p = 0;
/* Is the target using 64-bit raw integer registers but only
storing a left-aligned 32-bit value in each? */
int mips64_transfers_32bit_regs_p;
int mips64_transfers_32bit_regs_p = 0;
/* Indexes for various registers. IRIX and embedded have
different values. This contains the "public" fields. Don't
add any that do not need to be public. */
const struct mips_regnum *regnum;
const struct mips_regnum *regnum = nullptr;
/* Register names table for the current register set. */
const char * const *mips_processor_reg_names;
const char * const *mips_processor_reg_names = nullptr;
/* The size of register data available from the target, if known.
This doesn't quite obsolete the manual
mips64_transfers_32bit_regs_p, since that is documented to force
left alignment even for big endian (very strange). */
int register_size_valid_p;
int register_size;
int register_size_valid_p = 0;
int register_size = 0;
/* Return the expected next PC if FRAME is stopped at a syscall
instruction. */
CORE_ADDR (*syscall_next_pc) (struct frame_info *frame);
CORE_ADDR (*syscall_next_pc) (struct frame_info *frame) = nullptr;
};
/* Register numbers of various important registers. */

View File

@ -372,7 +372,7 @@ mn10300_analyze_prologue (struct gdbarch *gdbarch,
int rn;
pv_t regs[MN10300_MAX_NUM_REGS];
CORE_ADDR after_last_frame_setup_insn = start_pc;
int am33_mode = AM33_MODE (gdbarch);
int am33_mode = get_am33_mode (gdbarch);
memset (result, 0, sizeof (*result));
result->gdbarch = gdbarch;
@ -1337,14 +1337,13 @@ mn10300_gdbarch_init (struct gdbarch_info info,
struct gdbarch_list *arches)
{
struct gdbarch *gdbarch;
struct gdbarch_tdep *tdep;
int num_regs;
arches = gdbarch_list_lookup_by_info (arches, &info);
if (arches != NULL)
return arches->gdbarch;
tdep = XCNEW (struct gdbarch_tdep);
mn10300_gdbarch_tdep *tdep = new mn10300_gdbarch_tdep;
gdbarch = gdbarch_alloc (&info, tdep);
switch (info.bfd_arch_info->mach)
@ -1413,7 +1412,7 @@ mn10300_gdbarch_init (struct gdbarch_info info,
static void
mn10300_dump_tdep (struct gdbarch *gdbarch, struct ui_file *file)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
mn10300_gdbarch_tdep *tdep = (mn10300_gdbarch_tdep *) gdbarch_tdep (gdbarch);
fprintf_unfiltered (file, "mn10300_dump_tdep: am33_mode = %d\n",
tdep->am33_mode);
}

View File

@ -20,6 +20,8 @@
#ifndef MN10300_TDEP_H
#define MN10300_TDEP_H
#include "gdbarch.h"
enum {
E_D0_REGNUM = 0,
E_D1_REGNUM = 1,
@ -74,11 +76,16 @@ enum frame_kind {
};
/* mn10300 private data. */
struct gdbarch_tdep
struct mn10300_gdbarch_tdep : gdbarch_tdep
{
int am33_mode;
};
#define AM33_MODE(gdbarch) (gdbarch_tdep (gdbarch)->am33_mode)
static inline int
get_am33_mode (gdbarch *arch)
{
mn10300_gdbarch_tdep *tdep = (mn10300_gdbarch_tdep *) gdbarch_tdep (arch);
return tdep->am33_mode;
}
#endif /* MN10300_TDEP_H */

View File

@ -1052,7 +1052,6 @@ static struct gdbarch *
moxie_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
struct gdbarch *gdbarch;
struct gdbarch_tdep *tdep;
/* If there is already a candidate, use it. */
arches = gdbarch_list_lookup_by_info (arches, &info);
@ -1060,7 +1059,7 @@ moxie_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
return arches->gdbarch;
/* Allocate space for the new architecture. */
tdep = XCNEW (struct gdbarch_tdep);
moxie_gdbarch_tdep *tdep = new moxie_gdbarch_tdep;
gdbarch = gdbarch_alloc (&info, tdep);
set_gdbarch_wchar_bit (gdbarch, 32);

View File

@ -20,7 +20,7 @@
#ifndef MOXIE_TDEP_H
#define MOXIE_TDEP_H
struct gdbarch_tdep
struct moxie_gdbarch_tdep : gdbarch_tdep
{
/* gdbarch target dependent data here. Currently unused for MOXIE. */
};

View File

@ -104,19 +104,19 @@ enum
/* Architecture specific data. */
struct gdbarch_tdep
struct msp430_gdbarch_tdep : gdbarch_tdep
{
/* The ELF header flags specify the multilib used. */
int elf_flags;
int elf_flags = 0;
/* One of MSP_ISA_MSP430 or MSP_ISA_MSP430X. */
int isa;
int isa = 0;
/* One of MSP_SMALL_CODE_MODEL or MSP_LARGE_CODE_MODEL. If, at
some point, we support different data models too, we'll probably
structure things so that we can combine values using logical
"or". */
int code_model;
int code_model = 0;
};
/* This structure holds the results of a prologue analysis. */
@ -340,7 +340,8 @@ msp430_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc,
int rn;
pv_t reg[MSP430_NUM_TOTAL_REGS];
CORE_ADDR after_last_frame_setup_insn = start_pc;
int code_model = gdbarch_tdep (gdbarch)->code_model;
msp430_gdbarch_tdep *tdep = (msp430_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int code_model = tdep->code_model;
int sz;
memset (result, 0, sizeof (*result));
@ -568,7 +569,8 @@ msp430_return_value (struct gdbarch *gdbarch,
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
LONGEST valtype_len = TYPE_LENGTH (valtype);
int code_model = gdbarch_tdep (gdbarch)->code_model;
msp430_gdbarch_tdep *tdep = (msp430_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int code_model = tdep->code_model;
if (TYPE_LENGTH (valtype) > 8
|| valtype->code () == TYPE_CODE_STRUCT
@ -648,7 +650,8 @@ msp430_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
int write_pass;
int sp_off = 0;
CORE_ADDR cfa;
int code_model = gdbarch_tdep (gdbarch)->code_model;
msp430_gdbarch_tdep *tdep = (msp430_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int code_model = tdep->code_model;
struct type *func_type = value_type (function);
@ -766,8 +769,7 @@ msp430_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* Push the return address. */
{
int sz = (gdbarch_tdep (gdbarch)->code_model == MSP_SMALL_CODE_MODEL)
? 2 : 4;
int sz = tdep->code_model == MSP_SMALL_CODE_MODEL ? 2 : 4;
sp = sp - sz;
write_memory_unsigned_integer (sp, sz, byte_order, bp_addr);
}
@ -811,7 +813,8 @@ msp430_skip_trampoline_code (struct frame_info *frame, CORE_ADDR pc)
stub_name = bms.minsym->linkage_name ();
if (gdbarch_tdep (gdbarch)->code_model == MSP_SMALL_CODE_MODEL
msp430_gdbarch_tdep *tdep = (msp430_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (tdep->code_model == MSP_SMALL_CODE_MODEL
&& msp430_in_return_stub (gdbarch, pc, stub_name))
{
CORE_ADDR sp = get_frame_register_unsigned (frame, MSP430_SP_REGNUM);
@ -830,7 +833,6 @@ static struct gdbarch *
msp430_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
struct gdbarch *gdbarch;
struct gdbarch_tdep *tdep;
int elf_flags, isa, code_model;
/* Extract the elf_flags if available. */
@ -873,7 +875,8 @@ msp430_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
struct gdbarch *ca = get_current_arch ();
if (ca && gdbarch_bfd_arch_info (ca)->arch == bfd_arch_msp430)
{
struct gdbarch_tdep *ca_tdep = gdbarch_tdep (ca);
msp430_gdbarch_tdep *ca_tdep
= (msp430_gdbarch_tdep *) gdbarch_tdep (ca);
elf_flags = ca_tdep->elf_flags;
isa = ca_tdep->isa;
@ -899,7 +902,8 @@ msp430_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
arches != NULL;
arches = gdbarch_list_lookup_by_info (arches->next, &info))
{
struct gdbarch_tdep *candidate_tdep = gdbarch_tdep (arches->gdbarch);
msp430_gdbarch_tdep *candidate_tdep
= (msp430_gdbarch_tdep *) gdbarch_tdep (arches->gdbarch);
if (candidate_tdep->elf_flags != elf_flags
|| candidate_tdep->isa != isa
@ -911,7 +915,7 @@ msp430_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* None found, create a new architecture from the information
provided. */
tdep = XCNEW (struct gdbarch_tdep);
msp430_gdbarch_tdep *tdep = new msp430_gdbarch_tdep;
gdbarch = gdbarch_alloc (&info, tdep);
tdep->elf_flags = elf_flags;
tdep->isa = isa;

View File

@ -289,7 +289,7 @@ typedef BP_MANIPULATION (nds32_break_insn) nds32_breakpoint;
static int
nds32_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, int num)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
nds32_gdbarch_tdep *tdep = (nds32_gdbarch_tdep *) gdbarch_tdep (gdbarch);
const int FSR = 38;
const int FDR = FSR + 32;
@ -440,7 +440,7 @@ nds32_pseudo_register_read (struct gdbarch *gdbarch,
readable_regcache *regcache, int regnum,
gdb_byte *buf)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
nds32_gdbarch_tdep *tdep = (nds32_gdbarch_tdep *) gdbarch_tdep (gdbarch);
gdb_byte reg_buf[8];
int offset, fdr_regnum;
enum register_status status;
@ -479,7 +479,7 @@ nds32_pseudo_register_write (struct gdbarch *gdbarch,
struct regcache *regcache, int regnum,
const gdb_byte *buf)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
nds32_gdbarch_tdep *tdep = (nds32_gdbarch_tdep *) gdbarch_tdep (gdbarch);
gdb_byte reg_buf[8];
int offset, fdr_regnum;
@ -616,7 +616,7 @@ static CORE_ADDR
nds32_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
CORE_ADDR limit_pc, struct nds32_frame_cache *cache)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
nds32_gdbarch_tdep *tdep = (nds32_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int abi_use_fpr = nds32_abi_use_fpr (tdep->elf_abi);
/* Current scanning status. */
int in_prologue_bb = 0;
@ -1177,7 +1177,7 @@ static int
nds32_analyze_epilogue (struct gdbarch *gdbarch, CORE_ADDR pc,
struct nds32_frame_cache *cache)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
nds32_gdbarch_tdep *tdep = (nds32_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int abi_use_fpr = nds32_abi_use_fpr (tdep->elf_abi);
CORE_ADDR limit_pc;
uint32_t insn, insn_len;
@ -1228,7 +1228,7 @@ nds32_analyze_epilogue (struct gdbarch *gdbarch, CORE_ADDR pc,
static int
nds32_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR addr)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
nds32_gdbarch_tdep *tdep = (nds32_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int abi_use_fpr = nds32_abi_use_fpr (tdep->elf_abi);
int insn_type = INSN_NORMAL;
int ret_found = 0;
@ -1432,7 +1432,7 @@ nds32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
int i;
ULONGEST regval;
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
nds32_gdbarch_tdep *tdep = (nds32_gdbarch_tdep *) gdbarch_tdep (gdbarch);
struct type *func_type = value_type (function);
int abi_use_fpr = nds32_abi_use_fpr (tdep->elf_abi);
int abi_split = nds32_abi_split (tdep->elf_abi);
@ -1660,7 +1660,7 @@ nds32_extract_return_value (struct gdbarch *gdbarch, struct type *type,
struct regcache *regcache, gdb_byte *valbuf)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
nds32_gdbarch_tdep *tdep = (nds32_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int abi_use_fpr = nds32_abi_use_fpr (tdep->elf_abi);
int calling_use_fpr;
int len;
@ -1750,7 +1750,7 @@ nds32_store_return_value (struct gdbarch *gdbarch, struct type *type,
struct regcache *regcache, const gdb_byte *valbuf)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
nds32_gdbarch_tdep *tdep = (nds32_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int abi_use_fpr = nds32_abi_use_fpr (tdep->elf_abi);
int calling_use_fpr;
int len;
@ -1955,7 +1955,6 @@ static struct gdbarch *
nds32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
struct gdbarch *gdbarch;
struct gdbarch_tdep *tdep;
struct gdbarch_list *best_arch;
tdesc_arch_data_up tdesc_data;
const struct target_desc *tdesc = info.target_desc;
@ -1973,7 +1972,8 @@ nds32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
best_arch != NULL;
best_arch = gdbarch_list_lookup_by_info (best_arch->next, &info))
{
struct gdbarch_tdep *idep = gdbarch_tdep (best_arch->gdbarch);
nds32_gdbarch_tdep *idep
= (nds32_gdbarch_tdep *) gdbarch_tdep (best_arch->gdbarch);
if (idep->elf_abi != elf_abi)
continue;
@ -1995,7 +1995,7 @@ nds32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
return NULL;
/* Allocate space for the new architecture. */
tdep = XCNEW (struct gdbarch_tdep);
nds32_gdbarch_tdep *tdep = new nds32_gdbarch_tdep;
tdep->fpu_freg = fpu_freg;
tdep->use_pseudo_fsrs = use_pseudo_fsrs;
tdep->fs0_regnum = -1;

View File

@ -40,15 +40,15 @@ enum nds32_regnum
NDS32_FD0_REGNUM = NDS32_NUM_REGS,
};
struct gdbarch_tdep
struct nds32_gdbarch_tdep : gdbarch_tdep
{
/* The guessed FPU configuration. */
int fpu_freg;
int fpu_freg = 0;
/* FSRs are defined as pseudo registers. */
int use_pseudo_fsrs;
int use_pseudo_fsrs = 0;
/* Cached regnum of the first FSR (FS0). */
int fs0_regnum;
int fs0_regnum = 0;
/* ELF ABI info. */
int elf_abi;
int elf_abi = 0;
};
#endif /* NDS32_TDEP_H */

View File

@ -217,7 +217,7 @@ nios2_linux_is_kernel_helper (CORE_ADDR pc)
static void
nios2_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
nios2_gdbarch_tdep *tdep = (nios2_gdbarch_tdep *) gdbarch_tdep (gdbarch);
linux_init_abi (info, gdbarch, 0);

View File

@ -2098,7 +2098,7 @@ static CORE_ADDR
nios2_get_next_pc (struct regcache *regcache, CORE_ADDR pc)
{
struct gdbarch *gdbarch = regcache->arch ();
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
nios2_gdbarch_tdep *tdep = (nios2_gdbarch_tdep *) gdbarch_tdep (gdbarch);
unsigned long mach = gdbarch_bfd_arch_info (gdbarch)->mach;
unsigned int insn;
const struct nios2_opcode *op = nios2_fetch_insn (gdbarch, pc, &insn);
@ -2221,7 +2221,7 @@ static int
nios2_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc)
{
struct gdbarch *gdbarch = get_frame_arch (frame);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
nios2_gdbarch_tdep *tdep = (nios2_gdbarch_tdep *) gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR jb_addr = get_frame_register_unsigned (frame, NIOS2_R4_REGNUM);
gdb_byte buf[4];
@ -2275,7 +2275,6 @@ static struct gdbarch *
nios2_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
struct gdbarch *gdbarch;
struct gdbarch_tdep *tdep;
int i;
tdesc_arch_data_up tdesc_data;
const struct target_desc *tdesc = info.target_desc;
@ -2313,7 +2312,7 @@ nios2_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* None found, create a new architecture from the information
provided. */
tdep = XCNEW (struct gdbarch_tdep);
nios2_gdbarch_tdep *tdep = new nios2_gdbarch_tdep;
gdbarch = gdbarch_alloc (&info, tdep);
/* longjmp support not enabled by default. */

View File

@ -20,6 +20,8 @@
#ifndef NIOS2_TDEP_H
#define NIOS2_TDEP_H
#include "gdbarch.h"
/* Nios II ISA specific encodings and macros. */
#include "opcode/nios2.h"
@ -67,19 +69,19 @@
#define NIOS2_CDX_OPCODE_SIZE 2
/* Target-dependent structure in gdbarch. */
struct gdbarch_tdep
struct nios2_gdbarch_tdep : gdbarch_tdep
{
/* Assumes FRAME is stopped at a syscall (trap) instruction; returns
the expected next PC. */
CORE_ADDR (*syscall_next_pc) (struct frame_info *frame,
const struct nios2_opcode *op);
const struct nios2_opcode *op) = nullptr;
/* Returns true if PC points to a kernel helper function. */
bool (*is_kernel_helper) (CORE_ADDR pc);
bool (*is_kernel_helper) (CORE_ADDR pc) = nullptr;
/* Offset to PC value in jump buffer.
If this is negative, longjmp support will be disabled. */
int jb_pc;
int jb_pc = 0;
};
extern struct target_desc *tdesc_nios2_linux;

View File

@ -62,11 +62,11 @@ show_or1k_debug (struct ui_file *file, int from_tty,
/* The target-dependent structure for gdbarch. */
struct gdbarch_tdep
struct or1k_gdbarch_tdep : gdbarch_tdep
{
int bytes_per_word;
int bytes_per_address;
CGEN_CPU_DESC gdb_cgen_cpu_desc;
int bytes_per_word = 0;
int bytes_per_address = 0;
CGEN_CPU_DESC gdb_cgen_cpu_desc = nullptr;
};
/* Support functions for the architecture definition. */
@ -247,7 +247,8 @@ or1k_return_value (struct gdbarch *gdbarch, struct value *functype,
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
enum type_code rv_type = valtype->code ();
unsigned int rv_size = TYPE_LENGTH (valtype);
int bpw = (gdbarch_tdep (gdbarch))->bytes_per_word;
or1k_gdbarch_tdep *tdep = (or1k_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int bpw = tdep->bytes_per_word;
/* Deal with struct/union as addresses. If an array won't fit in a
single register it is returned as address. Anything larger than 2
@ -351,7 +352,7 @@ or1k_delay_slot_p (struct gdbarch *gdbarch, CORE_ADDR pc)
{
const CGEN_INSN *insn;
CGEN_FIELDS tmp_fields;
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
or1k_gdbarch_tdep *tdep = (or1k_gdbarch_tdep *) gdbarch_tdep (gdbarch);
insn = cgen_lookup_insn (tdep->gdb_cgen_cpu_desc,
NULL,
@ -633,8 +634,9 @@ or1k_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
int heap_offset = 0;
CORE_ADDR heap_sp = sp - 128;
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int bpa = (gdbarch_tdep (gdbarch))->bytes_per_address;
int bpw = (gdbarch_tdep (gdbarch))->bytes_per_word;
or1k_gdbarch_tdep *tdep = (or1k_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int bpa = tdep->bytes_per_address;
int bpw = tdep->bytes_per_word;
struct type *func_type = value_type (function);
/* Return address */
@ -1140,7 +1142,6 @@ static struct gdbarch *
or1k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
struct gdbarch *gdbarch;
struct gdbarch_tdep *tdep;
const struct bfd_arch_info *binfo;
tdesc_arch_data_up tdesc_data;
const struct target_desc *tdesc = info.target_desc;
@ -1155,7 +1156,7 @@ or1k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
actually know which target we are talking to, but put in some defaults
for now. */
binfo = info.bfd_arch_info;
tdep = XCNEW (struct gdbarch_tdep);
or1k_gdbarch_tdep *tdep = new or1k_gdbarch_tdep;
tdep->bytes_per_word = binfo->bits_per_word / binfo->bits_per_byte;
tdep->bytes_per_address = binfo->bits_per_address / binfo->bits_per_byte;
gdbarch = gdbarch_alloc (&info, tdep);
@ -1283,7 +1284,7 @@ or1k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
static void
or1k_dump_tdep (struct gdbarch *gdbarch, struct ui_file *file)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
or1k_gdbarch_tdep *tdep = (or1k_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (NULL == tdep)
return; /* Nothing to report */

View File

@ -126,7 +126,7 @@ ppcfbsd_iterate_over_regset_sections (struct gdbarch *gdbarch,
void *cb_data,
const struct regcache *regcache)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (tdep->wordsize == 4)
cb (".reg", 148, 148, &ppc32_fbsd_gregset, NULL, cb_data);
@ -200,7 +200,7 @@ static struct trad_frame_cache *
ppcfbsd_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
struct trad_frame_cache *cache;
CORE_ADDR addr, base, func;
gdb_byte buf[PPC_INSN_SIZE];
@ -287,7 +287,7 @@ static CORE_ADDR
ppcfbsd_get_thread_local_address (struct gdbarch *gdbarch, ptid_t ptid,
CORE_ADDR lm_addr, CORE_ADDR offset)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
struct regcache *regcache;
int tp_offset, tp_regnum;
@ -319,7 +319,7 @@ ppcfbsd_get_thread_local_address (struct gdbarch *gdbarch, ptid_t ptid,
static void
ppcfbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
/* Generic FreeBSD support. */
fbsd_init_abi (info, gdbarch);

View File

@ -332,7 +332,7 @@ ppc_skip_trampoline_code (struct frame_info *frame, CORE_ADDR pc)
{
unsigned int insnbuf[POWERPC32_PLT_CHECK_LEN];
struct gdbarch *gdbarch = get_frame_arch (frame);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR target = 0;
int scan_limit, i;
@ -898,7 +898,7 @@ ppc_linux_vsxregset (void)
const struct regset *
ppc_linux_cgprregset (struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (tdep->wordsize == 4)
{
@ -938,7 +938,7 @@ ppc_linux_collect_core_cpgrregset (const struct regset *regset,
int regnum, void *buf, size_t len)
{
struct gdbarch *gdbarch = regcache->arch ();
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
const struct regset *cgprregset = ppc_linux_cgprregset (gdbarch);
@ -985,7 +985,7 @@ ppc_linux_iterate_over_regset_sections (struct gdbarch *gdbarch,
void *cb_data,
const struct regcache *regcache)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int have_altivec = tdep->ppc_vr0_regnum != -1;
int have_vsx = tdep->ppc_vsr0_upper_regnum != -1;
int have_ppr = tdep->ppc_ppr_regnum != -1;
@ -1170,7 +1170,7 @@ ppc_linux_sigtramp_cache (struct frame_info *this_frame,
CORE_ADDR fpregs;
int i;
struct gdbarch *gdbarch = get_frame_arch (this_frame);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
base = get_frame_register_unsigned (this_frame,
@ -1341,7 +1341,7 @@ ppc_linux_get_syscall_number (struct gdbarch *gdbarch,
thread_info *thread)
{
struct regcache *regcache = get_thread_regcache (thread);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
/* Make sure we're in a 32- or 64-bit machine */
@ -1417,7 +1417,7 @@ static int
ppc_linux_syscall_record (struct regcache *regcache)
{
struct gdbarch *gdbarch = regcache->arch ();
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
ULONGEST scnum;
enum gdb_syscall syscall_gdb;
int ret;
@ -1506,7 +1506,7 @@ ppc_linux_record_signal (struct gdbarch *gdbarch, struct regcache *regcache,
const int SIGNAL_FRAMESIZE = 128;
const int sizeof_rt_sigframe = 1440 * 2 + 8 * 2 + 4 * 6 + 8 + 8 + 128 + 512;
ULONGEST sp;
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int i;
for (i = 3; i <= 12; i++)
@ -2018,7 +2018,7 @@ static void
ppc_linux_init_abi (struct gdbarch_info info,
struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
struct tdesc_arch_data *tdesc_data = info.tdesc_data;
static const char *const stap_integer_prefixes[] = { "i", NULL };
static const char *const stap_register_indirection_prefixes[] = { "(",

View File

@ -102,7 +102,7 @@ ppcnbsd_sigtramp_cache_init (const struct tramp_frame *self,
CORE_ADDR func)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
CORE_ADDR addr, base;
int i;

View File

@ -161,7 +161,7 @@ static struct trad_frame_cache *
ppcobsd_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct trad_frame_cache *cache;
CORE_ADDR addr, base, func;

View File

@ -65,7 +65,7 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
function_call_return_method return_method,
CORE_ADDR struct_addr)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int opencl_abi = ppc_sysv_use_opencl_abi (value_type (function));
ULONGEST saved_sp;
@ -597,7 +597,7 @@ get_decimal_float_return_value (struct gdbarch *gdbarch, struct type *valtype,
struct regcache *regcache, gdb_byte *readbuf,
const gdb_byte *writebuf)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
gdb_assert (valtype->code () == TYPE_CODE_DECFLOAT);
@ -675,7 +675,7 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *func_type,
gdb_byte *readbuf, const gdb_byte *writebuf,
int broken_gcc)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int opencl_abi = func_type? ppc_sysv_use_opencl_abi (func_type) : 0;
@ -1250,7 +1250,7 @@ ppc64_sysv_abi_push_val (struct gdbarch *gdbarch,
const bfd_byte *val, int len, int align,
struct ppc64_sysv_argpos *argpos)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int offset = 0;
/* Enforce alignment of stack location, if requested. */
@ -1300,7 +1300,7 @@ static void
ppc64_sysv_abi_push_integer (struct gdbarch *gdbarch, ULONGEST val,
struct ppc64_sysv_argpos *argpos)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
gdb_byte buf[PPC_MAX_REGISTER_SIZE];
@ -1318,7 +1318,7 @@ ppc64_sysv_abi_push_freg (struct gdbarch *gdbarch,
struct type *type, const bfd_byte *val,
struct ppc64_sysv_argpos *argpos)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (tdep->soft_float)
return;
@ -1403,7 +1403,7 @@ static void
ppc64_sysv_abi_push_vreg (struct gdbarch *gdbarch, const bfd_byte *val,
struct ppc64_sysv_argpos *argpos)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (argpos->regcache && argpos->vreg <= 13)
argpos->regcache->cooked_write (tdep->ppc_vr0_regnum + argpos->vreg, val);
@ -1419,7 +1419,7 @@ ppc64_sysv_abi_push_param (struct gdbarch *gdbarch,
struct type *type, const bfd_byte *val,
struct ppc64_sysv_argpos *argpos)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (type->code () == TYPE_CODE_FLT
|| type->code () == TYPE_CODE_DECFLOAT)
@ -1545,7 +1545,7 @@ ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch,
CORE_ADDR struct_addr)
{
CORE_ADDR func_addr = find_function_addr (function, NULL);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int opencl_abi = ppc_sysv_use_opencl_abi (value_type (function));
ULONGEST back_chain;
@ -1739,7 +1739,7 @@ ppc64_sysv_abi_return_value_base (struct gdbarch *gdbarch, struct type *valtype,
struct regcache *regcache, gdb_byte *readbuf,
const gdb_byte *writebuf, int index)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
/* Integers live in GPRs starting at r3. */
if ((valtype->code () == TYPE_CODE_INT
@ -1905,7 +1905,7 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function,
struct type *valtype, struct regcache *regcache,
gdb_byte *readbuf, const gdb_byte *writebuf)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
struct type *func_type = function ? value_type (function) : NULL;
int opencl_abi = func_type? ppc_sysv_use_opencl_abi (func_type) : 0;
struct type *eltype;

View File

@ -205,106 +205,106 @@ enum powerpc_long_double_abi
POWERPC_LONG_DOUBLE_LAST
};
struct gdbarch_tdep
struct ppc_gdbarch_tdep : gdbarch_tdep
{
int wordsize; /* Size in bytes of fixed-point word. */
int soft_float; /* Avoid FP registers for arguments? */
int wordsize = 0; /* Size in bytes of fixed-point word. */
int soft_float = 0; /* Avoid FP registers for arguments? */
enum powerpc_elf_abi elf_abi; /* ELF ABI version. */
enum powerpc_elf_abi elf_abi {}; /* ELF ABI version. */
/* Format to use for the "long double" data type. */
enum powerpc_long_double_abi long_double_abi;
enum powerpc_long_double_abi long_double_abi {};
/* How to pass vector arguments. Never set to AUTO or LAST. */
enum powerpc_vector_abi vector_abi;
enum powerpc_vector_abi vector_abi {};
int ppc_gp0_regnum; /* GPR register 0 */
int ppc_toc_regnum; /* TOC register */
int ppc_ps_regnum; /* Processor (or machine) status (%msr) */
int ppc_cr_regnum; /* Condition register */
int ppc_lr_regnum; /* Link register */
int ppc_ctr_regnum; /* Count register */
int ppc_xer_regnum; /* Integer exception register */
int ppc_gp0_regnum = 0; /* GPR register 0 */
int ppc_toc_regnum = 0; /* TOC register */
int ppc_ps_regnum = 0; /* Processor (or machine) status (%msr) */
int ppc_cr_regnum = 0; /* Condition register */
int ppc_lr_regnum = 0; /* Link register */
int ppc_ctr_regnum = 0; /* Count register */
int ppc_xer_regnum = 0; /* Integer exception register */
/* Not all PPC and RS6000 variants will have the registers
represented below. A -1 is used to indicate that the register
is not present in this variant. */
/* Floating-point registers. */
int ppc_fp0_regnum; /* Floating-point register 0. */
int ppc_fpscr_regnum; /* fp status and condition register. */
int ppc_fp0_regnum = 0; /* Floating-point register 0. */
int ppc_fpscr_regnum = 0; /* fp status and condition register. */
/* Multiplier-Quotient Register (older POWER architectures only). */
int ppc_mq_regnum;
int ppc_mq_regnum = 0;
/* POWER7 VSX registers. */
int ppc_vsr0_regnum; /* First VSX register. */
int ppc_vsr0_upper_regnum; /* First right most dword vsx register. */
int ppc_efpr0_regnum; /* First Extended FP register. */
int ppc_vsr0_regnum = 0; /* First VSX register. */
int ppc_vsr0_upper_regnum = 0; /* First right most dword vsx register. */
int ppc_efpr0_regnum = 0; /* First Extended FP register. */
/* Altivec registers. */
int ppc_vr0_regnum; /* First AltiVec register. */
int ppc_vrsave_regnum; /* Last AltiVec register. */
int ppc_vr0_regnum = 0; /* First AltiVec register. */
int ppc_vrsave_regnum = 0; /* Last AltiVec register. */
/* Altivec pseudo-register vX aliases for the raw vrX
registers. */
int ppc_v0_alias_regnum;
int ppc_v0_alias_regnum = 0;
/* SPE registers. */
int ppc_ev0_upper_regnum; /* First GPR upper half register. */
int ppc_ev0_regnum; /* First ev register. */
int ppc_acc_regnum; /* SPE 'acc' register. */
int ppc_spefscr_regnum; /* SPE 'spefscr' register. */
int ppc_ev0_upper_regnum = 0; /* First GPR upper half register. */
int ppc_ev0_regnum = 0; /* First ev register. */
int ppc_acc_regnum = 0; /* SPE 'acc' register. */
int ppc_spefscr_regnum = 0; /* SPE 'spefscr' register. */
/* Program Priority Register. */
int ppc_ppr_regnum;
int ppc_ppr_regnum = 0;
/* Data Stream Control Register. */
int ppc_dscr_regnum;
int ppc_dscr_regnum = 0;
/* Target Address Register. */
int ppc_tar_regnum;
int ppc_tar_regnum = 0;
/* Decimal 128 registers. */
int ppc_dl0_regnum; /* First Decimal128 argument register pair. */
int ppc_dl0_regnum = 0; /* First Decimal128 argument register pair. */
int have_ebb;
int have_ebb = 0;
/* PMU registers. */
int ppc_mmcr0_regnum;
int ppc_mmcr2_regnum;
int ppc_siar_regnum;
int ppc_sdar_regnum;
int ppc_sier_regnum;
int ppc_mmcr0_regnum = 0;
int ppc_mmcr2_regnum = 0;
int ppc_siar_regnum = 0;
int ppc_sdar_regnum = 0;
int ppc_sier_regnum = 0;
/* Hardware Transactional Memory registers. */
int have_htm_spr;
int have_htm_core;
int have_htm_fpu;
int have_htm_altivec;
int have_htm_vsx;
int ppc_cppr_regnum;
int ppc_cdscr_regnum;
int ppc_ctar_regnum;
int have_htm_spr = 0;
int have_htm_core = 0;
int have_htm_fpu = 0;
int have_htm_altivec = 0;
int have_htm_vsx = 0;
int ppc_cppr_regnum = 0;
int ppc_cdscr_regnum = 0;
int ppc_ctar_regnum = 0;
/* HTM pseudo registers. */
int ppc_cdl0_regnum;
int ppc_cvsr0_regnum;
int ppc_cefpr0_regnum;
int ppc_cdl0_regnum = 0;
int ppc_cvsr0_regnum = 0;
int ppc_cefpr0_regnum = 0;
/* Offset to ABI specific location where link register is saved. */
int lr_frame_offset;
int lr_frame_offset = 0;
/* An array of integers, such that sim_regno[I] is the simulator
register number for GDB register number I, or -1 if the
simulator does not implement that register. */
int *sim_regno;
int *sim_regno = nullptr;
/* ISA-specific types. */
struct type *ppc_builtin_type_vec64;
struct type *ppc_builtin_type_vec128;
struct type *ppc_builtin_type_vec64 = nullptr;
struct type *ppc_builtin_type_vec128 = nullptr;
int (*ppc_syscall_record) (struct regcache *regcache);
int (*ppc_syscall_record) (struct regcache *regcache) = nullptr;
};

View File

@ -89,7 +89,7 @@ ppc64_plt_entry_point (struct frame_info *frame, CORE_ADDR plt_off)
{
struct gdbarch *gdbarch = get_frame_arch (frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
CORE_ADDR tocp;
if (execution_direction == EXEC_REVERSE)

View File

@ -179,7 +179,7 @@ riscv_linux_syscall_next_pc (struct frame_info *frame)
static void
riscv_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
riscv_gdbarch_tdep *tdep = (riscv_gdbarch_tdep *) gdbarch_tdep (gdbarch);
linux_init_abi (info, gdbarch, 0);

View File

@ -730,7 +730,8 @@ show_riscv_debug_variable (struct ui_file *file, int from_tty,
int
riscv_isa_xlen (struct gdbarch *gdbarch)
{
return gdbarch_tdep (gdbarch)->isa_features.xlen;
riscv_gdbarch_tdep *tdep = (riscv_gdbarch_tdep *) gdbarch_tdep (gdbarch);
return tdep->isa_features.xlen;
}
/* See riscv-tdep.h. */
@ -738,7 +739,8 @@ riscv_isa_xlen (struct gdbarch *gdbarch)
int
riscv_abi_xlen (struct gdbarch *gdbarch)
{
return gdbarch_tdep (gdbarch)->abi_features.xlen;
riscv_gdbarch_tdep *tdep = (riscv_gdbarch_tdep *) gdbarch_tdep (gdbarch);
return tdep->abi_features.xlen;
}
/* See riscv-tdep.h. */
@ -746,7 +748,8 @@ riscv_abi_xlen (struct gdbarch *gdbarch)
int
riscv_isa_flen (struct gdbarch *gdbarch)
{
return gdbarch_tdep (gdbarch)->isa_features.flen;
riscv_gdbarch_tdep *tdep = (riscv_gdbarch_tdep *) gdbarch_tdep (gdbarch);
return tdep->isa_features.flen;
}
/* See riscv-tdep.h. */
@ -754,7 +757,8 @@ riscv_isa_flen (struct gdbarch *gdbarch)
int
riscv_abi_flen (struct gdbarch *gdbarch)
{
return gdbarch_tdep (gdbarch)->abi_features.flen;
riscv_gdbarch_tdep *tdep = (riscv_gdbarch_tdep *) gdbarch_tdep (gdbarch);
return tdep->abi_features.flen;
}
/* See riscv-tdep.h. */
@ -762,7 +766,8 @@ riscv_abi_flen (struct gdbarch *gdbarch)
bool
riscv_abi_embedded (struct gdbarch *gdbarch)
{
return gdbarch_tdep (gdbarch)->abi_features.embedded;
riscv_gdbarch_tdep *tdep = (riscv_gdbarch_tdep *) gdbarch_tdep (gdbarch);
return tdep->abi_features.embedded;
}
/* Return true if the target for GDBARCH has floating point hardware. */
@ -778,7 +783,8 @@ riscv_has_fp_regs (struct gdbarch *gdbarch)
static bool
riscv_has_fp_abi (struct gdbarch *gdbarch)
{
return gdbarch_tdep (gdbarch)->abi_features.flen > 0;
riscv_gdbarch_tdep *tdep = (riscv_gdbarch_tdep *) gdbarch_tdep (gdbarch);
return tdep->abi_features.flen > 0;
}
/* Return true if REGNO is a floating pointer register. */
@ -901,7 +907,7 @@ riscv_register_name (struct gdbarch *gdbarch, int regnum)
will show up in 'info register all'. Unless, we identify the
duplicate copies of these registers (in riscv_tdesc_unknown_reg) and
then hide the registers here by giving them no name. */
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
riscv_gdbarch_tdep *tdep = (riscv_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (tdep->duplicate_fflags_regnum == regnum)
return NULL;
if (tdep->duplicate_frm_regnum == regnum)
@ -929,7 +935,7 @@ riscv_register_name (struct gdbarch *gdbarch, int regnum)
static struct type *
riscv_fpreg_d_type (struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
riscv_gdbarch_tdep *tdep = (riscv_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (tdep->riscv_fpreg_d_type == nullptr)
{
@ -1251,7 +1257,7 @@ riscv_is_regnum_a_named_csr (int regnum)
static bool
riscv_is_unknown_csr (struct gdbarch *gdbarch, int regnum)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
riscv_gdbarch_tdep *tdep = (riscv_gdbarch_tdep *) gdbarch_tdep (gdbarch);
return (regnum >= tdep->unknown_csrs_first_regnum
&& regnum < (tdep->unknown_csrs_first_regnum
+ tdep->unknown_csrs_count));
@ -3560,7 +3566,7 @@ riscv_tdesc_unknown_reg (struct gdbarch *gdbarch, tdesc_feature *feature,
record their register numbers here. */
if (strcmp (tdesc_feature_name (feature), riscv_freg_feature.name ()) == 0)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
riscv_gdbarch_tdep *tdep = (riscv_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int *regnum_ptr = nullptr;
if (strcmp (reg_name, "fflags") == 0)
@ -3591,7 +3597,7 @@ riscv_tdesc_unknown_reg (struct gdbarch *gdbarch, tdesc_feature *feature,
about register groups in riscv_register_reggroup_p. */
if (strcmp (tdesc_feature_name (feature), riscv_csr_feature.name ()) == 0)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
riscv_gdbarch_tdep *tdep = (riscv_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (tdep->unknown_csrs_first_regnum == -1)
tdep->unknown_csrs_first_regnum = possible_regnum;
gdb_assert (tdep->unknown_csrs_first_regnum
@ -3628,7 +3634,6 @@ riscv_gdbarch_init (struct gdbarch_info info,
struct gdbarch_list *arches)
{
struct gdbarch *gdbarch;
struct gdbarch_tdep *tdep;
struct riscv_gdbarch_features features;
const struct target_desc *tdesc = info.target_desc;
@ -3693,7 +3698,8 @@ riscv_gdbarch_init (struct gdbarch_info info,
/* Check that the feature set of the ARCHES matches the feature set
we are looking for. If it doesn't then we can't reuse this
gdbarch. */
struct gdbarch_tdep *other_tdep = gdbarch_tdep (arches->gdbarch);
riscv_gdbarch_tdep *other_tdep
= (riscv_gdbarch_tdep *) gdbarch_tdep (arches->gdbarch);
if (other_tdep->isa_features != features
|| other_tdep->abi_features != abi_features)
@ -3706,7 +3712,7 @@ riscv_gdbarch_init (struct gdbarch_info info,
return arches->gdbarch;
/* None found, so create a new architecture from the information provided. */
tdep = new (struct gdbarch_tdep);
riscv_gdbarch_tdep *tdep = new riscv_gdbarch_tdep;
gdbarch = gdbarch_alloc (&info, tdep);
tdep->isa_features = features;
tdep->abi_features = abi_features;
@ -3812,7 +3818,8 @@ static CORE_ADDR
riscv_next_pc (struct regcache *regcache, CORE_ADDR pc)
{
struct gdbarch *gdbarch = regcache->arch ();
const struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
const riscv_gdbarch_tdep *tdep
= (riscv_gdbarch_tdep *) gdbarch_tdep (gdbarch);
struct riscv_insn insn;
CORE_ADDR next_pc;

View File

@ -22,6 +22,7 @@
#define RISCV_TDEP_H
#include "arch/riscv.h"
#include "gdbarch.h"
/* RiscV register numbers. */
enum
@ -75,7 +76,7 @@ enum
};
/* RISC-V specific per-architecture information. */
struct gdbarch_tdep
struct riscv_gdbarch_tdep : gdbarch_tdep
{
/* Features about the target hardware that impact how the gdbarch is
configured. Two gdbarch instances are compatible only if this field
@ -105,7 +106,7 @@ struct gdbarch_tdep
/* Return the expected next PC assuming FRAME is stopped at a syscall
instruction. */
CORE_ADDR (*syscall_next_pc) (struct frame_info *frame);
CORE_ADDR (*syscall_next_pc) (struct frame_info *frame) = nullptr;
};

Some files were not shown because too many files have changed in this diff Show More