Is it possible for NetBSD to implement KERN_PROC_SIGTRAMP sysctl? TLDR; For several years, the GNAT Ada compiler has not been able to unwind a stack containing a signal trampoline. The unwinder I wrote for gcc several years ago just stopped working on newer NetBSD release even though the signal trampoline code itself did not change. FreeBSD and DragonFly BSD are immune to sigtramp location changes because they've introduced the KERN_PROC_SIGTRAMP sysctl which provides the location of the signal tramp of the process. It would be awesome if the NetBSD kernel provided the same functionality, at least on x86.
==== I've recently been a part of an effort to revive the GNAT portion of current GCC releases. We succeeded with GCC 10.3 (in pkgsrc WIP) and GCC 11.2.0 in Ravenports (soon to support NetBSD), but the testsuite indicates it can no longer unwind properly. The previous technique (shown below) no longer works - I suspect the signal trampoline location changed to inaccessible memory somewhere along the line. With a sysctl like KERN_PROC_SIGTRAMP, we should be able to bring GNAT functionality back to the level of FreeBSD and DragonFly. It could also be used in debuggers like GDB and other compilers (Go? Rust?) I believe this sysctl would be useful so I'm hopeful somebody can implement it. History: FreeBSD added the functionality in November 2013. The current location of the code is here: https://github.com/freebsd/freebsd-src/blob/main/sys/kern/kern_proc.c#L3010 DragonFly added the functionality in March 2017. The current location of the code is here: https://github.com/DragonFlyBSD/DragonFlyBSD/blob/master/sys/kern/kern_proc.c#L2120 GCC unwind code that no longer works: https://github.com/jrmarino/draco/blob/netbsd-unwind/v11/libgcc/config/i386/netbsd-unwind.h Example of unwind code with KERN_PROC_SIGTRAMP (GCC): https://github.com/gcc-mirror/gcc/blob/master/libgcc/config/i386/freebsd-unwind.h Example of unwind code with KERN_PROC_SIGTRAMP (GDB): https://github.com/bminor/binutils-gdb/blob/master/gdb/amd64-fbsd-nat.c#L302 Regards, John Marino