]> git.eshelyaron.com Git - emacs.git/commit
Better heuristic for C stack overflow
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 16 Jul 2015 07:48:40 +0000 (00:48 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 16 Jul 2015 14:36:47 +0000 (07:36 -0700)
commita5522abbca2235771384949dfa87c8efc68831b2
tree1e7f8ffd9a3ae3290672b8e6694696a37b0426fd
parentbd8b5ac77250d9fe0634d58a30a3bf6d2497725a
Better heuristic for C stack overflow

Improve the heuristic for distinguishing stack overflows from
other SIGSEGV causes (Bug#21004).  Corinna Vinschen explained that
the getrlimit method wasn't portable to Cygwin; see:
https://www.cygwin.com/ml/cygwin/2015-07/msg00092.html
Corinna suggested pthread_getattr_np but this also has problems.
Instead, replace the low-level system stuff with a simple
heuristic based on known good stack addresses.
* src/eval.c, src/lisp.h (near_C_stack_top): New function.
* src/sysdep.c: Don't include <sys/resource.h>.
(stack_direction): Remove.  All uses removed.
(stack_overflow): New function.
(handle_sigsegv): Use it instead of incorrect getrlimit heuristic.
Make SEGV fatal in non-main threads.
src/eval.c
src/lisp.h
src/sysdep.c