diff options
author | Andrew Burgess <aburgess@redhat.com> | 2022-05-19 13:20:17 +0100 |
---|---|---|
committer | Andrew Burgess <aburgess@redhat.com> | 2022-07-21 15:19:42 +0100 |
commit | 08106042d9f5fdff60c129bf33190639f1a98b2a (patch) | |
tree | 4921381e92dc6ef37a41a82b82c989f532f435cf /gdb/i386-tdep.c | |
parent | 602707187fa54572a0addd5049d135f20a5b592b (diff) | |
download | fsf-binutils-gdb-08106042d9f5fdff60c129bf33190639f1a98b2a.zip fsf-binutils-gdb-08106042d9f5fdff60c129bf33190639f1a98b2a.tar.gz fsf-binutils-gdb-08106042d9f5fdff60c129bf33190639f1a98b2a.tar.bz2 |
gdb: move the type cast into gdbarch_tdep
I built GDB for all targets on a x86-64/GNU-Linux system, and
then (accidentally) passed GDB a RISC-V binary, and asked GDB to "run"
the binary on the native target. I got this error:
(gdb) show architecture
The target architecture is set to "auto" (currently "i386").
(gdb) file /tmp/hello.rv32.exe
Reading symbols from /tmp/hello.rv32.exe...
(gdb) show architecture
The target architecture is set to "auto" (currently "riscv:rv32").
(gdb) run
Starting program: /tmp/hello.rv32.exe
../../src/gdb/i387-tdep.c:596: internal-error: i387_supply_fxsave: Assertion `tdep->st0_regnum >= I386_ST0_REGNUM' failed.
What's going on here is this; initially the architecture is i386, this
is based on the default architecture, which is set based on the native
target. After loading the RISC-V executable the architecture of the
current inferior is updated based on the architecture of the
executable.
When we "run", GDB does a fork & exec, with the inferior being
controlled through ptrace. GDB sees an initial stop from the inferior
as soon as the inferior comes to life. In response to this stop GDB
ends up calling save_stop_reason (linux-nat.c), which ends up trying
to read register from the inferior, to do this we end up calling
target_ops::fetch_registers, which, for the x86-64 native target,
calls amd64_linux_nat_target::fetch_registers.
After this I eventually end up in i387_supply_fxsave, different x86
based targets will end in different functions to fetch registers, but
it doesn't really matter which function we end up in, the problem is
this line, which is repeated in many places:
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (arch);
The problem here is that the ARCH in this line comes from the current
inferior, which, as we discussed above, will be a RISC-V gdbarch, the
tdep field will actually be of type riscv_gdbarch_tdep, not
i386_gdbarch_tdep. After this cast we are relying on undefined
behaviour, in my case I happen to trigger an assert, but this might
not always be the case.
The thing I tried that exposed this problem was of course, trying to
start an executable of the wrong architecture on a native target. I
don't think that the correct solution for this problem is to detect,
at the point of cast, that the gdbarch_tdep object is of the wrong
type, but, I did wonder, is there a way that we could protect
ourselves from incorrectly casting the gdbarch_tdep object?
I think that there is something we can do here, and this commit is the
first step in that direction, though no actual check is added by this
commit.
This commit can be split into two parts:
(1) In gdbarch.h and arch-utils.c. In these files I have modified
gdbarch_tdep (the function) so that it now takes a template argument,
like this:
template<typename TDepType>
static inline TDepType *
gdbarch_tdep (struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep_1 (gdbarch);
return static_cast<TDepType *> (tdep);
}
After this change we are no better protected, but the cast is now
done within the gdbarch_tdep function rather than at the call sites,
this leads to the second, much larger change in this commit,
(2) Everywhere gdbarch_tdep is called, we make changes like this:
- i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (arch);
+ i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (arch);
There should be no functional change after this commit.
In the next commit I will build on this change to add an assertion in
gdbarch_tdep that checks we are casting to the correct type.
Diffstat (limited to 'gdb/i386-tdep.c')
-rw-r--r-- | gdb/i386-tdep.c | 98 |
1 files changed, 49 insertions, 49 deletions
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index 8501e12..d500f69 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -169,7 +169,7 @@ const int num_lower_zmm_regs = 16; static int i386_mmx_regnum_p (struct gdbarch *gdbarch, int regnum) { - i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch); + i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch); int mm0_regnum = tdep->mm0_regnum; if (mm0_regnum < 0) @@ -184,7 +184,7 @@ i386_mmx_regnum_p (struct gdbarch *gdbarch, int regnum) int i386_byte_regnum_p (struct gdbarch *gdbarch, int regnum) { - i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch); + i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch); regnum -= tdep->al_regnum; return regnum >= 0 && regnum < tdep->num_byte_regs; @@ -195,7 +195,7 @@ i386_byte_regnum_p (struct gdbarch *gdbarch, int regnum) int i386_word_regnum_p (struct gdbarch *gdbarch, int regnum) { - i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch); + i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch); regnum -= tdep->ax_regnum; return regnum >= 0 && regnum < tdep->num_word_regs; @@ -206,7 +206,7 @@ i386_word_regnum_p (struct gdbarch *gdbarch, int regnum) int i386_dword_regnum_p (struct gdbarch *gdbarch, int regnum) { - i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch); + i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch); int eax_regnum = tdep->eax_regnum; if (eax_regnum < 0) @@ -221,7 +221,7 @@ i386_dword_regnum_p (struct gdbarch *gdbarch, int regnum) int i386_zmmh_regnum_p (struct gdbarch *gdbarch, int regnum) { - i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch); + i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch); int zmm0h_regnum = tdep->zmm0h_regnum; if (zmm0h_regnum < 0) @@ -234,7 +234,7 @@ i386_zmmh_regnum_p (struct gdbarch *gdbarch, int regnum) int i386_zmm_regnum_p (struct gdbarch *gdbarch, int regnum) { - i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch); + i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch); int zmm0_regnum = tdep->zmm0_regnum; if (zmm0_regnum < 0) @@ -247,7 +247,7 @@ i386_zmm_regnum_p (struct gdbarch *gdbarch, int regnum) int i386_k_regnum_p (struct gdbarch *gdbarch, int regnum) { - i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch); + i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch); int k0_regnum = tdep->k0_regnum; if (k0_regnum < 0) @@ -260,7 +260,7 @@ i386_k_regnum_p (struct gdbarch *gdbarch, int regnum) static int i386_ymmh_regnum_p (struct gdbarch *gdbarch, int regnum) { - i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch); + i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch); int ymm0h_regnum = tdep->ymm0h_regnum; if (ymm0h_regnum < 0) @@ -275,7 +275,7 @@ i386_ymmh_regnum_p (struct gdbarch *gdbarch, int regnum) int i386_ymm_regnum_p (struct gdbarch *gdbarch, int regnum) { - i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch); + i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch); int ymm0_regnum = tdep->ymm0_regnum; if (ymm0_regnum < 0) @@ -288,7 +288,7 @@ i386_ymm_regnum_p (struct gdbarch *gdbarch, int regnum) static int i386_ymmh_avx512_regnum_p (struct gdbarch *gdbarch, int regnum) { - i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch); + i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch); int ymm16h_regnum = tdep->ymm16h_regnum; if (ymm16h_regnum < 0) @@ -301,7 +301,7 @@ i386_ymmh_avx512_regnum_p (struct gdbarch *gdbarch, int regnum) int i386_ymm_avx512_regnum_p (struct gdbarch *gdbarch, int regnum) { - i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch); + i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch); int ymm16_regnum = tdep->ymm16_regnum; if (ymm16_regnum < 0) @@ -316,7 +316,7 @@ i386_ymm_avx512_regnum_p (struct gdbarch *gdbarch, int regnum) int i386_bnd_regnum_p (struct gdbarch *gdbarch, int regnum) { - i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch); + i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch); int bnd0_regnum = tdep->bnd0_regnum; if (bnd0_regnum < 0) @@ -331,7 +331,7 @@ i386_bnd_regnum_p (struct gdbarch *gdbarch, int regnum) int i386_xmm_regnum_p (struct gdbarch *gdbarch, int regnum) { - i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch); + i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch); int num_xmm_regs = I387_NUM_XMM_REGS (tdep); if (num_xmm_regs == 0) @@ -346,7 +346,7 @@ i386_xmm_regnum_p (struct gdbarch *gdbarch, int regnum) int i386_xmm_avx512_regnum_p (struct gdbarch *gdbarch, int regnum) { - i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch); + i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch); int num_xmm_avx512_regs = I387_NUM_XMM_AVX512_REGS (tdep); if (num_xmm_avx512_regs == 0) @@ -359,7 +359,7 @@ i386_xmm_avx512_regnum_p (struct gdbarch *gdbarch, int regnum) static int i386_mxcsr_regnum_p (struct gdbarch *gdbarch, int regnum) { - i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch); + i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch); if (I387_NUM_XMM_REGS (tdep) == 0) return 0; @@ -372,7 +372,7 @@ i386_mxcsr_regnum_p (struct gdbarch *gdbarch, int regnum) int i386_fp_regnum_p (struct gdbarch *gdbarch, int regnum) { - i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch); + i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch); if (I387_ST0_REGNUM (tdep) < 0) return 0; @@ -384,7 +384,7 @@ i386_fp_regnum_p (struct gdbarch *gdbarch, int regnum) int i386_fpc_regnum_p (struct gdbarch *gdbarch, int regnum) { - i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch); + i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch); if (I387_ST0_REGNUM (tdep) < 0) return 0; @@ -398,7 +398,7 @@ i386_fpc_regnum_p (struct gdbarch *gdbarch, int regnum) static int i386_bndr_regnum_p (struct gdbarch *gdbarch, int regnum) { - i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch); + i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch); if (I387_BND0R_REGNUM (tdep) < 0) return 0; @@ -412,7 +412,7 @@ i386_bndr_regnum_p (struct gdbarch *gdbarch, int regnum) static int i386_mpx_ctrl_regnum_p (struct gdbarch *gdbarch, int regnum) { - i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch); + i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch); if (I387_BNDCFGU_REGNUM (tdep) < 0) return 0; @@ -426,7 +426,7 @@ i386_mpx_ctrl_regnum_p (struct gdbarch *gdbarch, int regnum) bool i386_pkru_regnum_p (struct gdbarch *gdbarch, int regnum) { - i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch); + i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch); int pkru_regnum = tdep->pkru_regnum; if (pkru_regnum < 0) @@ -462,7 +462,7 @@ i386_register_name (struct gdbarch *gdbarch, int regnum) const char * i386_pseudo_register_name (struct gdbarch *gdbarch, int regnum) { - i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch); + i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch); if (i386_bnd_regnum_p (gdbarch, regnum)) return i386_bnd_names[regnum - tdep->bnd0_regnum]; if (i386_mmx_regnum_p (gdbarch, regnum)) @@ -485,7 +485,7 @@ i386_pseudo_register_name (struct gdbarch *gdbarch, int regnum) static int i386_dbx_reg_to_regnum (struct gdbarch *gdbarch, int reg) { - i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch); + i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch); /* This implements what GCC calls the "default" register map (dbx_register_map[]). */ @@ -532,7 +532,7 @@ i386_dbx_reg_to_regnum (struct gdbarch *gdbarch, int reg) static int i386_svr4_dwarf_reg_to_regnum (struct gdbarch *gdbarch, int reg) { - i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch); + i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch); /* This implements the GCC register map that tries to be compatible with the SVR4 C compiler for DWARF (svr4_dbx_register_map[]). */ @@ -2434,7 +2434,7 @@ static struct i386_frame_cache * i386_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache) { struct gdbarch *gdbarch = get_frame_arch (this_frame); - i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch); + i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch); enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); struct i386_frame_cache *cache; CORE_ADDR addr; @@ -2524,7 +2524,7 @@ i386_sigtramp_frame_sniffer (const struct frame_unwind *self, void **this_prologue_cache) { gdbarch *arch = get_frame_arch (this_frame); - i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (arch); + i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (arch); /* We shouldn't even bother if we don't have a sigcontext_addr handler. */ @@ -2611,7 +2611,7 @@ i386_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc) CORE_ADDR sp, jb_addr; struct gdbarch *gdbarch = get_frame_arch (frame); enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); - i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch); + i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch); int jb_pc_offset = tdep->jb_pc_offset; /* If JB_PC_OFFSET is -1, we have no way to find out where the @@ -2860,7 +2860,7 @@ static void i386_extract_return_value (struct gdbarch *gdbarch, struct type *type, struct regcache *regcache, gdb_byte *valbuf) { - i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch); + i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch); int len = TYPE_LENGTH (type); gdb_byte buf[I386_MAX_REGISTER_SIZE]; @@ -2918,7 +2918,7 @@ static void i386_store_return_value (struct gdbarch *gdbarch, struct type *type, struct regcache *regcache, const gdb_byte *valbuf) { - i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch); + i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch); int len = TYPE_LENGTH (type); if (type->code () == TYPE_CODE_FLT) @@ -2997,7 +2997,7 @@ static const char *struct_convention = default_struct_convention; static int i386_reg_struct_return_p (struct gdbarch *gdbarch, struct type *type) { - i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch); + i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch); enum type_code code = type->code (); int len = TYPE_LENGTH (type); @@ -3099,7 +3099,7 @@ i386_return_value (struct gdbarch *gdbarch, struct value *function, struct type * i387_ext_type (struct gdbarch *gdbarch) { - i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch); + i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch); if (!tdep->i387_ext_type) { @@ -3117,7 +3117,7 @@ i387_ext_type (struct gdbarch *gdbarch) static struct type * i386_bnd_type (struct gdbarch *gdbarch) { - i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch); + i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch); if (!tdep->i386_bnd_type) @@ -3153,7 +3153,7 @@ i386_bnd_type (struct gdbarch *gdbarch) static struct type * i386_zmm_type (struct gdbarch *gdbarch) { - i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch); + i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch); if (!tdep->i386_zmm_type) { @@ -3212,7 +3212,7 @@ i386_zmm_type (struct gdbarch *gdbarch) static struct type * i386_ymm_type (struct gdbarch *gdbarch) { - i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch); + i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch); if (!tdep->i386_ymm_type) { @@ -3269,7 +3269,7 @@ i386_ymm_type (struct gdbarch *gdbarch) static struct type * i386_mmx_type (struct gdbarch *gdbarch) { - i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch); + i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch); if (!tdep->i386_mmx_type) { @@ -3346,7 +3346,7 @@ static int i386_mmx_regnum_to_fp_regnum (readable_regcache *regcache, int regnum) { gdbarch *arch = regcache->arch (); - i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (arch); + i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (arch); int mmxreg, fpreg; ULONGEST fstat; int tos; @@ -3387,7 +3387,7 @@ i386_pseudo_register_read_into_value (struct gdbarch *gdbarch, } else { - i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch); + i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch); if (i386_bnd_regnum_p (gdbarch, regnum)) { regnum -= tdep->bnd0_regnum; @@ -3577,7 +3577,7 @@ i386_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, } else { - i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch); + i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch); if (i386_bnd_regnum_p (gdbarch, regnum)) { @@ -3685,7 +3685,7 @@ int i386_ax_pseudo_register_collect (struct gdbarch *gdbarch, struct agent_expr *ax, int regnum) { - i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch); + i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch); if (i386_mmx_regnum_p (gdbarch, regnum)) { @@ -3902,7 +3902,7 @@ i386_supply_gregset (const struct regset *regset, struct regcache *regcache, int regnum, const void *gregs, size_t len) { struct gdbarch *gdbarch = regcache->arch (); - const i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch); + const i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch); const gdb_byte *regs = (const gdb_byte *) gregs; int i; @@ -3927,7 +3927,7 @@ i386_collect_gregset (const struct regset *regset, int regnum, void *gregs, size_t len) { struct gdbarch *gdbarch = regcache->arch (); - const i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch); + const i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch); gdb_byte *regs = (gdb_byte *) gregs; int i; @@ -3950,7 +3950,7 @@ i386_supply_fpregset (const struct regset *regset, struct regcache *regcache, int regnum, const void *fpregs, size_t len) { struct gdbarch *gdbarch = regcache->arch (); - const i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch); + const i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch); if (len == I387_SIZEOF_FXSAVE) { @@ -3973,7 +3973,7 @@ i386_collect_fpregset (const struct regset *regset, int regnum, void *fpregs, size_t len) { struct gdbarch *gdbarch = regcache->arch (); - const i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch); + const i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch); if (len == I387_SIZEOF_FXSAVE) { @@ -4005,7 +4005,7 @@ i386_iterate_over_regset_sections (struct gdbarch *gdbarch, void *cb_data, const struct regcache *regcache) { - i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch); + i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch); cb (".reg", tdep->sizeof_gregset, tdep->sizeof_gregset, &i386_gregset, NULL, cb_data); @@ -4510,7 +4510,7 @@ i386_elf_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) void i386_svr4_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) { - i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch); + i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch); /* System V Release 4 uses ELF. */ i386_elf_init_abi (info, gdbarch); @@ -4552,7 +4552,7 @@ int i386_register_reggroup_p (struct gdbarch *gdbarch, int regnum, const struct reggroup *group) { - const i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch); + const i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch); int fp_regnum_p, mmx_regnum_p, xmm_regnum_p, mxcsr_regnum_p, ymm_regnum_p, ymmh_regnum_p, ymm_avx512_regnum_p, ymmh_avx512_regnum_p, bndr_regnum_p, bnd_regnum_p, zmm_regnum_p, zmmh_regnum_p, @@ -4997,7 +4997,7 @@ static int i386_record_floats (struct gdbarch *gdbarch, struct i386_record_s *ir, uint32_t iregnum) { - i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch); + i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch); int i; /* Oza: Because of floating point insn push/pop of fpu stack is going to @@ -5068,7 +5068,7 @@ i386_process_record (struct gdbarch *gdbarch, struct regcache *regcache, ULONGEST addr; gdb_byte buf[I386_MAX_REGISTER_SIZE]; struct i386_record_s ir; - i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch); + i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch); uint8_t rex_w = -1; uint8_t rex_r = 0; @@ -8839,7 +8839,7 @@ i386_mpx_bd_base (void) rcache = get_current_regcache (); gdbarch *arch = rcache->arch (); - i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (arch); + i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (arch); regstatus = regcache_raw_read_unsigned (rcache, tdep->bndcfgu_regnum, &ret); @@ -8853,7 +8853,7 @@ int i386_mpx_enabled (void) { gdbarch *arch = get_current_arch (); - i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (arch); + i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (arch); const struct target_desc *tdesc = tdep->tdesc; return (tdesc_find_feature (tdesc, "org.gnu.gdb.i386.mpx") != NULL); |