From c22cbdc1306dbf0a4019299057fca688aaa9106b Mon Sep 17 00:00:00 2001 From: nagachika Date: Mon, 23 Jun 2014 15:08:11 +0000 Subject: merge revision(s) r45947,r45951: [Backport #9739] [Backport #9844] * thread_win32.c (rb_w32_stack_overflow_handler): use Structured Exception Handling by Addvectoredexceptionhandler() for machine stack overflow on mingw. This would be equivalent to the handling using __try and __exept on mswin introduced by r43748. Exception Handling by AddVectoredExceptionHandler() for machine This would be equivalent to the handling using __try and __except git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@46522 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- thread_win32.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'thread_win32.c') diff --git a/thread_win32.c b/thread_win32.c index 7eb640aa6c..aea3fc20ac 100644 --- a/thread_win32.c +++ b/thread_win32.c @@ -754,6 +754,18 @@ ruby_stack_overflowed_p(const rb_thread_t *th, const void *addr) return rb_thread_raised_p(th, RAISED_STACKOVERFLOW); } +#if defined(__MINGW32__) +LONG WINAPI +rb_w32_stack_overflow_handler(struct _EXCEPTION_POINTERS *exception) +{ + if (exception->ExceptionRecord->ExceptionCode == EXCEPTION_STACK_OVERFLOW) { + rb_thread_raised_set(GET_THREAD(), RAISED_STACKOVERFLOW); + raise(SIGSEGV); + } + return EXCEPTION_CONTINUE_SEARCH; +} +#endif + #ifdef RUBY_ALLOCA_CHKSTK void ruby_alloca_chkstk(size_t len, void *sp) -- cgit v1.2.3