ruby-changes:27250
From: naruse <ko1@a...>
Date: Tue, 19 Feb 2013 06:21:13 +0900 (JST)
Subject: [ruby-changes:27250] naruse:r39302 (trunk): * vm_dump: FreeBSD ports' libexecinfo's backtrace(3) can't trace
naruse 2013-02-19 06:21:02 +0900 (Tue, 19 Feb 2013) New Revision: 39302 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=39302 Log: * vm_dump: FreeBSD ports' libexecinfo's backtrace(3) can't trace beyond signal trampoline, and as described in r38342 it can't trace on -O because it see stack frame pointers. libunwind unw_backtrace see dwarf information in the binary and it works with -O (without frame pointers). * configure.in: remove r38342's hack and check libunwind. Modified files: trunk/ChangeLog trunk/configure.in trunk/vm_dump.c Index: configure.in =================================================================== --- configure.in (revision 39301) +++ configure.in (revision 39302) @@ -2417,19 +2417,7 @@ AS_CASE(["$target_cpu-$target_os"], https://github.com/ruby/ruby/blob/trunk/configure.in#L2417 AC_CHECK_HEADERS([execinfo.h]) if test "x$ac_cv_header_execinfo_h" = xyes; then AC_CHECK_LIB([execinfo], [backtrace]) - execinfo_frame_pointer=no - RUBY_TRY_CFLAGS(-fno-omit-frame-pointer, [execinfo_frame_pointer=yes]) - if test "x$execinfo_frame_pointer" = xyes; then - # optflags must be manipulated very carefully. For the - # later cflagspat/cxxflagspat substitution to work, CFLAGS - # and CXXFLAGS must start exactly with the value of - # optflags. - CFLAGS="${CFLAGS# }"; CFLAGS="${CFLAGS#"$optflags "}" - CXXFLAGS="${CXXFLAGS# }"; CXXFLAGS="${CXXFLAGS#"$optflags "}" - RUBY_APPEND_OPTION(optflags, -fno-omit-frame-pointer) - CFLAGS=" $optflags $CFLAGS" - CXXFLAGS=" $optflags $CXXFLAGS" - fi + AC_CHECK_LIB([unwind], [unw_backtrace]) fi]) AC_CHECK_FUNCS(backtrace) Index: ChangeLog =================================================================== --- ChangeLog (revision 39301) +++ ChangeLog (revision 39302) @@ -1,3 +1,13 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Tue Feb 19 06:04:06 2013 NARUSE, Yui <naruse@r...> + + * vm_dump: FreeBSD ports' libexecinfo's backtrace(3) can't trace + beyond signal trampoline, and as described in r38342 it can't + trace on -O because it see stack frame pointers. + libunwind unw_backtrace see dwarf information in the binary + and it works with -O (without frame pointers). + + * configure.in: remove r38342's hack and check libunwind. + Tue Feb 19 04:26:29 2013 NARUSE, Yui <naruse@r...> * configure.in: check whether backtrace(3) works well or not. Index: vm_dump.c =================================================================== --- vm_dump.c (revision 39301) +++ vm_dump.c (revision 39302) @@ -431,6 +431,11 @@ rb_vmdebug_thread_dump_state(VALUE self) https://github.com/ruby/ruby/blob/trunk/vm_dump.c#L431 # undef HAVE_BACKTRACE # define HAVE_BACKTRACE 0 #endif +#if HAVE_LIBUNWIND +# define HAVE_BACKTRACE 1 +# undef backtrace +# define backtrace unw_backtrace +#endif #if HAVE_BACKTRACE # include <execinfo.h> #elif defined(_WIN32) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/