ruby-changes:34019
From: nobu <ko1@a...>
Date: Sun, 25 May 2014 12:15:38 +0900 (JST)
Subject: [ruby-changes:34019] nobu:r46100 (trunk): signal.c: fix stack overflow check on Mac OS X
nobu 2014-05-25 12:15:32 +0900 (Sun, 25 May 2014) New Revision: 46100 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=46100 Log: signal.c: fix stack overflow check on Mac OS X * signal.c (check_stack_overflow): fix condition to use ucontext register, mcontext_t dereference, and its member names, on Mac OS X. Modified files: trunk/ChangeLog trunk/signal.c Index: ChangeLog =================================================================== --- ChangeLog (revision 46099) +++ ChangeLog (revision 46100) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Sun May 25 12:15:30 2014 Nobuyoshi Nakada <nobu@r...> + + * signal.c (check_stack_overflow): fix condition to use ucontext + register, mcontext_t dereference, and its member names, on Mac + OS X. + Sun May 25 11:58:26 2014 Zachary Scott <e@z...> * enumerator.c: [DOC] Fix example to show Enumerator#peek behavior Index: signal.c =================================================================== --- signal.c (revision 46099) +++ signal.c (revision 46100) @@ -700,7 +700,7 @@ rb_get_next_signal(void) https://github.com/ruby/ruby/blob/trunk/signal.c#L700 #if defined(USE_SIGALTSTACK) || defined(_WIN32) NORETURN(void ruby_thread_stack_overflow(rb_thread_t *th)); -#if !(defined(HAVE_UCONTEXT_H) && (defined __i386__ || defined __x86_64__)) +#if (defined(HAVE_UCONTEXT_H) && (defined __i386__ || defined __x86_64__)) #elif defined __linux__ # define USE_UCONTEXT_REG 1 #elif defined __APPLE__ @@ -710,18 +710,19 @@ NORETURN(void ruby_thread_stack_overflow https://github.com/ruby/ruby/blob/trunk/signal.c#L710 static void check_stack_overflow(const uintptr_t addr, const ucontext_t *ctx) { - const mcontext_t *mctx = &ctx->uc_mcontext; # if defined __linux__ + const mcontext_t *mctx = &ctx->uc_mcontext; # if defined REG_RSP const greg_t sp = mctx->gregs[REG_RSP]; # else const greg_t sp = mctx->gregs[REG_ESP]; # endif # elif defined __APPLE__ + const mcontext_t mctx = ctx->uc_mcontext; # if defined(__LP64__) - const uintptr_t sp = mctx->ss.rsp; + const uintptr_t sp = mctx->__ss.__rsp; # else - const uintptr_t sp = mctx->ss.esp; + const uintptr_t sp = mctx->__ss.__esp; # endif # endif enum {pagesize = 4096}; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/