Eric Blake wrote: > user_context->uc_stack.ss_sp contains the location > of the currently running (alternate) stack, not the stack where the fault > occurred. ... find out where the _original_ stack ended > ... > I haven't looked at how libsigsegv handles this situation
libsigsegv has a solution that works for most platforms, distributed over several files: File platforms uses stackvma-linux.c Linux /proc/self/maps, mincore() stackvma-freebsd.c FreeBSD /proc/curproc/map, mincore() stackvma-mincore.c OpenBSD, NetBSD mincore() stackvma-mach.c MacOS X vm_region() stackvma-procfs.c IRIX, OSF/1, Solaris ioctl(PIOCMAP) stackvma-beos.c BeOS get_next_area_info() Would help to move this code to gnulib? Are there other uses of the stack VMA? (Conservative garbage-collectors and Scheme interpreters only need to know the current stack pointer and the stack top, AFAIK, not the stack bottom.) Bruno