Re: [PATCH v2 4/6] Use remote register numbers in tracepoint mask

Ulrich Weigand
2018-08-02T16:58:42Z

Pedro Franco de Carvalho wrote:

> Currently, tracepoint register masks in the QTDP packets include both
> internal and remote register numbers, as well as pseudo-register
> numbers.

Yes, this looks like a bug to me.

> Register numbers from agent expressions are already set in the mask
> using remote numbers. Other tracepoint actions used internal numbers,
> e.g. "collect $regs" or "collect $<pseudoreg>". To handle pseudoreg
> numbers, an empty agent expression is created and ax_reg_mask is
> called for this expression and the pseudoreg. This will cause the ax
> to set its mask with the corresponding remote raw register
> numbers (using gdbarch_ax_pseudo_register_collect).
>
> This assumes that all gdbarch_ax_pseudo_register_collect
> implementations only use ax_reg_mask themselves to set the mask, and
> don't generate more complicated agent expressions to collect
> pseudoregs. This seems to be the case, and seems to be the intended
> use of gdbarch_ax_pseudo_register_collect, despite the gdbarch.h
> comment for this function.

It would be good to update that comment then, if this behavior
is now an actual requirement.

The alternative I guess would be to have collect_symbol fall back to
the "treat_as_expr" case for collecting pseudo registers; and then
possibly implementing as optimization a check whether the agent
expression is actually empty except for the register mask ...
Something similar would then also have to be done in encode_actions_1.

Do you think this would be doable?

Bye,
Ulrich

--
Dr. Ulrich Weigand
GNU/Linux compilers and toolchain
Ulrich.Weigand@de.ibm.com