arm: remote GDB: rationalize structure of register offsets
authorBoris Shingarov <shingarov@labware.com>
Fri, 18 Dec 2015 21:12:07 +0000 (15:12 -0600)
committerBoris Shingarov <shingarov@labware.com>
Fri, 18 Dec 2015 21:12:07 +0000 (15:12 -0600)
commitd765dbf22cb3242c055b19b797b0f4cb39a43aae
tree55fade43c664a78e55823cdc43f7bcec1bf663a9
parentb5a54eb64ebce9c217c1d44cc93aebb7cb508c6d
arm: remote GDB: rationalize structure of register offsets

Currently, the wire format of register values in g- and G-packets is
modelled using a union of uint8/16/32/64 arrays.  The offset positions
of each register are expressed as a "register count" scaled according
to the width of the register in question.  This results in counter-
intuitive and error-prone "register count arithmetic", and some
formats would even be altogether unrepresentable in such model, e.g.
a 64-bit register following a 32-bit one would have a fractional index
in the regs64 array.
Another difficulty is that the array is allocated before the actual
architecture of the workload is known (and therefore before the correct
size for the array can be calculated).

With this patch I propose a simpler mechanism for expressing the
register set structure.  In the new code, GdbRegCache is an abstract
class; its subclasses contain straightforward structs reflecting the
register representation.  The determination whether to use e.g. the
AArch32 vs. AArch64 register set (or SPARCv8 vs SPARCv9, etc.) is made
by polymorphically dispatching getregs() to the concrete subclass.
The subclass is not instantiated until it is needed for actual
g-/G-packet processing, when the mode is already known.

This patch is not meant to be merged in on its own, because it changes
the contract between src/base/remote_gdb.* and src/arch/*/remote_gdb.*,
so as it stands right now, it would break the other architectures.
In this patch only the base and the ARM code are provided for review;
once we agree on the structure, I will provide src/arch/*/remote_gdb.*
for the other architectures; those patches could then be merged in
together.

Review Request: http://reviews.gem5.org/r/3207/
Pushed by Joel Hestness <jthestness@gmail.com>
15 files changed:
src/arch/alpha/kgdb.h [deleted file]
src/arch/alpha/remote_gdb.cc
src/arch/alpha/remote_gdb.hh
src/arch/arm/remote_gdb.cc
src/arch/arm/remote_gdb.hh
src/arch/mips/remote_gdb.cc
src/arch/mips/remote_gdb.hh
src/arch/power/remote_gdb.cc
src/arch/power/remote_gdb.hh
src/arch/sparc/remote_gdb.cc
src/arch/sparc/remote_gdb.hh
src/arch/x86/remote_gdb.cc
src/arch/x86/remote_gdb.hh
src/base/remote_gdb.cc
src/base/remote_gdb.hh