aboutsummaryrefslogtreecommitdiff
path: root/gdb/i386-linux-nat.c
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2023-08-28 14:18:19 -0700
committerJohn Baldwin <jhb@FreeBSD.org>2023-08-28 14:18:19 -0700
commit9848bf83750ba897090320137221977584405e06 (patch)
treeadbfd12b2c6f477c31549718500a2819f8c6fed3 /gdb/i386-linux-nat.c
parentb42405a159450004f2e2497e2b2d81bcac85c947 (diff)
downloadgdb-9848bf83750ba897090320137221977584405e06.zip
gdb-9848bf83750ba897090320137221977584405e06.tar.gz
gdb-9848bf83750ba897090320137221977584405e06.tar.bz2
gdb: Support XSAVE layouts for the current host in the Linux x86 targets.
Note that this uses the CPUID instruction to determine the total size of the XSAVE register set. If there is a way to fetch the register set size using ptrace that would probably be better. Approved-By: Simon Marchi <simon.marchi@efficios.com>
Diffstat (limited to 'gdb/i386-linux-nat.c')
-rw-r--r--gdb/i386-linux-nat.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c
index a524fdc..7e0572e 100644
--- a/gdb/i386-linux-nat.c
+++ b/gdb/i386-linux-nat.c
@@ -330,7 +330,9 @@ store_fpregs (const struct regcache *regcache, int tid, int regno)
static int
fetch_xstateregs (struct regcache *regcache, int tid)
{
- char xstateregs[X86_XSTATE_MAX_SIZE];
+ struct gdbarch *gdbarch = regcache->arch ();
+ const i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
+ char xstateregs[tdep->xsave_layout.sizeof_xsave];
struct iovec iov;
if (have_ptrace_getregset != TRIBOOL_TRUE)
@@ -353,7 +355,9 @@ fetch_xstateregs (struct regcache *regcache, int tid)
static int
store_xstateregs (const struct regcache *regcache, int tid, int regno)
{
- char xstateregs[X86_XSTATE_MAX_SIZE];
+ struct gdbarch *gdbarch = regcache->arch ();
+ const i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
+ char xstateregs[tdep->xsave_layout.sizeof_xsave];
struct iovec iov;
if (have_ptrace_getregset != TRIBOOL_TRUE)