Re: [PATCH 3/4] Enable tracing of pseudo-registers on ARM

Yao Qi
2016-02-12T15:14:10Z

Antoine Tremblay <antoine.tremblay@ericsson.com> writes:

> +/* Map the pseudo register number REG to the proper register number. */
> +
> +static int
> +arm_pseudo_register_to_register (struct gdbarch *gdbarch, int reg)
> +{
> + int rawnum = 0;
> + int num_regs = gdbarch_num_regs (gdbarch);
> +
> + /* Single precision pseudo registers. s0-s31. */
> + if (reg >= num_regs && reg < num_regs + 32)
> + {
> + rawnum = (reg - num_regs) / 2 + 26;

We should get double register number via user_reg_map_name_to_regnum,

xsnprintf (name_buf, sizeof (name_buf), "d%d", (reg - num_regs) / 2);
double_regnum = user_reg_map_name_to_regnum (gdbarch, name_buf,
strlen (name_buf));

> + }
> + /* Quadruple precision pseudo regisers. q0-q15. */
> + else if (reg >= num_regs + 32 && reg < num_regs + 32 + 16)
> + {
> + rawnum = (reg - num_regs - 32) * 2 + 26;

Likewise,

xsnprintf (name_buf, sizeof (name_buf), "d%d", (reg - num_regs) * 2);
double_regnum = user_reg_map_name_to_regnum (gdbarch, name_buf,
strlen (name_buf));

additionally, we need to check gdbarch_tdep (gdbarch)->have_neon_pseudos,

> + }
> + /* Error bad register number. */
> + else
> + return -1;
> +
> + return rawnum;
> +}

We also need a test case, and you can extend gdb.trace/tfile-avx.exp.
Probably, it can be renamed to gdb.trace/tracefile-pseudo-reg.exp, and
put x86 and arm tests in it.

--
Yao (齐尧)