Re: [RFA/RFC] mips tracepoint: fix Bug 12013

Pedro Alves
2010-12-22T11:27:07Z

On Wednesday 22 December 2010 06:04:28, Kevin Buettner wrote:
> You might consider implementing a new gdbarch method which provides a
> mapping from pseudo register numbers to raw register numbers. The
> trace machinery could use such a mapping to find the corresponding raw
> register(s) when presented with a pseudo register. I can think of
> several potential pitfalls with this approach, but I think the idea is
> worth exploring.

Such mapping will necessarily be a temporary kludge -- if such a mapping
were always possible, then we wouldn't have
gdbarch_pseudo_register_read/gdbarch_pseudo_register_read callbacks, but
we'd instead have a gdbarch_pseudo_register_to_raw_register callback,
or some such.

If you're going to add support for collecting pseudo registers, I'd
much rather you added a "gdbarch_pseudo_register_collect" callback,
that emitted the agent expression bits required to collect whatever
gdbarch_pseudo_register_read needs to "read" the pseudo register
in question at trace buffer inspection time (tfind mode). In the
mips case, you'd end up with only calls to ax_reg in that new
callback, it looks to me.
(Take a look at dwarf2loc.c:compile_dwarf_to_reg and it's ax_reg call,
for example.)

--
Pedro Alves