Created attachment 152824 [details] gdb_port_xsave.patch This patch to the port adds support for XSAVE on amd64 and i386 using the recently added PTRACE_GET/SETXSTATE in HEAD. (I will soon merge those changes to stable/10 as well.) It also adds kern.proc.sigtramp usage on i386 fixing unwinding across signal frames for i386 binaries after the shared page signal code changes. As part of the XSAVE changes it also fixes the amd64 FreeBSD ABI to return an i386 target description when debugging a 32-bit process. This allows XSAVE debugging to work for an i386 binary on amd64 (though threads cannot be debugged still). The threads patches have been reworked to pull threads-related patches out of the main port patches and into a single patch that is applied when the THREAD option is enabled. In part this is to make it easier to update the port in the hopeful case that other patches (like the signal trampoline fixes and XSAVE) can be upstreamed. One additional change to the threads patches to allow them to work with XSAVE is that the fbsd-threads target no longer uses ptrace to fetch registers for LWPs directly. Instead, the x86 nat.c files are updated to pass the lwp id to ptrace if the inferior has an lwp id instead of always passing the PIDs. This means that for LWP-backed threads, the fbsd-threads target now passes all register requests down to the native method. The supply/collect regset stubs are now only needed to support userland threads for libkse.
(Not sure why the auto-assign didn't kick in here)
Submitter is committer, re-assign.
Comment on attachment 152824 [details] gdb_port_xsave.patch Patch pending approval
I will also bump PORTREVISION before committing, just didn't include that in case there was a race with another patch.
I tested the patch and it works correctly in several scenario. please, commit it bumping PORTREVISION. thanks
A commit references this bug: Author: jhb Date: Wed Feb 18 19:24:17 UTC 2015 New revision: 379311 URL: https://svnweb.freebsd.org/changeset/ports/379311 Log: - Add support for XSAVE on amd64 and i386 using the recently added PT_GETXSTATE_INFO and XSTATE core dump sections. - Use kern.proc.sigtramp on i386 to fix unwinding across signal frames. - Change the amd64 FreeBSD ABI to return an i386 target description when debugging a 32-bit process. This allows XSAVE debugging to work for an i386 binary on amd64. - Rework thread patches to pull all threads-related patches out of the main port patches and into a single optional patch. - Adjust the thread patches so that fbsd-threads.c passes register requests for LWPs down to the native target instead of calling ptrace directly. This allows XSAVE to work with threads without any other changes. The x86 nat.c files now pass LWP IDs to ptrace register operations (other platforms already did this). The supply/collect regset stubs are now only needed to support userland threads for libkse. PR: 197501 Approved by: maintainer, bdrewery Changes: head/devel/gdb/Makefile head/devel/gdb/files/extrapatch-gdb-Makefile.in head/devel/gdb/files/extrapatch-gdb-configure.tgt head/devel/gdb/files/extrapatch-threads head/devel/gdb/files/fbsd-threads.c head/devel/gdb/files/patch-gdb-amd64fbsd-nat.c head/devel/gdb/files/patch-gdb-amd64fbsd-tdep.c head/devel/gdb/files/patch-gdb-i386bsd-nat.c head/devel/gdb/files/patch-gdb-i386bsd-nat.h head/devel/gdb/files/patch-gdb-i386fbsd-nat.c head/devel/gdb/files/patch-gdb-i386fbsd-tdep.c head/devel/gdb/files/patch-xsave