diff options
author | John Baldwin <jhb@FreeBSD.org> | 2023-08-28 14:18:19 -0700 |
---|---|---|
committer | John Baldwin <jhb@FreeBSD.org> | 2023-08-28 14:18:19 -0700 |
commit | 22ca5c10279903a221ba4580afef71af0c639704 (patch) | |
tree | 1005c17ca099d32b57aa3c844d80041d9bec5e1e /gdb/amd64-fbsd-tdep.c | |
parent | 2e639674c56a35a14ebb33bcfcd9ff614a516735 (diff) | |
download | binutils-22ca5c10279903a221ba4580afef71af0c639704.zip binutils-22ca5c10279903a221ba4580afef71af0c639704.tar.gz binutils-22ca5c10279903a221ba4580afef71af0c639704.tar.bz2 |
gdb: Update x86 FreeBSD architectures to support XSAVE layouts.
Refactor i386fbsd_core_read_xcr0 to fetch and return a corresponding
x86_xsave_layout as well as xcr0 using the size of an existing
NT_X86_XSTATE core dump to determine the offsets via
i387_guess_xsave_layout. Use this to add an implementation of
gdbarch_core_xfer_x86_xsave_layout.
Use tdep->xsave_layout.sizeof_xsave as the size of the XSTATE register
set and only fetch/store the register set if this size is non-zero.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
Diffstat (limited to 'gdb/amd64-fbsd-tdep.c')
-rw-r--r-- | gdb/amd64-fbsd-tdep.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/gdb/amd64-fbsd-tdep.c b/gdb/amd64-fbsd-tdep.c index 0d5ce00..2b633cd 100644 --- a/gdb/amd64-fbsd-tdep.c +++ b/gdb/amd64-fbsd-tdep.c @@ -224,7 +224,12 @@ amd64fbsd_core_read_description (struct gdbarch *gdbarch, struct target_ops *target, bfd *abfd) { - return amd64_target_description (i386fbsd_core_read_xcr0 (abfd), true); + x86_xsave_layout layout; + uint64_t xcr0 = i386_fbsd_core_read_xsave_info (abfd, layout); + if (xcr0 == 0) + xcr0 = X86_XSTATE_SSE_MASK; + + return amd64_target_description (xcr0, true); } /* Similar to amd64_supply_fpregset, but use XSAVE extended state. */ @@ -271,8 +276,10 @@ amd64fbsd_iterate_over_regset_sections (struct gdbarch *gdbarch, cb (".reg-x86-segbases", AMD64_FBSD_SIZEOF_SEGBASES_REGSET, AMD64_FBSD_SIZEOF_SEGBASES_REGSET, &amd64_fbsd_segbases_regset, "segment bases", cb_data); - cb (".reg-xstate", X86_XSTATE_SIZE (tdep->xcr0), X86_XSTATE_SIZE (tdep->xcr0), - &amd64fbsd_xstateregset, "XSAVE extended state", cb_data); + if (tdep->xsave_layout.sizeof_xsave != 0) + cb (".reg-xstate", tdep->xsave_layout.sizeof_xsave, + tdep->xsave_layout.sizeof_xsave, &amd64fbsd_xstateregset, + "XSAVE extended state", cb_data); } /* Implement the get_thread_local_address gdbarch method. */ @@ -313,6 +320,8 @@ amd64fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) tramp_frame_prepend_unwinder (gdbarch, &amd64_fbsd_sigframe); tdep->xsave_xcr0_offset = I386_FBSD_XSAVE_XCR0_OFFSET; + set_gdbarch_core_read_x86_xsave_layout + (gdbarch, i386_fbsd_core_read_x86_xsave_layout); /* Iterate over core file register note sections. */ set_gdbarch_iterate_over_regset_sections |