Created attachment 152824 [details]
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]
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.
A commit references this bug:
Date: Wed Feb 18 19:24:17 UTC 2015
New revision: 379311
- 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
- 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.
Approved by: maintainer, bdrewery