[PATCH v2 3/3] RISC-V: Support new CSR macro DECLARE_CSR_REUSE to handle the reused CSR.

Jim Wilson jimw@sifive.com
Tue Jun 30 21:54:57 GMT 2020


On Mon, Jun 29, 2020 at 7:55 PM Nelson Chu <nelson.chu@sifive.com> wrote:
> On Tue, Jun 30, 2020 at 7:52 AM Jim Wilson <jimw@sifive.com> wrote:
> > On Wed, Jun 24, 2020 at 8:38 PM Nelson Chu <nelson.chu@sifive.com> wrote:
> > > gdb only handles the CSR which are defined by DECLARE_CSR, and the aliases CSR
> > > which are defined by DECLARE_CSR_ALIAS.  Supporting the reused CSR in gdb is not
> > > good enough and may cause problems so far, so just skip the DECLARE_CSR_REUSE.
> >
> > I think this breaks gdb/qemu interaction.  qemu will send an xml file
> > that mentions mucounteren, and gdb will error because it doesn't know
> > what the mucounteren register is anymore.  You have to update gdb to
> > handle DECLARE_CSR_REUSE same as DECLARE_CSR_ALIAS.  Once they are
> > handled the same, it isn't clear why we need both of them, unless you
> > plan to handle them differently in the future.
>
> I notice the current gdb just creates aliases if their aborted version
> is newer than v1.11.  Therefore, the following CSR are unknown for gdb
> if qemu send an xml file that mentions them,

I had to look at the gdb sources again.  I see the unknown_csrs stuff,
so I was wrong about how this works.  The patch is OK.

FYI The gdb folks are planning to create a release branch next weekend
I think, so now would be a bad time to accidentally break gdb.  But
this patch looks OK.

Jim


More information about the Binutils mailing list