The amd64 signal trampoline describes saved flags, segment selectors,
and FS/GS bases using DWARF registers above 32. Extend libunwind's
register model through register 59 so backtrace(3) can unwind through
these signal frames.
Capture the extended state within the existing context ABI and use
setcontext(3) on FreeBSD to restore selectors and bases together. Keep
the context pointer in a saved %rbx across base-query syscalls, since
FreeBSD may clear %r8 on syscall return. Restore %rbx on both success
and failure paths.
Strengthen the libexecinfo signal trampoline test to require a known
caller beyond the signal frame instead of relying on main or an
unsigned sentinel that could falsely pass. Add an alternate signal
stack case, verify that the handler ran on the expected stack, and
perform symbol lookup and assertions after the handler returns.
PR: 289096
Reported by: siva
MFC after: 2 weeks
Sponsored by: FreeBSD Foundation