Skip to content


VM crashes in libexecinfo on FreeBSD #272

marius opened this Issue · 4 comments

3 participants


I have to disable usage of libexecinfo on FreeBSD for the default rake task to work without errors. I did this by commenting line 437 of the configure script. If I don't do this it builds fine but crashes in the c++ test runner in files test_exception.hpp line 24 and test_object.hpp line 63. Here is a backtrace:

% gdb vm/test/runner runner.core
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "amd64-marcel-freebsd"...
Core was generated by `runner'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /lib/
Loaded symbols for /lib/
Reading symbols from /lib/
Loaded symbols for /lib/
Reading symbols from /usr/local/lib/
Loaded symbols for /usr/local/lib/
Reading symbols from /usr/lib/
Loaded symbols for /usr/lib/
Reading symbols from /lib/
Loaded symbols for /lib/
Reading symbols from /lib/
Loaded symbols for /lib/
Reading symbols from /lib/
Loaded symbols for /lib/
Reading symbols from /libexec/
Loaded symbols for /libexec/
#0  0x00000008016d52e4 in getframeaddr () from /usr/local/lib/
[New Thread 801f021c0 (LWP 100350)]
(gdb) bt
#0  0x00000008016d52e4 in getframeaddr () from /usr/local/lib/
#1  0x00000008016cee8e in backtrace () from /usr/local/lib/
#2  0x0000000000609dad in get_trace (skip=2, max_depth=Variable "max_depth" is not available.) at vm/exception.cpp:55
#3  0x000000000060adf4 in get_cpp_backtrace () at vm/exception.cpp:140
#4  0x000000000060aff5 in VMException (this=0x8041f41f0, reason=0x0, make_backtrace=Variable "make_backtrace" is not available.) at vm/exception.cpp:155
#5  0x000000000060b04e in rubinius::TypeError::raise (type=rubinius::ClassType, obj=0x801f0c280, reason=0x0) at exception.hpp:86
#6  0x0000000000810c5a in TestException::test_type_error_raise (this=0x14b9140) at test_exception.hpp:29
#7  0x0000000000810d28 in TestDescription_TestException_test_type_error_raise::runTest (this=0x14b94c0) at vm/test/runner.cpp:1367
#8  0x0000000000778c91 in CxxTest::RealTestDescription::run (this=0x14b94c0) at RealDescriptions.cpp:96
#9  0x000000000088db1e in CxxTest::TestRunner::runTest (this=0x7fffffffe777, td=@0x14b94c0) at TestRunner.h:86
#10 0x000000000088dc92 in CxxTest::TestRunner::runSuite (this=0x7fffffffe777, sd=@0x14b24c0) at TestRunner.h:71
#11 0x000000000088de01 in CxxTest::TestRunner::runWorld (this=0x7fffffffe777) at TestRunner.h:50
#12 0x000000000088dec7 in CxxTest::TestRunner::runAllTests (listener=@0x7fffffffe7c0) at TestRunner.h:23
#13 0x000000000088df55 in CxxTest::ErrorFormatter::run (this=0x7fffffffe7c0) at ErrorFormatter.h:49
#14 0x0000000000778e30 in main () at vm/test/runner.cpp:20
(gdb) q

I looked into libexecinfo but can't find anything suspicious. Maybe the __builtin_return_address and/or __builtin_frame_address functions are broken on FreeBSD.

Rubinius member

Which version of libexecinfo do you have? It used to be that libexecinfo had to be separately installed for the BSDs, not sure if that is still the case?


Yes, this is still the case. I think I found the culprit, it seems like FreeBSD/amd64 is omitting the frame-pointer by default in higher -O levels. When I use the following patch it seems to work fine:
diff --git a/rakelib/vm.rake b/rakelib/vm.rake
index c16c66a..a05dbd6 100644
--- a/rakelib/vm.rake
+++ b/rakelib/vm.rake
@@ -149,7 +149,7 @@ end! { |f| "-I#{f}" }

 # Default build options
-BASIC_FLAGS     = %W[ -pipe -Wall -Wno-deprecated ]
+BASIC_FLAGS     = %W[ -pipe -Wall -Wno-deprecated -fno-omit-frame-pointer]


@@ -231,8 +231,7 @@ end
 def ld(t)
   link_opts = llvm_link_flags()

-  link_opts += ' -Wl,--export-dynamic' if RUBY_PLATFORM =~ /linux/i
-  link_opts += ' -rdynamic'            if RUBY_PLATFORM =~ /bsd/
+  link_opts += ' -Wl,--export-dynamic' if RUBY_PLATFORM =~ /linux|bsd/i

   # Include LDFLAGS
   if str = ENV['LDFLAGS']

But that should probably be only for platform bsd.

Rubinius member

Seems like your libexecinfo is broken. I've just commited a configure change so you can do --without-execinfo to disable it all together. Please try that.


It's working when I do a ./configure --without-execinfo. However I think I can not get any backtraces then. As I wrote I can get everything to run when I add -fno-omit-frame-pointer, even backtraces. Maybe there are more platforms which strip frame-pointers by default, these should be broken too right now with regards to execinfo.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.