public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug sim/29869] New: sim: align sim register numbers with gdb register numbers
@ 2022-12-10 12:23 vapier at gentoo dot org
  2023-12-23 19:47 ` [Bug sim/29869] " tromey at sourceware dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: vapier at gentoo dot org @ 2022-12-10 12:23 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 29869
           Summary: sim: align sim register numbers with gdb register
                    numbers
           Product: gdb
           Version: unknown
            Status: NEW
          Severity: normal
          Priority: P2
         Component: sim
          Assignee: vapier at gentoo dot org
          Reporter: vapier at gentoo dot org
                CC: vapier at gentoo dot org
  Target Milestone: ---

it would be good if we aligned sim register numbers with gdb's register numbers
(as used in the default remote serial protocol).  this has a number of
benefits:
* if/when we add RSP support to the sim, gdb/debuggers would "just work" with
it
* we can delete the set_gdbarch_register_sim_regno logic from gdb
* we don't need to hand maintain the include/sim/sim-* register lists (as we
can generate them from gdb xml files)

some architectures already have aligned their register numbers, so there's no
diff to them.  for others, this would represent an ABI break.  sim.h provides
sim_fetch_register & sim_store_register APIs, and the sim register numbers are
used with those.  changing the enum/constants obviously requires a recompile. 
i don't think this is a problem because:
* we already need to do ABI breaks to fix 64-bit address handling (current ABI
is limited to 32-bit)
* we'll need to break again to expose multicpu
* libsim is only statically linked into programs (we don't provide a shared lib
yet)
* for the gdb<->sim interface, since the GNU sim is bundled+linked in to gdb,
we don't have to worry about old/new version skews of gdb/sim
* i'm not aware of anyone using the sim reg numbers outside of the GNU sim, and
i don't think gdb even supports that if they tried

while we shouldn't trash the API needlessly, i think atm we have so many
shortcomings that we shouldn't bend over backwards to maintain support.

we could support gdb's Target Description Format where the sim would generate
an XML document on the fly describing its arches/registers/etc... and thus
avoid the register remapping, but i think we should break anyways.  gdb doesn't
require XML support be enabled which means it'll still fallback to classic
hardcoded register numbers.
https://sourceware.org/gdb/onlinedocs/gdb/Target-Description-Format.html#Target-Description-Format

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-12-31 22:44 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-10 12:23 [Bug sim/29869] New: sim: align sim register numbers with gdb register numbers 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
2023-12-31 22:44 ` tromey at sourceware dot org

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).