Re: [RFC] gdb/riscv: Improved register alias name creation

Andrew Burgess
2020-06-11T08:28:43Z

* Jim Wilson <jimw@sifive.com> [2020-06-10 13:37:03 -0700]:

> On Tue, Jun 9, 2020 at 3:31 PM Andrew Burgess
> <andrew.burgess@embecosm.com> wrote:
> > > (gdb) call debug.trace (me, "You")
> > > Could not fetch register "mucounteren"; remote failure reply 'E14'
> >
> > That is so weird! Based on the dump you included in the other email I
> > would have expected that to work.
>
> Bu mucounteren is one of the registers that we chose not to make an
> alias for because of the compatibility break. Apparently we will have
> to make an alias for it anyways because qemu 4.0 wants it.

No.

QEMU provides a register list that _includes_ mucounteren so GDB
doesn't need to know anything about this register or its aliases. The
XML built into GDB is used only for targets that don't provide a
target description. If a target provides a description, as in this
case, then the builtin description is not touched.
> And
> someone should fix qemu to use the right register list depending on
> the priv spec version.

Yes, this. Change the register description that QEMU sends based on
the machine its emulating and then GDB will "just work". GDB doesn't
need to know about privilege specs at all[1].

Thanks,
Andrew

[1] Native debugging is a slightly different case, but lets leave that
discussion for another day.