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

Andrew Burgess
2020-06-09T22:47:26Z

* Jim Wilson <jimw@sifive.com> [2020-06-09 13:14:58 -0700]:

> On Tue, Jun 9, 2020 at 10:30 AM Andrew Burgess
> <andrew.burgess@embecosm.com> wrote:
> > Looking then at the final PRIV_SPEC_CLASS_* field for each alias then
> > we can see that currently we only want to take the alias from
> > PRIV_SPEC_CLASS_1P11. For now then this is what I'm using to filter
> > the aliases within GDB.
>
> This will do the right thing, but looks a little funny. It isn't
> quite the right way to express what we want. I do think it is OK for
> now, but we will have to be careful when maintaining binutils that we
> don't break this assumption, or remember to update it when necessary.

I agree. I certainly open to any other ideas.

Without making changes to the DECLARE_CSR_ALIAS macro (and I don't
know what changes I would make) I saw my options as either:

- Ignore DECLARE_CSR_ALIAS, and hard code the "approved" aliases into
GDB. Then it'll never break, we just need to remember to update
the hard coded list when riscv-opc.h changes, or

- Filter the alias list from riscv-opc.h.

I went with the second option, partly because, if, from now on RISC-V
doesn't reuse old CSR offsets for new CSRs, then any new aliases
should be compatible.... I hope.

Anyway, always happy to take suggestions.

Thanks,
Andrew