From: Andrew Burgess <andrew.burgess@embecosm.com>
To: Jim Wilson <jimw@sifive.com>
Cc: Tom Tromey <tom@tromey.com>,
gdb-patches@sourceware.org, Palmer Dabbelt <palmer@sifive.com>,
John Baldwin <jhb@freebsd.org>
Subject: Re: [PATCH] gdb/riscv: Add target description support
Date: Sat, 23 Feb 2019 20:51:00 -0000 [thread overview]
Message-ID: <20190223205116.GB15942@embecosm.com> (raw)
In-Reply-To: <CAFyWVaakRDXRBQyrbBi=aJxxjoNG2NVds02qoYcCbiQeZXdjNQ@mail.gmail.com>
* Jim Wilson <jimw@sifive.com> [2019-02-22 11:24:15 -0800]:
> On Fri, Feb 22, 2019 at 9:42 AM Tom Tromey <tom@tromey.com> wrote:
> > With an older gdb (8.2), with remote debugging enabled:
> >
> > (gdb) p $fflags
> > Sending packet: $p42#d6...Ack
> > Packet received: 0000000000000000
> > $1 = 0
> >...
> > However with a newer gdb, with an older qemu, I get a failure:
> >
> > Sending packet: $p41#d5...Ack
> > Packet received: E14
> > Could not fetch register "fflags"; remote failure reply 'E14'
> >
> > Here you can see gdb is sending 0x41.
>
> The renumbering is unfortunate, but there are a lot of historical
> problems here, and compatibility with old tools may not be worth the
> trouble. We need to make this work right first, before we can worry
> about backward compatibility.
>
> fflags is a CSR not an F register. But gdb is treating it as both an
> F register and a CSR which may lead to some confusion.
I think we should be OK. The existing CSR feature file should
possibly be deleted, it's not actually used right now.
When targets supply a target description then the fflags, frm, and
fcsr should only be in one feature otherwise (I think, but haven't
tested) GDB will get upset. However, I don't think we should prevent
bundling the FP status registers in the FP feature set, personally, I
think that the argument for having them there is almost as strong as
for having them in with the CSRs.
>
> Also, fflags is not a real register. It is an alias for a field
> inside the fcsr register. If gdb is talking to something like
> openocd/qemu that can translate fflags to fcsr that is OK, but for a
> native riscv-linux gdb trying to read fflags won't do anything useful,
> gdb needs to translate fflags into the fcsr field itself or this isn't
> going to work. Though maybe we can do something inside one of the
> riscv-linux files to handle this.
I started working on, and do plan to finish soon(ish) a change where
if GDB finds an $fcsr register, but no $fflags or $frm then a
pseudo-register would be setup (for each) that just reads/writes the
bits for $fcsr.
This would work for all targets, so the native linux case should be
covered.
>
> There are a lot of problems with the old qemu gdbstub support. I have
> a patch set submitted for qemu to add the gdb xml files and proper
> gdbstub support to use them. gdb+qemu works much better with these
> patches. This patch set has been approved, and is queued for commit
> behind one other patch in progress I think. With this patch,
> accessing fflags works with both a system qemu and a user qemu using
> the current development gdb (8.3 pre-release).
That's great news. Thanks for all your effort on this.
Thanks,
Andrew
>
> (gdb) info registers fflags
> fflags Sending packet: $p4c#07...Ack
> Packet received: 0000000000000000
> Packet p (fetch-register) is supported
> 0x0 RD:0 NV:0 DZ:0 OF:0 UF:0 NX:0
> (gdb)
>
> Jim
next prev parent reply other threads:[~2019-02-23 20:51 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-08 16:08 [RFC] " Andrew Burgess
2018-11-08 18:33 ` John Baldwin
2018-11-08 19:32 ` Palmer Dabbelt
2018-11-08 19:41 ` John Baldwin
2018-11-14 14:29 ` Andrew Burgess
2018-11-14 17:42 ` John Baldwin
2018-11-08 21:57 ` Jim Wilson
2018-11-13 15:05 ` Andrew Burgess
2018-11-13 20:08 ` Pedro Alves
2018-11-14 14:58 ` [PATCH] " Andrew Burgess
2018-11-19 3:51 ` Jim Wilson
2018-11-21 11:23 ` Andrew Burgess
2018-11-21 12:37 ` Eli Zaretskii
2018-11-21 13:19 ` Andrew Burgess
2019-02-22 17:42 ` Tom Tromey
2019-02-22 19:24 ` Jim Wilson
2019-02-23 20:51 ` Andrew Burgess [this message]
2019-02-24 6:21 ` Jim Wilson
2019-02-26 5:02 ` Joel Brobecker
2019-02-26 17:26 ` Jim Wilson
2019-02-26 18:22 ` Andrew Burgess
2019-02-26 18:40 ` Jim Wilson
2019-02-26 19:27 ` Jim Wilson
2019-02-26 20:30 ` Andrew Burgess
2019-02-23 20:40 ` Andrew Burgess
2019-02-26 11:55 ` Joel Brobecker
2019-03-04 16:18 ` Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190223205116.GB15942@embecosm.com \
--to=andrew.burgess@embecosm.com \
--cc=gdb-patches@sourceware.org \
--cc=jhb@freebsd.org \
--cc=jimw@sifive.com \
--cc=palmer@sifive.com \
--cc=tom@tromey.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).