[PATCH 0/8] Switch FreeBSD x86 to using register maps for GP registers
John Baldwin
jhb@FreeBSD.org
Tue Aug 10 15:56:04 GMT 2021
On 7/14/21 7:07 AM, John Baldwin wrote:
> The x86 architectures in GDB provide existing helpers for parsing
> general-purpose register sets. However, these helpers have some
> limitations, such as assuming that registers are always full size. On
> FreeBSD/amd64 in particular, segment registers are stored as 16-bit
> quantities that in some cases are packed together. GDB for historical
> reasons treats these 16-bit registers as 32 bits in size. Using the
> more generic regcache_map_entry to describe the GP register sets
> permits supporting these registers as 16-bit values. In addition, the
> FreeBSD x86 signal frames have included the base address of the FS and
> GS segments (equivalent to the fs_base and gs_base registers), but the
> existing signal context helpers were written before those registers
> were added to GDB.
>
> Longer term my goal is to use regcache_map_entry-based register sets
> in FreeBSD gdbserver support to simplify the implementation.
>
> Note that patch 4 fixes an issue in regcache_collect_regset where it
> didn't quite do what I thought it did. I believe the change is ok,
> but it definitely warrants review.
Ping. Patch 4 is the only one that isn't FreeBSD-specific.
> I have tested this on both FreeBSD/amd64 (32-bit and 64-bit processes)
> and FreeBSD/i386.
>
> John Baldwin (8):
> Remove vestigal FreeBSD/i386 3.x support.
> Remove support for pre-5.0 FreeBSD/i386 signal trampolines.
> FreeBSD x86: Remove fallback for detecting signal trampolines by
> address.
> regcache: Zero-extend small registers described by a register map.
> Use register maps for gp regsets on FreeBSD/x86 core dumps.
> FreeBSD x86: Use tramp-frame for signal frames.
> fbsd-nat: Return a bool from fetch_register_set and
> store_register_set.
> FreeBSD x86 nat: Use register maps for GP register sets.
>
> gdb/amd64-bsd-nat.c | 96 ---------
> gdb/amd64-fbsd-nat.c | 346 ++++++++++++++++++-------------
> gdb/amd64-fbsd-tdep.c | 279 ++++++++++++++-----------
> gdb/amd64-fbsd-tdep.h | 27 +++
> gdb/amd64-tdep.h | 5 -
> gdb/configure.nat | 4 +-
> gdb/fbsd-nat.c | 8 +-
> gdb/fbsd-nat.h | 21 +-
> gdb/i386-bsd-nat.c | 98 +--------
> gdb/i386-fbsd-nat.c | 255 +++++++++++++++++++----
> gdb/i386-fbsd-tdep.c | 461 ++++++++++++++++++------------------------
> gdb/i386-fbsd-tdep.h | 4 +
> gdb/i386-tdep.h | 4 -
> gdb/regcache.c | 7 +-
> gdb/x86-bsd-nat.c | 4 -
> gdb/x86-bsd-nat.h | 3 -
> 16 files changed, 844 insertions(+), 778 deletions(-)
> create mode 100644 gdb/amd64-fbsd-tdep.h
>
--
John Baldwin
More information about the Gdb-patches
mailing list