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
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);
{
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 );
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);
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);
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;
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;
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). */
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 ()
}
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. */
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. */
{
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. */
{
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);
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)
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)
{
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)
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)
{
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)
{
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)
{
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)
{
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)
{
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)
{
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;
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);
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[] =
{
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);
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);
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;
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)
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;
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;
}
/* 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. */
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;
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];
#include "arch/aarch64.h"
#include "displaced-stepping.h"
#include "infrun.h"
+#include "gdbarch.h"
/* Forward declarations. */
struct gdbarch;
#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
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
}
/* 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
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. */
/* 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;
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);
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);
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)
{
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];
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;
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;
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;
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;
/* 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;
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;
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. */
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()
#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
#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);
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));
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);
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);
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);
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);
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;
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;
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;
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));
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);
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;
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))
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;
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))
{
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))
{
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;
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. */
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);
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);
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
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 };
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)
{
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);
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);
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);
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);
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);
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:
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. */
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.");
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);
{
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);
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 ()"). */
/* 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);
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
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);
/* 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. */
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);
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);
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);
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);
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)
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);
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);
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;
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;
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 * )
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. */
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)
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.
}
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;
}
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;
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;
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);
/* 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. */
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
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. */
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;
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
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)
{
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)
{
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. */
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
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
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;
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. */
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;
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))
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)
{
{
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:
{
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. */
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:
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;
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];
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)
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)
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))
{
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);
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. */
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);
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. */
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;
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. */
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;
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
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. */
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.
/* 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. */
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;
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);
/* Handling opcode 110 insns. */
static int
-thumb_record_ldm_stm_swi (insn_decode_record *thumb_insn_r)
+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 */
};
/* 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. */
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);
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. */
{
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;
}
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 */
ULONGEST this_base;
struct avr_unwind_cache *info;
struct gdbarch *gdbarch;
- struct gdbarch_tdep *tdep;
int i;
if (*this_prologue_cache)
/* 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);
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);
{
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;
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;
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;
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,
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;
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;
};
/* 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. */
#define BPF_NUM_REGS (BPF_PC_REGNUM + 1)
/* Target-dependent structure in gdbarch. */
-struct gdbarch_tdep
+struct bpf_gdbarch_tdep : gdbarch_tdep
{
};
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. */
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);
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;
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;
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))
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;
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};
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)
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);
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",
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)
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);
#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 */
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);
/* 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. */
};
/* Target-dependent structure in gdbarch. */
-struct gdbarch_tdep
+struct csky_gdbarch_tdep : gdbarch_tdep
{
/* This is Unused. */
};
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
/* 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;
/* 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;
/* 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;
}
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");
}
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");
{
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];
}
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
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:
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
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;
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
#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 */
#include "regcache.h"
+struct gdbarch_tdep {};
+
/* The architecture associated with the inferior through the
connection to the target.
#include "regcache.h"
+struct gdbarch_tdep {};
+
/* The architecture associated with the inferior through the
connection to the target.
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);
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);
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);
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);
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;
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);
/* 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++)
{
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;
}
{
- 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);
{
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
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. */
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
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);
#ifndef HPPA_TDEP_H
#define HPPA_TDEP_H
+#include "gdbarch.h"
+
struct trad_frame_saved_reg;
struct objfile;
struct so_list;
#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
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;
};
/*
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;
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;
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;
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);
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)
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);
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);
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);
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;
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);
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;
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);
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);
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,
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)
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. */
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);
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);
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)
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;
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;
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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;
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;
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;
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;
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;
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)
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))
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[]). */
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[]). */
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;
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. */
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. */
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];
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)
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);
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)
{
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)
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)
{
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)
{
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)
{
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;
}
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;
}
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))
{
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))
{
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;
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;
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)
{
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)
{
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);
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);
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,
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
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;
}
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;
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;
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. */
if (!i386_validate_tdesc_p (tdep, tdesc_data.get ()))
{
- xfree (tdep);
+ delete tdep;
gdbarch_free (gdbarch);
return NULL;
}
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);
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);
};
/* 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. */
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);
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;
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;
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;
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;
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;
{
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),
{
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
{
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;
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
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)
{
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 };
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
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)
{
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);
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)
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;
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;
#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"
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
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;
};
#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. */
};
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);
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. */
#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;
};
\f
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];
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;
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. */
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);
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;
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)
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);
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);
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);
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;
}
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;
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);
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 */
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)
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)
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
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)
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
{
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? */
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;
{
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
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);
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;
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);
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
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__,
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
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. */
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);
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);
#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. */
};
#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
{
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;
does not exist. */
if (reg_nr > M68HC11_LAST_HARD_REG && soft_regs[reg_nr].name == 0)
return NULL;
+
return m68hc11_register_names[reg_nr];
}
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:
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
{
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);
}
/* 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)
}
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;
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);
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. */
struct gdbarch_list *arches)
{
struct gdbarch *gdbarch;
- struct gdbarch_tdep *tdep;
int elf_flags;
soft_reg_initialized = 0;
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;
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;
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);
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)
{
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
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)
{
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];
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. */
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)
{
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)
{
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)
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)
{
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);
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. */
|| 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))
{
if (readbuf)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
ULONGEST addr;
regcache_raw_read_unsigned (regcache, tdep->pointer_result_regnum,
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;
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)
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)
{
{
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);
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)
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);
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;
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;
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;
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;
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;
/* 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. */
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.
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.
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 {};
};
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)
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;
+ }
}
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;
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);
+
+ if (tdep->me_module == me_module)
+ return arches->gdbarch;
+ }
- tdep = XCNEW (struct gdbarch_tdep);
+ mep_gdbarch_tdep *tdep = new mep_gdbarch_tdep;
gdbarch = gdbarch_alloc (&info, tdep);
/* Get a CGEN CPU descriptor for this architecture. */
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;
}
/* 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);
/* Microblaze architecture-specific information. */
-struct gdbarch_tdep
+struct microblaze_gdbarch_tdep : gdbarch_tdep
{
};
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 */
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;
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
&& 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)
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. */
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. */
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",
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
{
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
{
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);
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). */
/* 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. */
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)
{
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)
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
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 ());
}
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
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
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
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))
{
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 =
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;
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)
}
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. */
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? */
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;
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
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)
{
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
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);
/* 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;
{
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;
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)
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
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);
/* 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;
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;
return;
}
- switch (MIPS_FPU_TYPE (target_gdbarch ()))
+ switch (mips_get_fpu_type (target_gdbarch ()))
{
case MIPS_FPU_SINGLE:
fpu = "single-precision";
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;
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)
/* 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
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)
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;
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;
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 ();
};
/* 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. */
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;
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)
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);
}
#ifndef MN10300_TDEP_H
#define MN10300_TDEP_H
+#include "gdbarch.h"
+
enum {
E_D0_REGNUM = 0,
E_D1_REGNUM = 1,
};
/* 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 */
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);
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);
#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. */
};
/* 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. */
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));
{
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
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);
/* 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);
}
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);
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. */
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;
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
/* 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;
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;
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;
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;
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;
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;
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;
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);
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;
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;
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;
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;
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;
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 */
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);
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);
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];
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;
/* 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. */
#ifndef NIOS2_TDEP_H
#define NIOS2_TDEP_H
+#include "gdbarch.h"
+
/* Nios II ISA specific encodings and macros. */
#include "opcode/nios2.h"
#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;
/* 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. */
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
{
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,
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 */
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;
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);
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 */
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);
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];
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;
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);
{
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;
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)
{
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);
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;
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,
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 */
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;
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++)
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[] = { "(",
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;
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;
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;
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);
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;
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. */
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];
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;
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);
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)
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;
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
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;
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;
};
{
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)
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);
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. */
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. */
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. */
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. */
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. */
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. */
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)
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)
{
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));
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)
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
struct gdbarch_list *arches)
{
struct gdbarch *gdbarch;
- struct gdbarch_tdep *tdep;
struct riscv_gdbarch_features features;
const struct target_desc *tdesc = info.target_desc;
/* 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)
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;
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;
#define RISCV_TDEP_H
#include "arch/riscv.h"
+#include "gdbarch.h"
/* RiscV register numbers. */
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
/* 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;
};
/* Architecture specific data. */
-struct gdbarch_tdep
+struct rl78_gdbarch_tdep : gdbarch_tdep
{
/* The ELF header flags specify the multilib used. */
- int elf_flags;
-
- struct type *rl78_void,
- *rl78_uint8,
- *rl78_int8,
- *rl78_uint16,
- *rl78_int16,
- *rl78_uint32,
- *rl78_int32,
- *rl78_data_pointer,
- *rl78_code_pointer,
- *rl78_psw_type;
+ int elf_flags = 0;
+
+ struct type *rl78_void = nullptr,
+ *rl78_uint8 = nullptr,
+ *rl78_int8 = nullptr,
+ *rl78_uint16 = nullptr,
+ *rl78_int16 = nullptr,
+ *rl78_uint32 = nullptr,
+ *rl78_int32 = nullptr,
+ *rl78_data_pointer = nullptr,
+ *rl78_code_pointer = nullptr,
+ *rl78_psw_type = nullptr;
};
/* This structure holds the results of a prologue analysis. */
static struct type *
rl78_psw_type (struct gdbarch *gdbarch)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ rl78_gdbarch_tdep *tdep = (rl78_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (tdep->rl78_psw_type == NULL)
{
static struct type *
rl78_register_type (struct gdbarch *gdbarch, int reg_nr)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ rl78_gdbarch_tdep *tdep = (rl78_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (reg_nr == RL78_PC_REGNUM)
return tdep->rl78_code_pointer;
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
ULONGEST valtype_len = TYPE_LENGTH (valtype);
- int is_g10 = gdbarch_tdep (gdbarch)->elf_flags & E_FLAG_RL78_G10;
+ rl78_gdbarch_tdep *tdep = (rl78_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+ int is_g10 = tdep->elf_flags & E_FLAG_RL78_G10;
if (valtype_len > 8)
return RETURN_VALUE_STRUCT_CONVENTION;
rl78_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
struct gdbarch *gdbarch;
- struct gdbarch_tdep *tdep;
int elf_flags;
/* Extract the elf_flags if available. */
arches != NULL;
arches = gdbarch_list_lookup_by_info (arches->next, &info))
{
- if (gdbarch_tdep (arches->gdbarch)->elf_flags != elf_flags)
+ rl78_gdbarch_tdep *tdep
+ = (rl78_gdbarch_tdep *) gdbarch_tdep (arches->gdbarch);
+
+ if (tdep->elf_flags != elf_flags)
continue;
return arches->gdbarch;
/* None found, create a new architecture from the information
provided. */
- tdep = XCNEW (struct gdbarch_tdep);
+ rl78_gdbarch_tdep * tdep = new rl78_gdbarch_tdep;
gdbarch = gdbarch_alloc (&info, tdep);
tdep->elf_flags = elf_flags;
LONGEST backchain;
CORE_ADDR base, base_orig, 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);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct trad_frame_cache *this_trad_cache;
void *cb_data,
const struct regcache *regcache)
{
- if (gdbarch_tdep (gdbarch)->wordsize == 4)
+ ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+ if (tdep->wordsize == 4)
cb (".reg", 592, 592, &rs6000_aix32_regset, NULL, cb_data);
else
cb (".reg", 576, 576, &rs6000_aix64_regset, NULL, cb_data);
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 ii;
int len = 0;
int argbytes; /* current argument byte */
gdb_byte tmp_buffer[50];
int f_argno = 0; /* current floating point argno */
- int wordsize = gdbarch_tdep (gdbarch)->wordsize;
+ int wordsize = tdep->wordsize;
CORE_ADDR func_addr = find_function_addr (function, NULL);
struct value *arg = 0;
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);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
/* The calling convention this function implements assumes the
CORE_ADDR addr,
struct target_ops *targ)
{
- 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 obj_section *s;
CORE_ADDR pc, CORE_ADDR safety)
{
struct gdbarch *gdbarch = regcache->arch ();
- 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 dest;
int immediate;
rs6000_aix_extract_ld_info (struct gdbarch *gdbarch,
const gdb_byte *ldi_buf)
{
- 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 type *ptr_type = builtin_type (gdbarch)->builtin_data_ptr;
const struct ld_info_desc desc
static void
rs6000_aix_init_osabi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
/* RS6000/AIX does not support PT_STEP. Has to be simulated. */
set_gdbarch_software_single_step (gdbarch, rs6000_software_single_step);
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 ii;
int len = 0;
int argbytes; /* current argument byte */
gdb_byte tmp_buffer[50];
int f_argno = 0; /* current floating point argno */
- int wordsize = gdbarch_tdep (gdbarch)->wordsize;
+ int wordsize = tdep->wordsize;
struct value *arg = 0;
struct type *type;
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);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
/* The calling convention this function implements assumes the
int
vsx_register_p (struct gdbarch *gdbarch, int regno)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (tdep->ppc_vsr0_regnum < 0)
return 0;
else
int
altivec_register_p (struct gdbarch *gdbarch, int regno)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (tdep->ppc_vr0_regnum < 0 || tdep->ppc_vrsave_regnum < 0)
return 0;
else
int
spe_register_p (struct gdbarch *gdbarch, int regno)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
/* Is it a reference to EV0 -- EV31, and do we have those? */
if (IS_SPE_PSEUDOREG (tdep, regno))
int
ppc_floating_point_unit_p (struct gdbarch *gdbarch)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
return (tdep->ppc_fp0_regnum >= 0
&& tdep->ppc_fpscr_regnum >= 0);
int
ppc_altivec_support_p (struct gdbarch *gdbarch)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
return (tdep->ppc_vr0_regnum >= 0
&& tdep->ppc_vrsave_regnum >= 0);
static void
init_sim_regno_table (struct gdbarch *arch)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (arch);
+ ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (arch);
int total_regs = gdbarch_num_regs (arch);
int *sim_regno = GDBARCH_OBSTACK_CALLOC (arch, total_regs, int);
int i;
static int
rs6000_register_sim_regno (struct gdbarch *gdbarch, int reg)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int sim_regno;
if (tdep->sim_regno == NULL)
static int
ppc_greg_offset (struct gdbarch *gdbarch,
- struct gdbarch_tdep *tdep,
+ ppc_gdbarch_tdep *tdep,
const struct ppc_reg_offsets *offsets,
int regnum,
int *regsize)
}
static int
-ppc_fpreg_offset (struct gdbarch_tdep *tdep,
+ppc_fpreg_offset (ppc_gdbarch_tdep *tdep,
const struct ppc_reg_offsets *offsets,
int regnum)
{
int regnum, const void *gregs, 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 ppc_reg_offsets *offsets
= (const struct ppc_reg_offsets *) regset->regmap;
size_t offset;
int regnum, const void *fpregs, size_t len)
{
struct gdbarch *gdbarch = regcache->arch ();
- struct gdbarch_tdep *tdep;
const struct ppc_reg_offsets *offsets;
size_t offset;
if (!ppc_floating_point_unit_p (gdbarch))
return;
- tdep = gdbarch_tdep (gdbarch);
+ ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
offsets = (const struct ppc_reg_offsets *) regset->regmap;
if (regnum == -1)
{
int regnum, void *gregs, 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 ppc_reg_offsets *offsets
= (const struct ppc_reg_offsets *) regset->regmap;
size_t offset;
int regnum, void *fpregs, size_t len)
{
struct gdbarch *gdbarch = regcache->arch ();
- struct gdbarch_tdep *tdep;
const struct ppc_reg_offsets *offsets;
size_t offset;
if (!ppc_floating_point_unit_p (gdbarch))
return;
- tdep = gdbarch_tdep (gdbarch);
+ ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
offsets = (const struct ppc_reg_offsets *) regset->regmap;
if (regnum == -1)
{
rs6000_in_function_epilogue_frame_p (struct frame_info *curfrm,
struct gdbarch *gdbarch, CORE_ADDR pc)
{
- 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);
bfd_byte insn_buf[PPC_INSN_SIZE];
CORE_ADDR scan_pc, func_start, func_end, epilogue_start, epilogue_end;
if (insn & 0x1)
{
/* Link register needs to be set to the next instruction's PC. */
+ ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
regcache_cooked_write_unsigned (regs,
- gdbarch_tdep (gdbarch)->ppc_lr_regnum,
+ tdep->ppc_lr_regnum,
from + PPC_INSN_SIZE);
displaced_debug_printf ("(ppc) adjusted LR to %s",
paddress (gdbarch, from + PPC_INSN_SIZE));
int num_skip_non_prologue_insns = 0;
int r0_contains_arg = 0;
const struct bfd_arch_info *arch_info = gdbarch_bfd_arch_info (gdbarch);
- 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);
memset (fdata, 0, sizeof (struct rs6000_framedata));
rs6000_skip_trampoline_code (struct frame_info *frame, CORE_ADDR pc)
{
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);
unsigned int ii, op;
int rel;
static struct type *
rs6000_builtin_type_vec64 (struct gdbarch *gdbarch)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (!tdep->ppc_builtin_type_vec64)
{
static struct type *
rs6000_builtin_type_vec128 (struct gdbarch *gdbarch)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (!tdep->ppc_builtin_type_vec128)
{
static const char *
rs6000_register_name (struct gdbarch *gdbarch, int regno)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
/* The upper half "registers" have names in the XML description,
but we present only the low GPRs and the full 64-bit registers
static struct type *
rs6000_pseudo_register_type (struct gdbarch *gdbarch, int regnum)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
/* These are the e500 pseudo-registers. */
if (IS_SPE_PSEUDOREG (tdep, regnum))
rs6000_pseudo_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
struct reggroup *group)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (IS_V_ALIAS_PSEUDOREG (tdep, regnum))
return 0;
rs6000_convert_register_p (struct gdbarch *gdbarch, int regnum,
struct type *type)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
return (tdep->ppc_fp0_regnum >= 0
&& regnum >= tdep->ppc_fp0_regnum
struct regcache *regcache, int ev_reg, void *buffer)
{
struct gdbarch *arch = regcache->arch ();
- struct gdbarch_tdep *tdep = gdbarch_tdep (arch);
+ ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (arch);
int reg_index;
gdb_byte *byte_buffer = (gdb_byte *) buffer;
enum register_status status;
int ev_reg, gdb_byte *buffer)
{
struct gdbarch *arch = regcache->arch ();
- struct gdbarch_tdep *tdep = gdbarch_tdep (arch);
+ ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int reg_index;
enum register_status status;
dfp_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache,
int reg_nr, gdb_byte *buffer)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int reg_index, fp0;
enum register_status status;
dfp_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
int reg_nr, const gdb_byte *buffer)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int reg_index, fp0;
if (IS_DFP_PSEUDOREG (tdep, reg_nr))
readable_regcache *regcache, int reg_nr,
gdb_byte *buffer)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
gdb_assert (IS_V_ALIAS_PSEUDOREG (tdep, reg_nr));
return regcache->raw_read (tdep->ppc_vr0_regnum
struct regcache *regcache,
int reg_nr, const gdb_byte *buffer)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
gdb_assert (IS_V_ALIAS_PSEUDOREG (tdep, reg_nr));
regcache->raw_write (tdep->ppc_vr0_regnum
vsx_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache,
int reg_nr, gdb_byte *buffer)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int reg_index, vr0, fp0, vsr0_upper;
enum register_status status;
vsx_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
int reg_nr, const gdb_byte *buffer)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int reg_index, vr0, fp0, vsr0_upper;
if (IS_VSX_PSEUDOREG (tdep, reg_nr))
efp_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache,
int reg_nr, gdb_byte *buffer)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int reg_index, vr0;
if (IS_EFP_PSEUDOREG (tdep, reg_nr))
efp_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
int reg_nr, const gdb_byte *buffer)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int reg_index, vr0;
int offset = gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG ? 0 : 8;
int reg_nr, gdb_byte *buffer)
{
struct gdbarch *regcache_arch = regcache->arch ();
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
gdb_assert (regcache_arch == gdbarch);
int reg_nr, const gdb_byte *buffer)
{
struct gdbarch *regcache_arch = regcache->arch ();
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
gdb_assert (regcache_arch == gdbarch);
dfp_ax_pseudo_register_collect (struct gdbarch *gdbarch,
struct agent_expr *ax, int reg_nr)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int reg_index, fp0;
if (IS_DFP_PSEUDOREG (tdep, reg_nr))
v_alias_pseudo_register_collect (struct gdbarch *gdbarch,
struct agent_expr *ax, int reg_nr)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
gdb_assert (IS_V_ALIAS_PSEUDOREG (tdep, reg_nr));
ax_reg_mask (ax, tdep->ppc_vr0_regnum
vsx_ax_pseudo_register_collect (struct gdbarch *gdbarch,
struct agent_expr *ax, int reg_nr)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int reg_index, vr0, fp0, vsr0_upper;
if (IS_VSX_PSEUDOREG (tdep, reg_nr))
efp_ax_pseudo_register_collect (struct gdbarch *gdbarch,
struct agent_expr *ax, int reg_nr)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int reg_index, vr0;
if (IS_EFP_PSEUDOREG (tdep, reg_nr))
rs6000_ax_pseudo_register_collect (struct gdbarch *gdbarch,
struct agent_expr *ax, int reg_nr)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (IS_SPE_PSEUDOREG (tdep, reg_nr))
{
int reg_index = reg_nr - tdep->ppc_ev0_regnum;
struct agent_expr *ax, struct axs_value *value,
CORE_ADDR scope)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
value->type = register_type (gdbarch, tdep->ppc_lr_regnum);
value->kind = axs_lvalue_register;
value->u.reg = tdep->ppc_lr_regnum;
static int
rs6000_stab_reg_to_regnum (struct gdbarch *gdbarch, int num)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (0 <= num && num <= 31)
return tdep->ppc_gp0_regnum + num;
static int
rs6000_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, int num)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (0 <= num && num <= 31)
return tdep->ppc_gp0_regnum + num;
{
struct rs6000_frame_cache *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 rs6000_framedata fdata;
int wordsize = tdep->wordsize;
{
struct rs6000_frame_cache *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);
if (*this_cache)
return (struct rs6000_frame_cache *) *this_cache;
struct dwarf2_frame_state_reg *reg,
struct frame_info *this_frame)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
/* PPC32 and PPC64 ABI's are the same regarding volatile and
non-volatile registers. We will use the same code for both. */
Otherwise, it's just a VR register. Record them accordingly. */
static int
-ppc_record_vsr (struct regcache *regcache, struct gdbarch_tdep *tdep, int vsr)
+ppc_record_vsr (struct regcache *regcache, ppc_gdbarch_tdep *tdep, int vsr)
{
if (vsr < 0 || vsr >= 64)
return -1;
ppc_process_record_op4 (struct gdbarch *gdbarch, struct regcache *regcache,
CORE_ADDR addr, uint32_t insn)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int ext = PPC_FIELD (insn, 21, 11);
int vra = PPC_FIELD (insn, 11, 5);
ppc_process_record_op19 (struct gdbarch *gdbarch, struct regcache *regcache,
CORE_ADDR addr, uint32_t insn)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int ext = PPC_EXTOP (insn);
switch (ext & 0x01f)
ppc_process_record_op31 (struct gdbarch *gdbarch, struct regcache *regcache,
CORE_ADDR addr, uint32_t insn)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int ext = PPC_EXTOP (insn);
int tmp, nr, nb, i;
CORE_ADDR at_dcsz, ea = 0;
ppc_process_record_op59 (struct gdbarch *gdbarch, struct regcache *regcache,
CORE_ADDR addr, uint32_t insn)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int ext = PPC_EXTOP (insn);
switch (ext & 0x1f)
ppc_process_record_op60 (struct gdbarch *gdbarch, struct regcache *regcache,
CORE_ADDR addr, uint32_t insn)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int ext = PPC_EXTOP (insn);
switch (ext >> 2)
ppc_process_record_op61 (struct gdbarch *gdbarch, struct regcache *regcache,
CORE_ADDR addr, uint32_t insn)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
ULONGEST ea = 0;
int size;
ppc_process_record_op63 (struct gdbarch *gdbarch, struct regcache *regcache,
CORE_ADDR addr, uint32_t insn)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int ext = PPC_EXTOP (insn);
int tmp;
ppc_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
CORE_ADDR 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);
uint32_t insn;
int op6, tmp, i;
rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
struct gdbarch *gdbarch;
- struct gdbarch_tdep *tdep;
int wordsize, from_xcoff_exec, from_elf_exec;
enum bfd_architecture arch;
unsigned long mach;
/* Word size in the various PowerPC bfd_arch_info structs isn't
meaningful, because 64-bit CPUs can run in 32-bit mode. So, perform
separate word size check. */
- tdep = gdbarch_tdep (arches->gdbarch);
+ ppc_gdbarch_tdep *tdep
+ = (ppc_gdbarch_tdep *) gdbarch_tdep (arches->gdbarch);
if (tdep && tdep->elf_abi != elf_abi)
continue;
if (tdep && tdep->soft_float != soft_float)
- "set arch" trust blindly
- GDB startup useless but harmless */
- tdep = XCNEW (struct gdbarch_tdep);
+ ppc_gdbarch_tdep *tdep = new ppc_gdbarch_tdep;
tdep->wordsize = wordsize;
tdep->elf_abi = elf_abi;
tdep->soft_float = soft_float;
static void
rs6000_dump_tdep (struct gdbarch *gdbarch, struct ui_file *file)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (tdep == NULL)
return;
};
/* Architecture specific data. */
-struct gdbarch_tdep
+struct rx_gdbarch_tdep : gdbarch_tdep
{
/* The ELF header flags specify the multilib used. */
- int elf_flags;
+ int elf_flags = 0;
/* Type of PSW and BPSW. */
- struct type *rx_psw_type;
+ struct type *rx_psw_type = nullptr;
/* Type of FPSW. */
- struct type *rx_fpsw_type;
+ struct type *rx_fpsw_type = nullptr;
};
/* This structure holds the results of a prologue analysis. */
rx_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
struct gdbarch *gdbarch;
- struct gdbarch_tdep *tdep;
int elf_flags;
tdesc_arch_data_up tdesc_data;
const struct target_desc *tdesc = info.target_desc;
arches != NULL;
arches = gdbarch_list_lookup_by_info (arches->next, &info))
{
- if (gdbarch_tdep (arches->gdbarch)->elf_flags != elf_flags)
+ rx_gdbarch_tdep *tdep
+ = (rx_gdbarch_tdep *) gdbarch_tdep (arches->gdbarch);
+
+ if (tdep->elf_flags != elf_flags)
continue;
return arches->gdbarch;
gdb_assert(tdesc_data != NULL);
- tdep = XCNEW (struct gdbarch_tdep);
+ rx_gdbarch_tdep *tdep = new rx_gdbarch_tdep;
gdbarch = gdbarch_alloc (&info, tdep);
tdep->elf_flags = elf_flags;
typedef BP_MANIPULATION (s12z_break_insn) s12z_breakpoint;
-struct gdbarch_tdep
+struct s12z_gdbarch_tdep : gdbarch_tdep
{
};
static struct gdbarch *
s12z_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
- struct gdbarch_tdep *tdep = XNEW (struct gdbarch_tdep);
+ s12z_gdbarch_tdep *tdep = new s12z_gdbarch_tdep;
struct gdbarch *gdbarch = gdbarch_alloc (&info, tdep);
add_cmd ("bdccsr", class_support, show_bdccsr_command,
s390_write_pc (struct regcache *regcache, CORE_ADDR pc)
{
struct gdbarch *gdbarch = regcache->arch ();
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ s390_gdbarch_tdep *tdep = (s390_gdbarch_tdep *) gdbarch_tdep (gdbarch);
regcache_cooked_write_unsigned (regcache, tdep->pc_regnum, pc);
void *cb_data,
const struct regcache *regcache)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ s390_gdbarch_tdep *tdep = (s390_gdbarch_tdep *) gdbarch_tdep (gdbarch);
const int gregset_size = (tdep->abi == ABI_LINUX_S390 ?
s390_sizeof_gregset : s390x_sizeof_gregset);
void **this_prologue_cache)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ s390_gdbarch_tdep *tdep = (s390_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int word_size = gdbarch_ptr_bit (gdbarch) / 8;
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct s390_sigtramp_unwind_cache *info;
thread_info *thread)
{
struct regcache *regs = get_thread_regcache (thread);
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ s390_gdbarch_tdep *tdep = (s390_gdbarch_tdep *) gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
ULONGEST pc;
ULONGEST svc_number = -1;
s390_all_but_pc_registers_record (struct regcache *regcache)
{
struct gdbarch *gdbarch = regcache->arch ();
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ s390_gdbarch_tdep *tdep = (s390_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int i;
for (i = 0; i < 16; i++)
s390_linux_syscall_record (struct regcache *regcache, LONGEST syscall_native)
{
struct gdbarch *gdbarch = regcache->arch ();
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ s390_gdbarch_tdep *tdep = (s390_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int ret;
enum gdb_syscall syscall_gdb;
s390_linux_record_signal (struct gdbarch *gdbarch, struct regcache *regcache,
enum gdb_signal signal)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ s390_gdbarch_tdep *tdep = (s390_gdbarch_tdep *) gdbarch_tdep (gdbarch);
/* There are two kinds of signal frames on s390. rt_sigframe is always
the larger one, so don't even bother with sigframe. */
const int sizeof_rt_sigframe = (tdep->abi == ABI_LINUX_ZSERIES ?
static void
s390_linux_init_abi_any (struct gdbarch_info info, struct gdbarch *gdbarch)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ s390_gdbarch_tdep *tdep = (s390_gdbarch_tdep *) gdbarch_tdep (gdbarch);
tdep->s390_syscall_record = s390_linux_syscall_record;
static void
s390_linux_init_abi_31 (struct gdbarch_info info, struct gdbarch *gdbarch)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ s390_gdbarch_tdep *tdep = (s390_gdbarch_tdep *) gdbarch_tdep (gdbarch);
tdep->abi = ABI_LINUX_S390;
static void
s390_linux_init_abi_64 (struct gdbarch_info info, struct gdbarch *gdbarch)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ s390_gdbarch_tdep *tdep = (s390_gdbarch_tdep *) gdbarch_tdep (gdbarch);
tdep->abi = ABI_LINUX_ZSERIES;
static int
s390_register_call_saved (struct gdbarch *gdbarch, int regnum)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ s390_gdbarch_tdep *tdep = (s390_gdbarch_tdep *) gdbarch_tdep (gdbarch);
switch (tdep->abi)
{
struct regcache *regcache,
CORE_ADDR addr)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ s390_gdbarch_tdep *tdep = (s390_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int sz = register_size (gdbarch, S390_PSWA_REGNUM);
gdb_byte *reg = (gdb_byte *) alloca (sz);
ULONGEST pswm, pswa;
static int
s390_dwarf_reg_to_regnum (struct gdbarch *gdbarch, int reg)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ s390_gdbarch_tdep *tdep = (s390_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int gdb_reg = -1;
/* In a 32-on-64 debug scenario, debug info refers to the full
These pseudo-registers are composed of two adjacent gprs. */
static int
-regnum_is_gpr_full (struct gdbarch_tdep *tdep, int regnum)
+regnum_is_gpr_full (s390_gdbarch_tdep *tdep, int regnum)
{
return (tdep->gpr_full_regnum != -1
&& regnum >= tdep->gpr_full_regnum
These pseudo-registers are composed of f0-f15 and v0l-v15l. */
static int
-regnum_is_vxr_full (struct gdbarch_tdep *tdep, int regnum)
+regnum_is_vxr_full (s390_gdbarch_tdep *tdep, int regnum)
{
return (tdep->v0_full_regnum != -1
&& regnum >= tdep->v0_full_regnum
s390_value_from_register (struct gdbarch *gdbarch, struct type *type,
int regnum, struct frame_id frame_id)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ s390_gdbarch_tdep *tdep = (s390_gdbarch_tdep *) gdbarch_tdep (gdbarch);
struct value *value = default_value_from_register (gdbarch, type,
regnum, frame_id);
check_typedef (type);
static const char *
s390_pseudo_register_name (struct gdbarch *gdbarch, int regnum)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ s390_gdbarch_tdep *tdep = (s390_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (regnum == tdep->pc_regnum)
return "pc";
static struct type *
s390_pseudo_register_type (struct gdbarch *gdbarch, int regnum)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ s390_gdbarch_tdep *tdep = (s390_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (regnum == tdep->pc_regnum)
return builtin_type (gdbarch)->builtin_func_ptr;
s390_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache,
int regnum, gdb_byte *buf)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ s390_gdbarch_tdep *tdep = (s390_gdbarch_tdep *) gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int regsize = register_size (gdbarch, regnum);
ULONGEST val;
s390_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
int regnum, const gdb_byte *buf)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ s390_gdbarch_tdep *tdep = (s390_gdbarch_tdep *) gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int regsize = register_size (gdbarch, regnum);
ULONGEST val, psw;
s390_pseudo_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
struct reggroup *group)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ s390_gdbarch_tdep *tdep = (s390_gdbarch_tdep *) gdbarch_tdep (gdbarch);
/* We usually save/restore the whole PSW, which includes PC and CC.
However, some older gdbservers may not support saving/restoring
s390_ax_pseudo_register_collect (struct gdbarch *gdbarch,
struct agent_expr *ax, int regnum)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ s390_gdbarch_tdep *tdep = (s390_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (regnum == tdep->pc_regnum)
{
ax_reg_mask (ax, S390_PSWA_REGNUM);
s390_ax_pseudo_register_push_stack (struct gdbarch *gdbarch,
struct agent_expr *ax, int regnum)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ s390_gdbarch_tdep *tdep = (s390_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (regnum == tdep->pc_regnum)
{
ax_reg (ax, S390_PSWA_REGNUM);
static void
s390_handle_arg (struct s390_arg_state *as, struct value *arg,
- struct gdbarch_tdep *tdep, int word_size,
+ s390_gdbarch_tdep *tdep, int word_size,
enum bfd_endian byte_order, int is_unnamed)
{
struct type *type = check_typedef (value_type (arg));
function_call_return_method return_method,
CORE_ADDR struct_addr)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ s390_gdbarch_tdep *tdep = (s390_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int word_size = gdbarch_ptr_bit (gdbarch) / 8;
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int i;
rvc = RETURN_VALUE_STRUCT_CONVENTION;
break;
case TYPE_CODE_ARRAY:
- rvc = (gdbarch_tdep (gdbarch)->vector_abi == S390_VECTOR_ABI_128
- && TYPE_LENGTH (type) <= 16 && type->is_vector ())
- ? RETURN_VALUE_REGISTER_CONVENTION
- : RETURN_VALUE_STRUCT_CONVENTION;
- break;
+ {
+ s390_gdbarch_tdep *tdep = (s390_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+ rvc = (tdep->vector_abi == S390_VECTOR_ABI_128
+ && TYPE_LENGTH (type) <= 16 && type->is_vector ())
+ ? RETURN_VALUE_REGISTER_CONVENTION
+ : RETURN_VALUE_STRUCT_CONVENTION;
+ break;
+ }
default:
rvc = TYPE_LENGTH (type) <= 8
? RETURN_VALUE_REGISTER_CONVENTION
static CORE_ADDR
s390_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ s390_gdbarch_tdep *tdep = (s390_gdbarch_tdep *) gdbarch_tdep (gdbarch);
ULONGEST pc;
pc = frame_unwind_register_unsigned (next_frame, tdep->pc_regnum);
return gdbarch_addr_bits_remove (gdbarch, pc);
s390_unwind_pseudo_register (struct frame_info *this_frame, int regnum)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ s390_gdbarch_tdep *tdep = (s390_gdbarch_tdep *) gdbarch_tdep (gdbarch);
struct type *type = register_type (gdbarch, regnum);
/* Unwind PC via PSW address. */
s390_record_address_mask (struct gdbarch *gdbarch, struct regcache *regcache,
CORE_ADDR val)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ s390_gdbarch_tdep *tdep = (s390_gdbarch_tdep *) gdbarch_tdep (gdbarch);
ULONGEST pswm, pswa;
int am;
if (tdep->abi == ABI_LINUX_S390)
uint8_t vx, uint8_t el, uint8_t es, uint16_t bd,
int8_t dh, CORE_ADDR *res)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ s390_gdbarch_tdep *tdep = (s390_gdbarch_tdep *) gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
ULONGEST x;
gdb_byte buf[16];
static int
s390_record_gpr_g (struct gdbarch *gdbarch, struct regcache *regcache, int i)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ s390_gdbarch_tdep *tdep = (s390_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + i))
return -1;
if (tdep->abi == ABI_LINUX_S390)
static int
s390_record_gpr_h (struct gdbarch *gdbarch, struct regcache *regcache, int i)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ s390_gdbarch_tdep *tdep = (s390_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (tdep->abi == ABI_LINUX_S390)
{
if (record_full_arch_list_add_reg (regcache, S390_R0_UPPER_REGNUM + i))
s390_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
CORE_ADDR addr)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ s390_gdbarch_tdep *tdep = (s390_gdbarch_tdep *) gdbarch_tdep (gdbarch);
uint16_t insn[3] = {0};
/* Instruction as bytes. */
uint8_t ibyte[6];
tdesc. */
static bool
-s390_tdesc_valid (struct gdbarch_tdep *tdep,
+s390_tdesc_valid (s390_gdbarch_tdep *tdep,
struct tdesc_arch_data *tdesc_data)
{
static const char *const psw[] = {
/* Allocate and initialize new gdbarch_tdep. Caller is responsible to free
memory after use. */
-static struct gdbarch_tdep *
+static s390_gdbarch_tdep *
s390_gdbarch_tdep_alloc ()
{
- struct gdbarch_tdep *tdep = XCNEW (struct gdbarch_tdep);
+ s390_gdbarch_tdep *tdep = new s390_gdbarch_tdep;
tdep->tdesc = NULL;
static const char *const stap_register_indirection_suffixes[] = { ")",
NULL };
- struct gdbarch_tdep *tdep = s390_gdbarch_tdep_alloc ();
+ s390_gdbarch_tdep *tdep = s390_gdbarch_tdep_alloc ();
struct gdbarch *gdbarch = gdbarch_alloc (&info, tdep);
tdesc_arch_data_up tdesc_data = tdesc_data_alloc ();
info.tdesc_data = tdesc_data.get ();
/* Check any target description for validity. */
if (!s390_tdesc_valid (tdep, tdesc_data.get ()))
{
- xfree (tdep);
+ delete tdep;
gdbarch_free (gdbarch);
return NULL;
}
arches != NULL;
arches = gdbarch_list_lookup_by_info (arches->next, &info))
{
- struct gdbarch_tdep *tmp = gdbarch_tdep (arches->gdbarch);
+ s390_gdbarch_tdep *tmp
+ = (s390_gdbarch_tdep *) gdbarch_tdep (arches->gdbarch);
+
if (!tmp)
continue;
+
/* A program can 'choose' not to use the vector registers when they
are present. Leading to the same tdesc but different tdep and
thereby a different gdbarch. */
if (tmp->vector_abi != tdep->vector_abi)
continue;
- xfree (tdep);
+ delete tdep;
gdbarch_free (gdbarch);
return arches->gdbarch;
}
/* The tdep structure. */
-struct gdbarch_tdep
+struct s390_gdbarch_tdep : gdbarch_tdep
{
/* Target description. */
- const struct target_desc *tdesc;
+ const struct target_desc *tdesc = nullptr;
/* ABI version. */
- enum s390_abi_kind abi;
+ enum s390_abi_kind abi {};
/* Vector ABI. */
- enum s390_vector_abi_kind vector_abi;
+ enum s390_vector_abi_kind vector_abi {};
/* Pseudo register numbers. */
- int gpr_full_regnum;
- int pc_regnum;
- int cc_regnum;
- int v0_full_regnum;
-
- bool have_upper;
- bool have_linux_v1;
- bool have_linux_v2;
- bool have_tdb;
- bool have_vx;
- bool have_gs;
+ int gpr_full_regnum = 0;
+ int pc_regnum = 0;
+ int cc_regnum = 0;
+ int v0_full_regnum = 0;
+
+ bool have_upper = 0;
+ bool have_linux_v1 = 0;
+ bool have_linux_v2 = 0;
+ bool have_tdb = 0;
+ bool have_vx = 0;
+ bool have_gs = 0;
/* Hook to record OS specific systemcall. */
- int (*s390_syscall_record) (struct regcache *regcache, LONGEST svc_number);
+ int (*s390_syscall_record) (struct regcache *regcache, LONGEST svc_number)
+ = nullptr;
};
/* Decoding S/390 instructions. */
set_gdbarch_fetch_tls_load_module_address (gdbarch,
svr4_fetch_objfile_link_map);
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ sh_gdbarch_tdep *tdep = (sh_gdbarch_tdep *) gdbarch_tdep (gdbarch);
/* Remember regset characteristics. The sizes should match
elf_gregset_t and elf_fpregset_t from Linux. */
shnbsd_init_abi (struct gdbarch_info info,
struct gdbarch *gdbarch)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ sh_gdbarch_tdep *tdep = (sh_gdbarch_tdep *) gdbarch_tdep (gdbarch);
nbsd_init_abi (info, gdbarch);
tdep->core_gregmap = (struct sh_corefile_regmap *)regmap;
static struct type *
sh_littlebyte_bigword_type (struct gdbarch *gdbarch)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ sh_gdbarch_tdep *tdep = (sh_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (tdep->sh_littlebyte_bigword_type == NULL)
tdep->sh_littlebyte_bigword_type
int regnum, const void *regs, size_t len)
{
struct gdbarch *gdbarch = regcache->arch ();
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ sh_gdbarch_tdep *tdep = (sh_gdbarch_tdep *) gdbarch_tdep (gdbarch);
const struct sh_corefile_regmap *regmap = (regset == &sh_corefile_gregset
? tdep->core_gregmap
: tdep->core_fpregmap);
int regnum, void *regs, size_t len)
{
struct gdbarch *gdbarch = regcache->arch ();
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ sh_gdbarch_tdep *tdep = (sh_gdbarch_tdep *) gdbarch_tdep (gdbarch);
const struct sh_corefile_regmap *regmap = (regset == &sh_corefile_gregset
? tdep->core_gregmap
: tdep->core_fpregmap);
void *cb_data,
const struct regcache *regcache)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ sh_gdbarch_tdep *tdep = (sh_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (tdep->core_gregmap != NULL)
cb (".reg", tdep->sizeof_gregset, tdep->sizeof_gregset,
sh_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);
/* None found, create a new architecture from the information
provided. */
- tdep = XCNEW (struct gdbarch_tdep);
+ sh_gdbarch_tdep *tdep = new sh_gdbarch_tdep;
gdbarch = gdbarch_alloc (&info, tdep);
set_gdbarch_short_bit (gdbarch, 2 * TARGET_CHAR_BIT);
#ifndef SH_TDEP_H
#define SH_TDEP_H
+#include "gdbarch.h"
+
/* Contributed by Steve Chamberlain sac@cygnus.com. */
/* Registers for all SH variants. Used also by sh3-rom.c. */
unsigned int offset;
};
-struct gdbarch_tdep
+struct sh_gdbarch_tdep : gdbarch_tdep
{
/* Non-NULL when debugging from a core file. Provides the offset
where each general-purpose register is stored inside the associated
core file section. */
- struct sh_corefile_regmap *core_gregmap;
- int sizeof_gregset;
+ struct sh_corefile_regmap *core_gregmap = nullptr;
+ int sizeof_gregset = 0;
/* Non-NULL when debugging from a core file and when FP registers are
available. Provides the offset where each FP register is stored
inside the associated core file section. */
- struct sh_corefile_regmap *core_fpregmap;
- int sizeof_fpregset;
+ struct sh_corefile_regmap *core_fpregmap = nullptr;
+ int sizeof_fpregset = 0;
/* ISA-specific data types. */
- struct type *sh_littlebyte_bigword_type;
+ struct type *sh_littlebyte_bigword_type = nullptr;
};
extern const struct regset sh_corefile_gregset;
static void
sparc_linux_write_pc (struct regcache *regcache, CORE_ADDR pc)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (regcache->arch ());
+ gdbarch *arch = regcache->arch ();
+ sparc_gdbarch_tdep *tdep = (sparc_gdbarch_tdep *) gdbarch_tdep (arch);
ULONGEST psr;
regcache_cooked_write_unsigned (regcache, tdep->pc_regnum, pc);
static void
sparc32_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ sparc_gdbarch_tdep *tdep = (sparc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
linux_init_abi (info, gdbarch, 0);
void
sparc32nbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ sparc_gdbarch_tdep *tdep = (sparc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
nbsd_init_abi (info, gdbarch);
static void
sparc32_sol2_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ sparc_gdbarch_tdep *tdep = (sparc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
tdep->gregset = &sparc32_sol2_gregset;
tdep->sizeof_gregset = 152;
static struct type *
sparc_psr_type (struct gdbarch *gdbarch)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ sparc_gdbarch_tdep *tdep = (sparc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (!tdep->sparc_psr_type)
{
static struct type *
sparc_fsr_type (struct gdbarch *gdbarch)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ sparc_gdbarch_tdep *tdep = (sparc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (!tdep->sparc_fsr_type)
{
sparc_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
CORE_ADDR current_pc, struct sparc_frame_cache *cache)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ sparc_gdbarch_tdep *tdep = (sparc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
unsigned long insn;
int offset = 0;
int dest = -1;
struct frame_info *frame = get_current_frame ();
/* Trap instruction (TRAP). */
- return gdbarch_tdep (regcache->arch ())->step_trap (frame,
- insn);
+ gdbarch *arch = regcache->arch ();
+ sparc_gdbarch_tdep *tdep = (sparc_gdbarch_tdep *) gdbarch_tdep (arch);
+ return tdep->step_trap (frame, insn);
}
/* FIXME: Handle DONE and RETRY instructions. */
sparc_software_single_step (struct regcache *regcache)
{
struct gdbarch *arch = regcache->arch ();
- struct gdbarch_tdep *tdep = gdbarch_tdep (arch);
+ sparc_gdbarch_tdep *tdep = (sparc_gdbarch_tdep *) gdbarch_tdep (arch);
CORE_ADDR npc, nnpc;
CORE_ADDR pc, orig_npc;
static void
sparc_write_pc (struct regcache *regcache, CORE_ADDR pc)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (regcache->arch ());
+ gdbarch *arch = regcache->arch ();
+ sparc_gdbarch_tdep *tdep = (sparc_gdbarch_tdep *) gdbarch_tdep (arch);
regcache_cooked_write_unsigned (regcache, tdep->pc_regnum, pc);
regcache_cooked_write_unsigned (regcache, tdep->npc_regnum, pc + 4);
void *cb_data,
const struct regcache *regcache)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ sparc_gdbarch_tdep *tdep = (sparc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
cb (".reg", tdep->sizeof_gregset, tdep->sizeof_gregset, tdep->gregset, NULL,
cb_data);
static struct gdbarch *
sparc32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
- struct gdbarch_tdep *tdep;
const struct target_desc *tdesc = info.target_desc;
struct gdbarch *gdbarch;
int valid_p = 1;
return arches->gdbarch;
/* Allocate space for the new architecture. */
- tdep = XCNEW (struct gdbarch_tdep);
+ sparc_gdbarch_tdep *tdep = new sparc_gdbarch_tdep;
gdbarch = gdbarch_alloc (&info, tdep);
tdep->pc_regnum = SPARC32_PC_REGNUM;
#ifndef SPARC_TDEP_H
#define SPARC_TDEP_H 1
+#include "gdbarch.h"
+
#define SPARC_CORE_REGISTERS \
"g0", "g1", "g2", "g3", "g4", "g5", "g6", "g7", \
"o0", "o1", "o2", "o3", "o4", "o5", "sp", "o7", \
/* SPARC architecture-specific information. */
-struct gdbarch_tdep
+struct sparc_gdbarch_tdep : gdbarch_tdep
{
/* Register numbers for the PN and nPC registers. The definitions
for (64-bit) UltraSPARC differ from the (32-bit) SPARC
definitions. */
- int pc_regnum;
- int npc_regnum;
+ int pc_regnum = 0;
+ int npc_regnum = 0;
/* Register names specific for architecture (sparc32 vs. sparc64) */
- const char * const *fpu_register_names;
- size_t fpu_registers_num;
- const char * const *cp0_register_names;
- size_t cp0_registers_num;
+ const char * const *fpu_register_names = nullptr;
+ size_t fpu_registers_num = 0;
+ const char * const *cp0_register_names = nullptr;
+ size_t cp0_registers_num = 0;
/* Register sets. */
- const struct regset *gregset;
- size_t sizeof_gregset;
- const struct regset *fpregset;
- size_t sizeof_fpregset;
+ const struct regset *gregset = nullptr;
+ size_t sizeof_gregset = 0;
+ const struct regset *fpregset = nullptr;
+ size_t sizeof_fpregset = 0;
/* Offset of saved PC in jmp_buf. */
- int jb_pc_offset;
+ int jb_pc_offset = 0;
/* Size of an Procedure Linkage Table (PLT) entry, 0 if we shouldn't
treat the PLT special when doing prologue analysis. */
- size_t plt_entry_size;
+ size_t plt_entry_size = 0;
/* Alternative location for trap return. Used for single-stepping. */
- CORE_ADDR (*step_trap) (struct frame_info *frame, unsigned long insn);
+ CORE_ADDR (*step_trap) (struct frame_info *frame, unsigned long insn)
+ = nullptr;
/* ISA-specific data types. */
- struct type *sparc_psr_type;
- struct type *sparc_fsr_type;
- struct type *sparc64_ccr_type;
- struct type *sparc64_pstate_type;
- struct type *sparc64_fsr_type;
- struct type *sparc64_fprs_type;
+ struct type *sparc_psr_type = nullptr;
+ struct type *sparc_fsr_type = nullptr;
+ struct type *sparc64_ccr_type = nullptr;
+ struct type *sparc64_pstate_type = nullptr;
+ struct type *sparc64_fsr_type = nullptr;
+ struct type *sparc64_fprs_type = nullptr;
};
/* Register numbers of various important registers. */
static void
sparc64fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ sparc_gdbarch_tdep *tdep = (sparc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
/* Generic FreeBSD support. */
fbsd_init_abi (info, gdbarch);
static void
sparc64_linux_write_pc (struct regcache *regcache, CORE_ADDR pc)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (regcache->arch ());
+ gdbarch *arch = regcache->arch ();
+ sparc_gdbarch_tdep *tdep = (sparc_gdbarch_tdep *) gdbarch_tdep (arch);
ULONGEST state;
regcache_cooked_write_unsigned (regcache, tdep->pc_regnum, pc);
static void
sparc64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ sparc_gdbarch_tdep *tdep = (sparc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
linux_init_abi (info, gdbarch, 0);
static void
sparc64nbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ sparc_gdbarch_tdep *tdep = (sparc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
nbsd_init_abi (info, gdbarch);
static void
sparc64obsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ sparc_gdbarch_tdep *tdep = (sparc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
tdep->gregset = &sparc64obsd_gregset;
tdep->sizeof_gregset = 288;
static void
sparc64_sol2_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ sparc_gdbarch_tdep *tdep = (sparc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
tdep->gregset = &sparc64_sol2_gregset;
tdep->sizeof_gregset = 304;
static struct type *
sparc64_pstate_type (struct gdbarch *gdbarch)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ sparc_gdbarch_tdep *tdep = (sparc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (!tdep->sparc64_pstate_type)
{
static struct type *
sparc64_ccr_type (struct gdbarch *gdbarch)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ sparc_gdbarch_tdep *tdep = (sparc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (tdep->sparc64_ccr_type == NULL)
{
static struct type *
sparc64_fsr_type (struct gdbarch *gdbarch)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ sparc_gdbarch_tdep *tdep = (sparc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (!tdep->sparc64_fsr_type)
{
static struct type *
sparc64_fprs_type (struct gdbarch *gdbarch)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ sparc_gdbarch_tdep *tdep = (sparc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (!tdep->sparc64_fprs_type)
{
void
sparc64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ sparc_gdbarch_tdep *tdep = (sparc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
tdep->pc_regnum = SPARC64_PC_REGNUM;
tdep->npc_regnum = SPARC64_NPC_REGNUM;
static unsigned int
tic6x_register_sigcontext_offset (unsigned int regnum, struct gdbarch *gdbarch)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ tic6x_gdbarch_tdep *tdep = (tic6x_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (regnum == TIC6X_A4_REGNUM || regnum == TIC6X_A4_REGNUM + 2
|| regnum == TIC6X_A4_REGNUM + 4)
+ TIC6X_SIGINFO_SIZE
+ 4 + 4 /* uc_flags and *uc_link in struct ucontext. */
+ TIC6X_STACK_T_SIZE);
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ tic6x_gdbarch_tdep *tdep = (tic6x_gdbarch_tdep *) gdbarch_tdep (gdbarch);
unsigned int reg_offset;
unsigned int i;
static void
tic6x_uclinux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ tic6x_gdbarch_tdep *tdep = (tic6x_gdbarch_tdep *) gdbarch_tdep (gdbarch);
linux_init_abi (info, gdbarch, 0);
static const gdb_byte *
tic6x_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ tic6x_gdbarch_tdep *tdep = (tic6x_gdbarch_tdep *) gdbarch_tdep (gdbarch);
*size = kind;
if (inst == TIC6X_INST_SWE)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ tic6x_gdbarch_tdep *tdep
+ = (tic6x_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (tdep->syscall_next_pc != NULL)
return tdep->syscall_next_pc (get_current_frame ());
tic6x_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
struct gdbarch *gdbarch;
- struct gdbarch_tdep *tdep;
tdesc_arch_data_up tdesc_data;
const struct target_desc *tdesc = info.target_desc;
int has_gp = 0;
arches != NULL;
arches = gdbarch_list_lookup_by_info (arches->next, &info))
{
- tdep = gdbarch_tdep (arches->gdbarch);
+ tic6x_gdbarch_tdep *tdep
+ = (tic6x_gdbarch_tdep *) gdbarch_tdep (arches->gdbarch);
if (has_gp != tdep->has_gp)
continue;
return arches->gdbarch;
}
- tdep = XCNEW (struct gdbarch_tdep);
+ tic6x_gdbarch_tdep *tdep = new tic6x_gdbarch_tdep;
tdep->has_gp = has_gp;
gdbarch = gdbarch_alloc (&info, tdep);
#ifndef TIC6X_TDEP_H
#define TIC6X_TDEP_H
+#include "gdbarch.h"
+
enum
{
TIC6X_A4_REGNUM = 4,
extern const gdb_byte tic6x_bkpt_illegal_opcode_le[];
/* Target-dependent structure in gdbarch. */
-struct gdbarch_tdep
+struct tic6x_gdbarch_tdep : gdbarch_tdep
{
/* 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;
- const gdb_byte *breakpoint; /* Breakpoint instruction. */
+ const gdb_byte *breakpoint = nullptr; /* Breakpoint instruction. */
- int has_gp; /* Has general purpose registers A16 - A31 and B16 - B31. */
+ int has_gp = 0; /* Has general purpose registers A16 - A31 and B16 - B31. */
};
#endif /* TIC6X_TDEP_H */
/* Architecture specific data. */
-struct gdbarch_tdep
+struct v850_gdbarch_tdep : gdbarch_tdep
{
/* Fields from the ELF header. */
- int e_flags;
- int e_machine;
+ int e_flags = 0;
+ int e_machine = 0;
/* Which ABI are we using? */
- enum v850_abi abi;
- int eight_byte_align;
+ enum v850_abi abi {};
+ int eight_byte_align = 0;
};
struct v850_frame_cache
{
int i;
struct type *fld_type, *tgt_type;
+ v850_gdbarch_tdep *tdep = (v850_gdbarch_tdep *) gdbarch_tdep (gdbarch);
- if (gdbarch_tdep (gdbarch)->abi == V850_ABI_RH850)
+ if (tdep->abi == V850_ABI_RH850)
{
if (v850_type_is_scalar (type) && TYPE_LENGTH(type) <= 8)
return 0;
int argnum;
int arg_space = 0;
int stack_offset;
+ v850_gdbarch_tdep *tdep = (v850_gdbarch_tdep *) gdbarch_tdep (gdbarch);
- if (gdbarch_tdep (gdbarch)->abi == V850_ABI_RH850)
+ if (tdep->abi == V850_ABI_RH850)
stack_offset = 0;
else
{
gdb_byte valbuf[v850_reg_size];
if (!v850_type_is_scalar (value_type (*args))
- && gdbarch_tdep (gdbarch)->abi == V850_ABI_GCC
+ && tdep->abi == V850_ABI_GCC
&& TYPE_LENGTH (value_type (*args)) > E_MAX_RETTYPE_SIZE_IN_REGS)
{
store_unsigned_integer (valbuf, 4, byte_order,
val = (gdb_byte *) value_contents (*args).data ();
}
- if (gdbarch_tdep (gdbarch)->eight_byte_align
+ if (tdep->eight_byte_align
&& v850_eight_byte_align_p (value_type (*args)))
{
if (argreg <= E_ARGLAST_REGNUM && (argreg & 1))
v850_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
struct gdbarch *gdbarch;
- struct gdbarch_tdep *tdep;
int e_flags, e_machine;
/* Extract the elf_flags if available. */
arches != NULL;
arches = gdbarch_list_lookup_by_info (arches->next, &info))
{
- if (gdbarch_tdep (arches->gdbarch)->e_flags != e_flags
- || gdbarch_tdep (arches->gdbarch)->e_machine != e_machine)
+ v850_gdbarch_tdep *tdep
+ = (v850_gdbarch_tdep *) gdbarch_tdep (arches->gdbarch);
+
+ if (tdep->e_flags != e_flags || tdep->e_machine != e_machine)
continue;
return arches->gdbarch;
}
- tdep = XCNEW (struct gdbarch_tdep);
+
+ v850_gdbarch_tdep *tdep = new v850_gdbarch_tdep;
tdep->e_flags = e_flags;
tdep->e_machine = e_machine;
/* Register map. */
-xtensa_register_t rmap[] =
+static xtensa_register_t rmap[] =
{
/* idx ofs bi sz al targno flags cp typ group name */
XTREG( 0, 0,32, 4, 4,0x0020,0x0006,-2, 9,0x0100,pc, 0,0,0,0,0,0)
XTREG_END
};
-
-
-#ifdef XTENSA_CONFIG_INSTANTIATE
-XTENSA_CONFIG_INSTANTIATE(rmap,0)
-#endif
-
+xtensa_gdbarch_tdep xtensa_tdep (rmap);
static void
xtensa_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ xtensa_gdbarch_tdep *tdep = (xtensa_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (tdep->num_nopriv_regs < tdep->num_regs)
{
#define TX_PS 0x20
/* ABI-independent macros. */
-#define ARG_NOF(gdbarch) \
- (gdbarch_tdep (gdbarch)->call_abi \
+#define ARG_NOF(tdep) \
+ (tdep->call_abi \
== CallAbiCall0Only ? C0_NARGS : (ARGS_NUM_REGS))
-#define ARG_1ST(gdbarch) \
- (gdbarch_tdep (gdbarch)->call_abi == CallAbiCall0Only \
- ? (gdbarch_tdep (gdbarch)->a0_base + C0_ARGS) \
- : (gdbarch_tdep (gdbarch)->a0_base + 6))
+#define ARG_1ST(tdep) \
+ (tdep->call_abi == CallAbiCall0Only \
+ ? (tdep->a0_base + C0_ARGS) \
+ : (tdep->a0_base + 6))
/* XTENSA_IS_ENTRY tests whether the first byte of an instruction
indicates that the instruction is an ENTRY instruction. */
static int
windowing_enabled (struct gdbarch *gdbarch, unsigned int ps)
{
+ xtensa_gdbarch_tdep *tdep = (xtensa_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+
/* If we know CALL0 ABI is set explicitly, say it is Call0. */
- if (gdbarch_tdep (gdbarch)->call_abi == CallAbiCall0Only)
+ if (tdep->call_abi == CallAbiCall0Only)
return 0;
return ((ps & PS_EXC) == 0 && (ps & PS_WOE) != 0);
static int
arreg_number (struct gdbarch *gdbarch, int a_regnum, ULONGEST wb)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ xtensa_gdbarch_tdep *tdep = (xtensa_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int arreg;
arreg = a_regnum - tdep->a0_base;
static int
areg_number (struct gdbarch *gdbarch, int ar_regnum, unsigned int wb)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ xtensa_gdbarch_tdep *tdep = (xtensa_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int areg;
areg = ar_regnum - tdep->ar_base;
xtensa_find_register_by_name (struct gdbarch *gdbarch, const char *name)
{
int i;
+ xtensa_gdbarch_tdep *tdep = (xtensa_gdbarch_tdep *) gdbarch_tdep (gdbarch);
for (i = 0; i < gdbarch_num_cooked_regs (gdbarch); i++)
-
- if (strcasecmp (gdbarch_tdep (gdbarch)->regmap[i].name, name) == 0)
+ if (strcasecmp (tdep->regmap[i].name, name) == 0)
return i;
return -1;
static const char *
xtensa_register_name (struct gdbarch *gdbarch, int regnum)
{
+ xtensa_gdbarch_tdep *tdep = (xtensa_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+
/* Return the name stored in the register map. */
if (regnum >= 0 && regnum < gdbarch_num_cooked_regs (gdbarch))
- return gdbarch_tdep (gdbarch)->regmap[regnum].name;
+ return tdep->regmap[regnum].name;
internal_error (__FILE__, __LINE__, _("invalid register %d"), regnum);
return 0;
static struct type *
xtensa_register_type (struct gdbarch *gdbarch, int regnum)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ xtensa_gdbarch_tdep *tdep = (xtensa_gdbarch_tdep *) gdbarch_tdep (gdbarch);
/* Return signed integer for ARx and Ax registers. */
if ((regnum >= tdep->ar_base
xtensa_reg_to_regnum (struct gdbarch *gdbarch, int regnum)
{
int i;
+ xtensa_gdbarch_tdep *tdep = (xtensa_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (regnum >= 0 && regnum < 16)
- return gdbarch_tdep (gdbarch)->a0_base + regnum;
+ return tdep->a0_base + regnum;
for (i = 0; i < gdbarch_num_cooked_regs (gdbarch); i++)
- if (regnum == gdbarch_tdep (gdbarch)->regmap[i].target_number)
+ if (regnum == tdep->regmap[i].target_number)
return i;
return -1;
{
DEBUGTRACE ("xtensa_pseudo_register_read (... regnum = %d (%s) ...)\n",
regnum, xtensa_register_name (gdbarch, regnum));
+ xtensa_gdbarch_tdep *tdep = (xtensa_gdbarch_tdep *) gdbarch_tdep (gdbarch);
/* Read aliases a0..a15, if this is a Windowed ABI. */
- if (gdbarch_tdep (gdbarch)->isa_use_windowed_registers
- && (regnum >= gdbarch_tdep (gdbarch)->a0_base)
- && (regnum <= gdbarch_tdep (gdbarch)->a0_base + 15))
+ if (tdep->isa_use_windowed_registers
+ && (regnum >= tdep->a0_base)
+ && (regnum <= tdep->a0_base + 15))
{
ULONGEST value;
enum register_status status;
- status = regcache->raw_read (gdbarch_tdep (gdbarch)->wb_regnum,
+ status = regcache->raw_read (tdep->wb_regnum,
&value);
if (status != REG_VALID)
return status;
/* We have to find out how to deal with priveleged registers.
Let's treat them as pseudo-registers, but we cannot read/write them. */
- else if (gdbarch_tdep (gdbarch)->call_abi == CallAbiCall0Only
- || regnum < gdbarch_tdep (gdbarch)->a0_base)
+ else if (tdep->call_abi == CallAbiCall0Only
+ || regnum < tdep->a0_base)
{
buffer[0] = (gdb_byte)0;
buffer[1] = (gdb_byte)0;
/* Pseudo registers. */
else if (regnum >= 0 && regnum < gdbarch_num_cooked_regs (gdbarch))
{
- xtensa_register_t *reg = &gdbarch_tdep (gdbarch)->regmap[regnum];
+ xtensa_register_t *reg = &tdep->regmap[regnum];
xtensa_register_type_t type = reg->type;
- int flags = gdbarch_tdep (gdbarch)->target_flags;
+ int flags = tdep->target_flags;
/* We cannot read Unknown or Unmapped registers. */
if (type == xtRegisterTypeUnmapped || type == xtRegisterTypeUnknown)
{
DEBUGTRACE ("xtensa_pseudo_register_write (... regnum = %d (%s) ...)\n",
regnum, xtensa_register_name (gdbarch, regnum));
+ xtensa_gdbarch_tdep *tdep = (xtensa_gdbarch_tdep *) gdbarch_tdep (gdbarch);
/* Renumber register, if aliases a0..a15 on Windowed ABI. */
- if (gdbarch_tdep (gdbarch)->isa_use_windowed_registers
- && (regnum >= gdbarch_tdep (gdbarch)->a0_base)
- && (regnum <= gdbarch_tdep (gdbarch)->a0_base + 15))
+ if (tdep->isa_use_windowed_registers
+ && (regnum >= tdep->a0_base)
+ && (regnum <= tdep->a0_base + 15))
{
ULONGEST value;
regcache_raw_read_unsigned (regcache,
- gdbarch_tdep (gdbarch)->wb_regnum, &value);
+ tdep->wb_regnum, &value);
regnum = arreg_number (gdbarch, regnum, value);
}
/* We have to find out how to deal with priveleged registers.
Let's treat them as pseudo-registers, but we cannot read/write them. */
- else if (regnum < gdbarch_tdep (gdbarch)->a0_base)
+ else if (regnum < tdep->a0_base)
{
return;
}
/* Pseudo registers. */
else if (regnum >= 0 && regnum < gdbarch_num_cooked_regs (gdbarch))
{
- xtensa_register_t *reg = &gdbarch_tdep (gdbarch)->regmap[regnum];
+ xtensa_register_t *reg = &tdep->regmap[regnum];
xtensa_register_type_t type = reg->type;
- int flags = gdbarch_tdep (gdbarch)->target_flags;
+ int flags = tdep->target_flags;
/* On most targets, we cannot write registers
of type "Unknown" or "Unmapped". */
int regnum,
struct reggroup *group)
{
- xtensa_register_t* reg = &gdbarch_tdep (gdbarch)->regmap[regnum];
+ xtensa_gdbarch_tdep *tdep = (xtensa_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+ xtensa_register_t* reg = &tdep->regmap[regnum];
xtensa_register_type_t type = reg->type;
xtensa_register_group_t rg = reg->group;
int cp_number;
{
const xtensa_elf_gregset_t *regs = (const xtensa_elf_gregset_t *) gregs;
struct gdbarch *gdbarch = rc->arch ();
+ xtensa_gdbarch_tdep *tdep = (xtensa_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int i;
DEBUGTRACE ("xtensa_supply_gregset (..., regnum==%d, ...)\n", regnum);
rc->raw_supply (gdbarch_pc_regnum (gdbarch), (char *) ®s->pc);
if (regnum == gdbarch_ps_regnum (gdbarch) || regnum == -1)
rc->raw_supply (gdbarch_ps_regnum (gdbarch), (char *) ®s->ps);
- if (regnum == gdbarch_tdep (gdbarch)->wb_regnum || regnum == -1)
- rc->raw_supply (gdbarch_tdep (gdbarch)->wb_regnum,
+ if (regnum == tdep->wb_regnum || regnum == -1)
+ rc->raw_supply (tdep->wb_regnum,
(char *) ®s->windowbase);
- if (regnum == gdbarch_tdep (gdbarch)->ws_regnum || regnum == -1)
- rc->raw_supply (gdbarch_tdep (gdbarch)->ws_regnum,
+ if (regnum == tdep->ws_regnum || regnum == -1)
+ rc->raw_supply (tdep->ws_regnum,
(char *) ®s->windowstart);
- if (regnum == gdbarch_tdep (gdbarch)->lbeg_regnum || regnum == -1)
- rc->raw_supply (gdbarch_tdep (gdbarch)->lbeg_regnum,
+ if (regnum == tdep->lbeg_regnum || regnum == -1)
+ rc->raw_supply (tdep->lbeg_regnum,
(char *) ®s->lbeg);
- if (regnum == gdbarch_tdep (gdbarch)->lend_regnum || regnum == -1)
- rc->raw_supply (gdbarch_tdep (gdbarch)->lend_regnum,
+ if (regnum == tdep->lend_regnum || regnum == -1)
+ rc->raw_supply (tdep->lend_regnum,
(char *) ®s->lend);
- if (regnum == gdbarch_tdep (gdbarch)->lcount_regnum || regnum == -1)
- rc->raw_supply (gdbarch_tdep (gdbarch)->lcount_regnum,
+ if (regnum == tdep->lcount_regnum || regnum == -1)
+ rc->raw_supply (tdep->lcount_regnum,
(char *) ®s->lcount);
- if (regnum == gdbarch_tdep (gdbarch)->sar_regnum || regnum == -1)
- rc->raw_supply (gdbarch_tdep (gdbarch)->sar_regnum,
+ if (regnum == tdep->sar_regnum || regnum == -1)
+ rc->raw_supply (tdep->sar_regnum,
(char *) ®s->sar);
- if (regnum >=gdbarch_tdep (gdbarch)->ar_base
- && regnum < gdbarch_tdep (gdbarch)->ar_base
- + gdbarch_tdep (gdbarch)->num_aregs)
+ if (regnum >=tdep->ar_base
+ && regnum < tdep->ar_base
+ + tdep->num_aregs)
rc->raw_supply
- (regnum, (char *) ®s->ar[regnum - gdbarch_tdep (gdbarch)->ar_base]);
+ (regnum, (char *) ®s->ar[regnum - tdep->ar_base]);
else if (regnum == -1)
{
- for (i = 0; i < gdbarch_tdep (gdbarch)->num_aregs; ++i)
- rc->raw_supply (gdbarch_tdep (gdbarch)->ar_base + i,
+ for (i = 0; i < tdep->num_aregs; ++i)
+ rc->raw_supply (tdep->ar_base + i,
(char *) ®s->ar[i]);
}
}
xtensa_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
{
CORE_ADDR pc, fp;
+ xtensa_gdbarch_tdep *tdep = (xtensa_gdbarch_tdep *) gdbarch_tdep (gdbarch);
/* THIS-FRAME is a dummy frame. Return a frame ID of that frame. */
pc = get_frame_pc (this_frame);
fp = get_frame_register_unsigned
- (this_frame, gdbarch_tdep (gdbarch)->a0_base + 1);
+ (this_frame, tdep->a0_base + 1);
/* Make dummy frame ID unique by adding a constant. */
return frame_id_build (fp + SP_ALIGNMENT, pc);
{
#define RETURN_FP goto done
- unsigned int fp_regnum = gdbarch_tdep (gdbarch)->a0_base + 1;
+ xtensa_gdbarch_tdep *tdep = (xtensa_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+ unsigned int fp_regnum = tdep->a0_base + 1;
CORE_ADDR start_addr;
xtensa_isa isa;
xtensa_insnbuf ins, slot;
RETURN_FP;
fp_regnum
- = gdbarch_tdep (gdbarch)->a0_base + register_operand;
+ = tdep->a0_base + register_operand;
RETURN_FP;
}
}
if (windowed)
{
LONGEST op1;
+ xtensa_gdbarch_tdep *tdep = (xtensa_gdbarch_tdep *) gdbarch_tdep (gdbarch);
/* Get WINDOWBASE, WINDOWSTART, and PS registers. */
wb = get_frame_register_unsigned (this_frame,
- gdbarch_tdep (gdbarch)->wb_regnum);
+ tdep->wb_regnum);
ws = get_frame_register_unsigned (this_frame,
- gdbarch_tdep (gdbarch)->ws_regnum);
+ tdep->ws_regnum);
if (safe_read_memory_integer (pc, 1, byte_order, &op1)
&& XTENSA_IS_ENTRY (gdbarch, op1))
{
int callinc = CALLINC (ps);
ra = get_frame_register_unsigned
- (this_frame, gdbarch_tdep (gdbarch)->a0_base + callinc * 4);
+ (this_frame, tdep->a0_base + callinc * 4);
/* ENTRY hasn't been executed yet, therefore callsize is still 0. */
cache->wd.callsize = 0;
cache->wd.wb = wb;
cache->wd.ws = ws;
cache->prev_sp = get_frame_register_unsigned
- (this_frame, gdbarch_tdep (gdbarch)->a0_base + 1);
+ (this_frame, tdep->a0_base + 1);
/* This only can be the outermost frame since we are
just about to execute ENTRY. SP hasn't been set yet.
{
fp_regnum = xtensa_scan_prologue (gdbarch, pc);
ra = get_frame_register_unsigned (this_frame,
- gdbarch_tdep (gdbarch)->a0_base);
+ tdep->a0_base);
cache->wd.callsize = WINSIZE (ra);
cache->wd.wb = (wb - cache->wd.callsize / 4)
- & (gdbarch_tdep (gdbarch)->num_aregs / 4 - 1);
+ & (tdep->num_aregs / 4 - 1);
cache->wd.ws = ws & ~(1 << wb);
cache->pc = get_frame_func (this_frame);
/* Set A0...A3. */
sp = get_frame_register_unsigned
- (this_frame, gdbarch_tdep (gdbarch)->a0_base + 1) - 16;
+ (this_frame, tdep->a0_base + 1) - 16;
for (i = 0; i < 4; i++, sp += 4)
{
/* Register window overflow already happened.
We can read caller's SP from the proper spill location. */
sp = get_frame_register_unsigned
- (this_frame, gdbarch_tdep (gdbarch)->a0_base + 1);
+ (this_frame, tdep->a0_base + 1);
cache->prev_sp = read_memory_integer (sp - 12, 4, byte_order);
}
else
{
/* Read caller's frame SP directly from the previous window. */
int regnum = arreg_number
- (gdbarch, gdbarch_tdep (gdbarch)->a0_base + 1,
+ (gdbarch, tdep->a0_base + 1,
cache->wd.wb);
cache->prev_sp = xtensa_read_register (regnum);
struct xtensa_frame_cache *cache;
ULONGEST saved_reg = 0;
int done = 1;
+ xtensa_gdbarch_tdep *tdep = (xtensa_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (*this_cache == NULL)
*this_cache = xtensa_frame_cache (this_frame, this_cache);
if (regnum ==gdbarch_pc_regnum (gdbarch))
saved_reg = cache->ra;
- else if (regnum == gdbarch_tdep (gdbarch)->a0_base + 1)
+ else if (regnum == tdep->a0_base + 1)
saved_reg = cache->prev_sp;
else if (!cache->call0)
{
- if (regnum == gdbarch_tdep (gdbarch)->ws_regnum)
+ if (regnum == tdep->ws_regnum)
saved_reg = cache->wd.ws;
- else if (regnum == gdbarch_tdep (gdbarch)->wb_regnum)
+ else if (regnum == tdep->wb_regnum)
saved_reg = cache->wd.wb;
else if (regnum == gdbarch_ps_regnum (gdbarch))
saved_reg = cache->ps;
{
/* Convert A-register numbers to AR-register numbers,
if we deal with A-register. */
- if (regnum >= gdbarch_tdep (gdbarch)->a0_base
- && regnum <= gdbarch_tdep (gdbarch)->a0_base + 15)
+ if (regnum >= tdep->a0_base
+ && regnum <= tdep->a0_base + 15)
regnum = arreg_number (gdbarch, regnum, cache->wd.wb);
/* Check, if we deal with AR-register saved on stack. */
- if (regnum >= gdbarch_tdep (gdbarch)->ar_base
- && regnum <= (gdbarch_tdep (gdbarch)->ar_base
- + gdbarch_tdep (gdbarch)->num_aregs))
+ if (regnum >= tdep->ar_base
+ && regnum <= (tdep->ar_base
+ + tdep->num_aregs))
{
int areg = areg_number (gdbarch, regnum, cache->wd.wb);
}
else /* Call0 ABI. */
{
- int reg = (regnum >= gdbarch_tdep (gdbarch)->ar_base
- && regnum <= (gdbarch_tdep (gdbarch)->ar_base
+ int reg = (regnum >= tdep->ar_base
+ && regnum <= (tdep->ar_base
+ C0_NREGS))
- ? regnum - gdbarch_tdep (gdbarch)->ar_base : regnum;
+ ? regnum - tdep->ar_base : regnum;
if (reg < C0_NREGS)
{
gdb_assert(len > 0);
- if (gdbarch_tdep (gdbarch)->call_abi != CallAbiCall0Only)
+ xtensa_gdbarch_tdep *tdep = (xtensa_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+ if (tdep->call_abi != CallAbiCall0Only)
{
/* First, we have to find the caller window in the register file. */
regcache_raw_read_unsigned (regcache, gdbarch_pc_regnum (gdbarch), &pc);
/* Get the register offset of the return
register (A2) in the caller window. */
regcache_raw_read_unsigned
- (regcache, gdbarch_tdep (gdbarch)->wb_regnum, &wb);
+ (regcache, tdep->wb_regnum, &wb);
areg = arreg_number (gdbarch,
- gdbarch_tdep (gdbarch)->a0_base + 2 + callsize, wb);
+ tdep->a0_base + 2 + callsize, wb);
}
else
{
/* No windowing hardware - Call0 ABI. */
- areg = gdbarch_tdep (gdbarch)->a0_base + C0_ARGS;
+ areg = tdep->a0_base + C0_ARGS;
}
DEBUGINFO ("[xtensa_extract_return_value] areg %d len %d\n", areg, len);
DEBUGTRACE ("xtensa_store_return_value (...)\n");
- if (gdbarch_tdep (gdbarch)->call_abi != CallAbiCall0Only)
+ xtensa_gdbarch_tdep *tdep = (xtensa_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+ if (tdep->call_abi != CallAbiCall0Only)
{
regcache_raw_read_unsigned
- (regcache, gdbarch_tdep (gdbarch)->wb_regnum, &wb);
+ (regcache, tdep->wb_regnum, &wb);
regcache_raw_read_unsigned (regcache, gdbarch_pc_regnum (gdbarch), &pc);
callsize = extract_call_winsize (gdbarch, pc);
_("unimplemented for this length: %s"),
pulongest (TYPE_LENGTH (type)));
areg = arreg_number (gdbarch,
- gdbarch_tdep (gdbarch)->a0_base + 2 + callsize, wb);
+ tdep->a0_base + 2 + callsize, wb);
DEBUGTRACE ("[xtensa_store_return_value] callsize %d wb %d\n",
callsize, (int) wb);
}
else
{
- areg = gdbarch_tdep (gdbarch)->a0_base + C0_ARGS;
+ areg = tdep->a0_base + C0_ARGS;
}
if (len < 4 && gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
CORE_ADDR struct_addr)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
+ xtensa_gdbarch_tdep *tdep = (xtensa_gdbarch_tdep *) gdbarch_tdep (gdbarch);
int size, onstack_size;
gdb_byte *buf = (gdb_byte *) alloca (16);
CORE_ADDR ra, ps;
size = (size + info->align - 1) & ~(info->align - 1);
onstack_size = (onstack_size + info->align - 1) & ~(info->align - 1);
- if (size + info->length > REGISTER_SIZE * ARG_NOF (gdbarch))
+ if (size + info->length > REGISTER_SIZE * ARG_NOF (tdep))
{
info->onstack = 1;
info->u.offset = onstack_size;
else
{
info->onstack = 0;
- info->u.regno = ARG_1ST (gdbarch) + size / REGISTER_SIZE;
+ info->u.regno = ARG_1ST (tdep) + size / REGISTER_SIZE;
}
size += info->length;
}
sp = align_down (sp - onstack_size, SP_ALIGNMENT);
/* Simulate MOVSP, if Windowed ABI. */
- if ((gdbarch_tdep (gdbarch)->call_abi != CallAbiCall0Only)
+ if ((tdep->call_abi != CallAbiCall0Only)
&& (sp != osp))
{
read_memory (osp - 16, buf, 16);
if (return_method == return_method_struct)
{
store_unsigned_integer (buf, REGISTER_SIZE, byte_order, struct_addr);
- regcache->cooked_write (ARG_1ST (gdbarch), buf);
+ regcache->cooked_write (ARG_1ST (tdep), buf);
}
for (int i = 0; i < nargs; i++)
The return address for the current function (in A0) is
saved in the dummy frame, so we can safely overwrite A0 here. */
- if (gdbarch_tdep (gdbarch)->call_abi != CallAbiCall0Only)
+ if (tdep->call_abi != CallAbiCall0Only)
{
ULONGEST val;
regcache_raw_read_unsigned (regcache, gdbarch_ps_regnum (gdbarch), &val);
ps = (unsigned long) val & ~0x00030000;
regcache_cooked_write_unsigned
- (regcache, gdbarch_tdep (gdbarch)->a0_base + 4, ra);
+ (regcache, tdep->a0_base + 4, ra);
regcache_cooked_write_unsigned (regcache,
gdbarch_ps_regnum (gdbarch),
ps | 0x00010000);
to modify WINDOWSTART register to make it look like there
is only one register window corresponding to WINDOWEBASE. */
- regcache->raw_read (gdbarch_tdep (gdbarch)->wb_regnum, buf);
+ regcache->raw_read (tdep->wb_regnum, buf);
regcache_cooked_write_unsigned
- (regcache, gdbarch_tdep (gdbarch)->ws_regnum,
+ (regcache, tdep->ws_regnum,
1 << extract_unsigned_integer (buf, 4, byte_order));
}
else
{
/* Simulate CALL0: write RA into A0 register. */
regcache_cooked_write_unsigned
- (regcache, gdbarch_tdep (gdbarch)->a0_base, bp_addr);
+ (regcache, tdep->a0_base, bp_addr);
}
/* Set new stack pointer and return it. */
regcache_cooked_write_unsigned (regcache,
- gdbarch_tdep (gdbarch)->a0_base + 1, sp);
+ tdep->a0_base + 1, sp);
/* Make dummy frame ID unique by adding a constant. */
return sp + SP_ALIGNMENT;
}
static int
xtensa_breakpoint_kind_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr)
{
- if (gdbarch_tdep (gdbarch)->isa_use_density_instructions)
+ xtensa_gdbarch_tdep *tdep = (xtensa_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+
+ if (tdep->isa_use_density_instructions)
return 2;
else
return 4;
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
unsigned litbase, litaddr, litval;
+ xtensa_gdbarch_tdep *tdep = (xtensa_gdbarch_tdep *) gdbarch_tdep (gdbarch);
switch (opclass)
{
/* 2 operands: dst, literal offset. */
gdb_assert (nods == 2);
/* litbase = xtensa_get_litbase (pc); can be also used. */
- litbase = (gdbarch_tdep (gdbarch)->litbase_regnum == -1)
+ litbase = (tdep->litbase_regnum == -1)
? 0 : xtensa_read_register
- (gdbarch_tdep (gdbarch)->litbase_regnum);
+ (tdep->litbase_regnum);
litaddr = litbase & 1
? (litbase & ~1) + (signed)odv[1]
: (pc + 3 + (signed)odv[1]) & ~3;
CORE_ADDR body_pc=UINT_MAX; /* PC, where prologue analysis stopped. */
CORE_ADDR sp, fp, ra;
int fp_regnum = C0_SP, c0_hasfp = 0, c0_frmsz = 0, prev_sp = 0, to_stk;
+ xtensa_gdbarch_tdep *tdep = (xtensa_gdbarch_tdep *) gdbarch_tdep (gdbarch);
sp = get_frame_register_unsigned
- (this_frame, gdbarch_tdep (gdbarch)->a0_base + 1);
+ (this_frame, tdep->a0_base + 1);
fp = sp; /* Assume FP == SP until proven otherwise. */
/* Find the beginning of the prologue of the function containing the PC
was derived from SP. Otherwise, it would be C0_FP. */
fp_regnum = c0_hasfp ? C0_FP : C0_SP;
c0_frmsz = - cache->c0.c0_rt[fp_regnum].fr_ofs;
- fp_regnum += gdbarch_tdep (gdbarch)->a0_base;
+ fp_regnum += tdep->a0_base;
}
else /* No data from the prologue analysis. */
{
c0_hasfp = 0;
- fp_regnum = gdbarch_tdep (gdbarch)->a0_base + C0_SP;
+ fp_regnum = tdep->a0_base + C0_SP;
c0_frmsz = 0;
start_pc = pc;
}
if (cache->c0.c0_sp_ofs == C0_NOSTK)
/* Saved unaligned value of SP is kept in a register. */
unaligned_sp = get_frame_register_unsigned
- (this_frame, gdbarch_tdep (gdbarch)->a0_base + cache->c0.c0_old_sp);
+ (this_frame, tdep->a0_base + cache->c0.c0_old_sp);
else
/* Get the value from stack. */
unaligned_sp = (CORE_ADDR)
{
ra = get_frame_register_unsigned
(this_frame,
- gdbarch_tdep (gdbarch)->a0_base + cache->c0.c0_rt[i].fr_reg);
+ tdep->a0_base + cache->c0.c0_rt[i].fr_reg);
}
else ra = 0;
}
static void
execute_l32e (struct gdbarch *gdbarch, int at, int as, int offset, CORE_ADDR wb)
{
- int atreg = arreg_number (gdbarch, gdbarch_tdep (gdbarch)->a0_base + at, wb);
- int asreg = arreg_number (gdbarch, gdbarch_tdep (gdbarch)->a0_base + as, wb);
+ xtensa_gdbarch_tdep *tdep = (xtensa_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+ int atreg = arreg_number (gdbarch, tdep->a0_base + at, wb);
+ int asreg = arreg_number (gdbarch, tdep->a0_base + as, wb);
CORE_ADDR addr = xtensa_read_register (asreg) + offset;
unsigned int spilled_value
= read_memory_unsigned_integer (addr, 4, gdbarch_byte_order (gdbarch));
static void
execute_s32e (struct gdbarch *gdbarch, int at, int as, int offset, CORE_ADDR wb)
{
- int atreg = arreg_number (gdbarch, gdbarch_tdep (gdbarch)->a0_base + at, wb);
- int asreg = arreg_number (gdbarch, gdbarch_tdep (gdbarch)->a0_base + as, wb);
+ xtensa_gdbarch_tdep *tdep = (xtensa_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+ int atreg = arreg_number (gdbarch, tdep->a0_base + at, wb);
+ int asreg = arreg_number (gdbarch, tdep->a0_base + as, wb);
CORE_ADDR addr = xtensa_read_register (asreg) + offset;
ULONGEST spilled_value = xtensa_read_register (atreg);
xtensa_opcode opc;
int insn_num = 0;
void (*func) (struct gdbarch *, int, int, int, CORE_ADDR);
+ xtensa_gdbarch_tdep *tdep = (xtensa_gdbarch_tdep *) gdbarch_tdep (gdbarch);
uint32_t at, as, offset;
if (a0_was_saved)
{
int arreg = arreg_number (gdbarch,
- gdbarch_tdep (gdbarch)->a0_base,
+ tdep->a0_base,
wb);
xtensa_write_register (arreg, a0_saved);
}
if (a11_was_saved)
{
int arreg = arreg_number (gdbarch,
- gdbarch_tdep (gdbarch)->a0_base + 11,
+ tdep->a0_base + 11,
wb);
xtensa_write_register (arreg, a11_saved);
}
else if (a7_was_saved)
{
int arreg = arreg_number (gdbarch,
- gdbarch_tdep (gdbarch)->a0_base + 7,
+ tdep->a0_base + 7,
wb);
xtensa_write_register (arreg, a7_saved);
}
CORE_ADDR ps, wb, ws, ra;
int epc1_regnum, i, regnum;
xtensa_exception_handler_t eh_type;
+ xtensa_gdbarch_tdep *tdep = (xtensa_gdbarch_tdep *) gdbarch_tdep (gdbarch);
/* Read PS, WB, and WS from the hardware. Note that PS register
must be present, if Windowed ABI is supported. */
ps = xtensa_read_register (gdbarch_ps_regnum (gdbarch));
- wb = xtensa_read_register (gdbarch_tdep (gdbarch)->wb_regnum);
- ws = xtensa_read_register (gdbarch_tdep (gdbarch)->ws_regnum);
+ wb = xtensa_read_register (tdep->wb_regnum);
+ ws = xtensa_read_register (tdep->ws_regnum);
/* Execute all the remaining instructions from Window Interrupt Handler
by simulating them on the remote protocol level. On return, set the
cache->wd.ws = ws | (1 << wb);
cache->wd.wb = (ps & 0xf00) >> 8; /* Set WB to OWB. */
- regnum = arreg_number (gdbarch, gdbarch_tdep (gdbarch)->a0_base,
+ regnum = arreg_number (gdbarch, tdep->a0_base,
cache->wd.wb);
ra = xtensa_read_register (regnum);
cache->wd.callsize = WINSIZE (ra);
/* Set regnum to a frame pointer of the frame being cached. */
regnum = xtensa_scan_prologue (gdbarch, pc);
regnum = arreg_number (gdbarch,
- gdbarch_tdep (gdbarch)->a0_base + regnum,
+ tdep->a0_base + regnum,
cache->wd.wb);
cache->base = get_frame_register_unsigned (this_frame, regnum);
CORE_ADDR end_func;
- if ((gdbarch_tdep (gdbarch)->call_abi == CallAbiCall0Only)
+ xtensa_gdbarch_tdep *tdep = (xtensa_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+ if ((tdep->call_abi == CallAbiCall0Only)
&& call0_ret (start_pc, prologue_sal.end))
return start_pc;
static void
xtensa_verify_config (struct gdbarch *gdbarch)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ xtensa_gdbarch_tdep *tdep = (xtensa_gdbarch_tdep *) gdbarch_tdep (gdbarch);
string_file log;
/* Verify that we got a reasonable number of AREGS. */
/* Derive specific register numbers from the array of registers. */
static void
-xtensa_derive_tdep (struct gdbarch_tdep *tdep)
+xtensa_derive_tdep (xtensa_gdbarch_tdep *tdep)
{
xtensa_register_t* rmap;
int n, max_size = 4;
/* Module "constructor" function. */
-extern struct gdbarch_tdep xtensa_tdep;
+extern xtensa_gdbarch_tdep xtensa_tdep;
static struct gdbarch *
xtensa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
- struct gdbarch_tdep *tdep;
struct gdbarch *gdbarch;
DEBUGTRACE ("gdbarch_init()\n");
/* We have to set the byte order before we call gdbarch_alloc. */
info.byte_order = XCHAL_HAVE_BE ? BFD_ENDIAN_BIG : BFD_ENDIAN_LITTLE;
- tdep = &xtensa_tdep;
+ xtensa_gdbarch_tdep *tdep = &xtensa_tdep;
gdbarch = gdbarch_alloc (&info, tdep);
xtensa_derive_tdep (tdep);
#define XTENSA_TDEP_H
#include "arch/xtensa.h"
+#include "gdbarch.h"
+#include "xtensa-config.h"
/* XTENSA_TDEP_VERSION can/should be changed along with XTENSA_CONFIG_VERSION
whenever the "tdep" structure changes in an incompatible way. */
struct type *virtual_type;
};
+#ifndef XCHAL_NUM_CONTEXTS
+# define XCHAL_NUM_CONTEXTS 0
+#endif
+
+#ifndef XCHAL_HAVE_EXCEPTIONS
+# define XCHAL_HAVE_EXCEPTIONS 1
+#endif
+
/* Xtensa-specific target dependencies. */
-struct gdbarch_tdep
+struct xtensa_gdbarch_tdep : gdbarch_tdep
{
- unsigned int target_flags;
+ xtensa_gdbarch_tdep (xtensa_register_t *regmap)
+ : regmap (regmap)
+ {}
+
+ unsigned int target_flags = 0;
/* Spill location for TIE register files under ocd. */
- unsigned int spill_location;
- unsigned int spill_size;
+ unsigned int spill_location = (unsigned int) -1;
+ unsigned int spill_size = 0;
- char *unused; /* Placeholder for compatibility. */
- call_abi_t call_abi; /* Calling convention. */
+ char *unused = nullptr; /* Placeholder for compatibility. */
+
+ /* Calling convention. */
+ call_abi_t call_abi = (XSHAL_ABI == XTHAL_ABI_CALL0
+ ? CallAbiCall0Only : CallAbiDefault);
/* CPU configuration. */
- unsigned int debug_interrupt_level;
+ unsigned int debug_interrupt_level = XCHAL_DEBUGLEVEL;
- unsigned int icache_line_bytes;
- unsigned int dcache_line_bytes;
- unsigned int dcache_writeback;
+ unsigned int icache_line_bytes = XCHAL_ICACHE_LINESIZE;
+ unsigned int dcache_line_bytes = XCHAL_DCACHE_LINESIZE;
+ unsigned int dcache_writeback = XCHAL_DCACHE_IS_WRITEBACK;
- unsigned int isa_use_windowed_registers;
- unsigned int isa_use_density_instructions;
- unsigned int isa_use_exceptions;
- unsigned int isa_use_ext_l32r;
- unsigned int isa_max_insn_size; /* Maximum instruction length. */
- unsigned int debug_num_ibreaks; /* Number of IBREAKs. */
- unsigned int debug_num_dbreaks;
+ unsigned int isa_use_windowed_registers = XSHAL_ABI != XTHAL_ABI_CALL0;
+ unsigned int isa_use_density_instructions = XCHAL_HAVE_DENSITY;
+ unsigned int isa_use_exceptions = XCHAL_HAVE_EXCEPTIONS;
+ unsigned int isa_use_ext_l32r = XSHAL_USE_ABSOLUTE_LITERALS;
+ unsigned int isa_max_insn_size = XCHAL_MAX_INSTRUCTION_SIZE; /* Maximum instruction length. */
+ unsigned int debug_num_ibreaks = XCHAL_NUM_IBREAK; /* Number of IBREAKs. */
+ unsigned int debug_num_dbreaks = XCHAL_NUM_DBREAK;
/* Register map. */
- xtensa_register_t* regmap;
-
- unsigned int num_regs; /* Number of registers in register map. */
- unsigned int num_nopriv_regs; /* Number of non-privileged registers. */
- unsigned int num_pseudo_regs; /* Number of pseudo registers. */
- unsigned int num_aregs; /* Size of register file. */
- unsigned int num_contexts;
-
- int ar_base; /* Register number for AR0. */
- int a0_base; /* Register number for A0 (pseudo). */
- int wb_regnum; /* Register number for WB. */
- int ws_regnum; /* Register number for WS. */
- int pc_regnum; /* Register number for PC. */
- int ps_regnum; /* Register number for PS. */
- int lbeg_regnum; /* Register numbers for count regs. */
- int lend_regnum;
- int lcount_regnum;
- int sar_regnum; /* Register number of SAR. */
- int litbase_regnum; /* Register number of LITBASE. */
- int threadptr_regnum; /* Register number of THREADPTR. */
-
- int interrupt_regnum; /* Register number for interrupt. */
- int interrupt2_regnum; /* Register number for interrupt2. */
- int cpenable_regnum; /* Register number for cpenable. */
- int debugcause_regnum; /* Register number for debugcause. */
- int exccause_regnum; /* Register number for exccause. */
- int excvaddr_regnum; /* Register number for excvaddr. */
-
- int max_register_raw_size;
- int max_register_virtual_size;
- unsigned long *fp_layout; /* Layout of custom/TIE regs in 'FP' area. */
- unsigned int fp_layout_bytes; /* Size of layout information (in bytes). */
- unsigned long *gregmap;
+ xtensa_register_t *regmap;
+
+ unsigned int num_regs = 0; /* Number of registers in register map. */
+ unsigned int num_nopriv_regs = 0; /* Number of non-privileged registers. */
+ unsigned int num_pseudo_regs = 0; /* Number of pseudo registers. */
+ unsigned int num_aregs = XCHAL_NUM_AREGS; /* Size of register file. */
+ unsigned int num_contexts = XCHAL_NUM_CONTEXTS;
+
+ int ar_base = -1; /* Register number for AR0. */
+ int a0_base = -1; /* Register number for A0 (pseudo). */
+ int wb_regnum = -1; /* Register number for WB. */
+ int ws_regnum = -1; /* Register number for WS. */
+ int pc_regnum = -1; /* Register number for PC. */
+ int ps_regnum = -1; /* Register number for PS. */
+ int lbeg_regnum = -1; /* Register numbers for count regs. */
+ int lend_regnum = -1;
+ int lcount_regnum = -1;
+ int sar_regnum = -1; /* Register number of SAR. */
+ int litbase_regnum = -1; /* Register number of LITBASE. */
+ int threadptr_regnum = -1; /* Register number of THREADPTR. */
+
+ int interrupt_regnum = -1; /* Register number for interrupt. */
+ int interrupt2_regnum = -1; /* Register number for interrupt2. */
+ int cpenable_regnum = -1; /* Register number for cpenable. */
+ int debugcause_regnum = -1; /* Register number for debugcause. */
+ int exccause_regnum = -1; /* Register number for exccause. */
+ int excvaddr_regnum = -1; /* Register number for excvaddr. */
+
+ int max_register_raw_size = 0;
+ int max_register_virtual_size = 0;
+ unsigned long *fp_layout = nullptr; /* Layout of custom/TIE regs in 'FP' area. */
+ unsigned int fp_layout_bytes = 0; /* Size of layout information (in bytes). */
+ unsigned long *gregmap = nullptr;
/* Cached register types. */
- struct ctype_cache *type_entries;
+ struct ctype_cache *type_entries = nullptr;
};
-/* Macro to instantiate a gdbarch_tdep structure. */
-
-#define XTENSA_GDBARCH_TDEP_INSTANTIATE(rmap,spillsz) \
- { \
- 0, /* target_flags */ \
- (unsigned) -1, /* spill_location */ \
- (spillsz), /* spill_size */ \
- 0, /* unused */ \
- (XSHAL_ABI == XTHAL_ABI_CALL0 \
- ? CallAbiCall0Only \
- : CallAbiDefault), /* call_abi */ \
- XCHAL_DEBUGLEVEL, /* debug_interrupt_level */ \
- XCHAL_ICACHE_LINESIZE, /* icache_line_bytes */ \
- XCHAL_DCACHE_LINESIZE, /* dcache_line_bytes */ \
- XCHAL_DCACHE_IS_WRITEBACK, /* dcache_writeback */ \
- (XSHAL_ABI != XTHAL_ABI_CALL0), /* isa_use_windowed_registers */ \
- XCHAL_HAVE_DENSITY, /* isa_use_density_instructions */ \
- XCHAL_HAVE_EXCEPTIONS, /* isa_use_exceptions */ \
- XSHAL_USE_ABSOLUTE_LITERALS, /* isa_use_ext_l32r */ \
- XCHAL_MAX_INSTRUCTION_SIZE, /* isa_max_insn_size */ \
- XCHAL_NUM_IBREAK, /* debug_num_ibreaks */ \
- XCHAL_NUM_DBREAK, /* debug_num_dbreaks */ \
- rmap, /* regmap */ \
- 0, /* num_regs */ \
- 0, /* num_nopriv_regs */ \
- 0, /* num_pseudo_regs */ \
- XCHAL_NUM_AREGS, /* num_aregs */ \
- XCHAL_NUM_CONTEXTS, /* num_contexts */ \
- -1, /* ar_base */ \
- -1, /* a0_base */ \
- -1, /* wb_regnum */ \
- -1, /* ws_regnum */ \
- -1, /* pc_regnum */ \
- -1, /* ps_regnum */ \
- -1, /* lbeg_regnum */ \
- -1, /* lend_regnum */ \
- -1, /* lcount_regnum */ \
- -1, /* sar_regnum */ \
- -1, /* litbase_regnum */ \
- -1, /* interrupt_regnum */ \
- -1, /* interrupt2_regnum */ \
- -1, /* cpenable_regnum */ \
- -1, /* debugcause_regnum */ \
- -1, /* exccause_regnum */ \
- -1, /* excvaddr_regnum */ \
- 0, /* max_register_raw_size */ \
- 0, /* max_register_virtual_size */ \
- 0, /* fp_layout */ \
- 0, /* fp_layout_bytes */ \
- 0, /* gregmap */ \
- }
-#define XTENSA_CONFIG_INSTANTIATE(rmap,spill_size) \
- struct gdbarch_tdep xtensa_tdep = \
- XTENSA_GDBARCH_TDEP_INSTANTIATE(rmap,spill_size);
-
-#ifndef XCHAL_NUM_CONTEXTS
-#define XCHAL_NUM_CONTEXTS 0
-#endif
-#ifndef XCHAL_HAVE_EXCEPTIONS
-#define XCHAL_HAVE_EXCEPTIONS 1
-#endif
#define WB_SHIFT 2
/* We assign fixed numbers to the registers of the "current" window
next frame - frame of caller, which has called current function
*/
-struct gdbarch_tdep
+struct z80_gdbarch_tdep : gdbarch_tdep
{
/* Number of bytes used for address:
2 bytes for all Z80 family
3 bytes for eZ80 CPUs operating in ADL mode */
- int addr_length;
+ int addr_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;
};
/* At any time stack frame contains following parts:
struct z80_unwind_cache *info)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
- int addr_len = gdbarch_tdep (gdbarch)->addr_length;
+ z80_gdbarch_tdep *tdep = (z80_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+ int addr_len = tdep->addr_length;
gdb_byte prologue[32]; /* max prologue is 24 bytes: __interrupt with local array */
int pos = 0;
int len;
gdb_byte buf[sizeof(void*)];
struct z80_unwind_cache *info;
struct gdbarch *gdbarch = get_frame_arch (this_frame);
- int addr_len = gdbarch_tdep (gdbarch)->addr_length;
+ z80_gdbarch_tdep *tdep = (z80_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+ int addr_len = tdep->addr_length;
if (*this_prologue_cache)
return (struct z80_unwind_cache *) *this_prologue_cache;
ULONGEST pc;
gdb_byte buf[3];
struct gdbarch *gdbarch = get_frame_arch (this_frame);
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ z80_gdbarch_tdep *tdep = (z80_gdbarch_tdep *) gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
read_memory (info->saved_regs[Z80_PC_REGNUM].addr (),
}
else /* kind is non-RST address, use CALL instead, but it is dungerous */
{
+ z80_gdbarch_tdep *tdep = (z80_gdbarch_tdep *) gdbarch_tdep (gdbarch);
gdb_byte *p = break_insn;
*p++ = 0xcd;
*p++ = (kind >> 0) & 0xff;
*p++ = (kind >> 8) & 0xff;
- if (gdbarch_tdep (gdbarch)->addr_length > 2)
+ if (tdep->addr_length > 2)
*p++ = (kind >> 16) & 0xff;
*size = p - break_insn;
}
z80_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;
unsigned long mach = info.bfd_arch_info->mach;
}
/* None found, create a new architecture from the information provided. */
- tdep = XCNEW (struct gdbarch_tdep);
+ z80_gdbarch_tdep *tdep = new z80_gdbarch_tdep;
gdbarch = gdbarch_alloc (&info, tdep);
if (mach == bfd_mach_ez80_adl)