diff --git a/signal.c b/signal.c index b07a99db15..96277e322c 100644 --- a/signal.c +++ b/signal.c @@ -641,11 +641,16 @@ check_stack_overflow(const void *addr) #ifdef _WIN32 #define CHECK_STACK_OVERFLOW() check_stack_overflow(0) #else -#define CHECK_STACK_OVERFLOW() check_stack_overflow(info->si_addr) +#define FAULT_ADDRESS info->si_addr +#define CHECK_STACK_OVERFLOW() check_stack_overflow(FAULT_ADDRESS) +#define MESSAGE_FAULT_ADDRESS " at %p", FAULT_ADDRESS #endif #else #define CHECK_STACK_OVERFLOW() (void)0 #endif +#ifndef MESSAGE_FAULT_ADDRESS +#define MESSAGE_FAULT_ADDRESS +#endif #ifdef SIGBUS static RETSIGTYPE @@ -659,7 +664,7 @@ sigbus(int sig SIGINFO_ARG) #if defined __APPLE__ CHECK_STACK_OVERFLOW(); #endif - rb_bug("Bus Error"); + rb_bug("Bus Error" MESSAGE_FAULT_ADDRESS); } #endif @@ -696,7 +701,7 @@ sigsegv(int sig SIGINFO_ARG) segv_received = 1; ruby_disable_gc_stress = 1; - rb_bug("Segmentation fault"); + rb_bug("Segmentation fault" MESSAGE_FAULT_ADDRESS); } #endif