aboutsummaryrefslogtreecommitdiff
path: root/gdb/x86-fbsd-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
commit24ef2641d917695470fb2d43dabb133e3ee6678f (patch)
treee2c1d0a8672860555ec19964967dfebddb9a090e /gdb/x86-fbsd-nat.c
parent22ca5c10279903a221ba4580afef71af0c639704 (diff)
downloadbinutils-24ef2641d917695470fb2d43dabb133e3ee6678f.zip
binutils-24ef2641d917695470fb2d43dabb133e3ee6678f.tar.gz
binutils-24ef2641d917695470fb2d43dabb133e3ee6678f.tar.bz2
gdb: Support XSAVE layouts for the current host in the FreeBSD x86 targets.
Use the CPUID instruction to fetch the offsets of supported state components. Approved-By: Simon Marchi <simon.marchi@efficios.com>
Diffstat (limited to 'gdb/x86-fbsd-nat.c')
-rw-r--r--gdb/x86-fbsd-nat.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/gdb/x86-fbsd-nat.c b/gdb/x86-fbsd-nat.c
index 5d1c9fc..240e228 100644
--- a/gdb/x86-fbsd-nat.c
+++ b/gdb/x86-fbsd-nat.c
@@ -19,6 +19,9 @@
#include "defs.h"
#include "x86-fbsd-nat.h"
+#ifdef PT_GETXSTATE_INFO
+#include "nat/x86-xstate.h"
+#endif
/* Implement the virtual fbsd_nat_target::low_new_fork method. */
@@ -43,3 +46,21 @@ x86_fbsd_nat_target::low_new_fork (ptid_t parent, pid_t child)
child_state = x86_debug_reg_state (child);
*child_state = *parent_state;
}
+
+#ifdef PT_GETXSTATE_INFO
+void
+x86_fbsd_nat_target::probe_xsave_layout (pid_t pid)
+{
+ if (m_xsave_probed)
+ return;
+
+ m_xsave_probed = true;
+
+ if (ptrace (PT_GETXSTATE_INFO, pid, (PTRACE_TYPE_ARG3) &m_xsave_info,
+ sizeof (m_xsave_info)) != 0)
+ return;
+ if (m_xsave_info.xsave_len != 0)
+ m_xsave_layout = x86_fetch_xsave_layout (m_xsave_info.xsave_mask,
+ m_xsave_info.xsave_len);
+}
+#endif