[前][次][番号順一覧][スレッド一覧]

ruby-changes:31887

From: nobu <ko1@a...>
Date: Tue, 3 Dec 2013 12:19:01 +0900 (JST)
Subject: [ruby-changes:31887] nobu:r43966 (trunk): signal.c: fault address

nobu	2013-12-03 12:18:49 +0900 (Tue, 03 Dec 2013)

  New Revision: 43966

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=43966

  Log:
    signal.c: fault address
    
    * signal.c (sigbus, sigsegv): show fault address in the bug message.

  Modified files:
    trunk/signal.c
Index: signal.c
===================================================================
--- signal.c	(revision 43965)
+++ signal.c	(revision 43966)
@@ -641,11 +641,16 @@ check_stack_overflow(const void *addr) https://github.com/ruby/ruby/blob/trunk/signal.c#L641
 #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) https://github.com/ruby/ruby/blob/trunk/signal.c#L664
 #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) https://github.com/ruby/ruby/blob/trunk/signal.c#L701
 
     segv_received = 1;
     ruby_disable_gc_stress = 1;
-    rb_bug("Segmentation fault");
+    rb_bug("Segmentation fault" MESSAGE_FAULT_ADDRESS);
 }
 #endif
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]