public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "vapier at gentoo dot org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug sim/29869] sim: align sim register numbers with gdb register numbers
Date: Fri, 29 Dec 2023 04:46:49 +0000	[thread overview]
Message-ID: <bug-29869-4717-EYAj1Pq2LM@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-29869-4717@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=29869

--- Comment #6 from Mike Frysinger <vapier at gentoo dot org> ---
(In reply to Tom Tromey from comment #5)
> I don't really understand why this info isn't in the cgen model
> either, but it doesn't seem to be.

i don't think it makes sense for cgen to know about this.  what we're talking
about here is a communication protocol for serializing & deserializing state,
and GDB defines that protocol.

> Anyway I suspect a new field in _sim_cpu may be the way to go...

while converting the sim to RSP completely is a pretty heavy lift, i think we
have some incremental steps we could consider

* have gdb maintain the lists, and automatically convert/generate/export them
to sim in the source tree.  if there are XML files, use those.  if there are
enums in header files, use those.  we already do this sort of thing with newlib
via sim/common/gennltvals.py, and we commit the result (rather than gen at
build time via portable shell/etc...).  i think we have/want to do this
regardless.
* add a parallel set of sim_{store,fetch}_register APIs that used the same
encoding as RSP.

> Though looking at this, we also don't know the size of registers.
> gdb does, but it doesn't inform the remote of this -- the remote
> is expected to know.

when it comes to the sim APIs, gdb calls the sim with the size. 
sim_fetch_register & sim_store_register both have a "length", and the sim
basically treats it as "it has to match the register size requested via regno".

sim_fetch_register also is designed such that passing in length=0 will return
the size of the requested register without writing to the buffer.  so callers
could cheaply probe the size of all registers.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2023-12-29  4:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-10 12:23 [Bug sim/29869] New: " vapier at gentoo dot org
2023-12-23 19:47 ` [Bug sim/29869] " tromey at sourceware dot org
2023-12-24  0:45 ` vapier at gentoo dot org
2023-12-24 20:11 ` tromey at sourceware dot org
2023-12-25  1:52 ` vapier at gentoo dot org
2023-12-29  1:35 ` tromey at sourceware dot org
2023-12-29  4:46 ` vapier at gentoo dot org [this message]
2023-12-31 22:44 ` tromey at sourceware dot org

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=bug-29869-4717-EYAj1Pq2LM@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /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).