How do I get rbenv to store debug characters?

I installed the development version of Ruby 2 through rbenv on Mac OS X v10.8.3, and use it to compile the gem I'm working on. I have a memory problem that I want to debug. Unfortunately, whenever I run valgrind , gdb or cgdb in the context of a rake spec , I get a whole bunch of errors like this:

 warning: Could not find object file "/private/var/folders/5f/h1s00nhn0rv4ckkpg4k_bwhr0000gn/T/ruby-build.20130331232604.54521/ruby-2.0.0-dev/main.o" - no debug information available for "main.c". 

Obviously, the ruby-build directory no longer exists.

I get from valgrind . Here are some examples:

 --2564-- /Users/jwoods/.rbenv/versions/2.0.0-dev/lib/libyaml-0.2.dylib: --2564-- dSYM directory is missing; consider using --dsymutil=yes 

If I try to use this option --dsymutil=yes , I get errors that are basically the same as gdb :

 warning: (x86_64) /private/var/folders/5f/h1s00nhn0rv4ckkpg4k_bwhr0000gn/T/ruby-build.20130331232604.54521/ruby-2.0.0-dev/ext/openssl/ossl_bn.o unable to open object file 

In response to another question, I tried to run info target inside gdb . Here is the result.

Is there a way I can give the rbenv command rbenv put debug symbols somewhere that they won't be cleared?

I am using GCC 4.7.1, which I installed via homebrew. My lowercase version of Ruby is ruby 2.1.0dev (2013-04-01 trunk 40029) [x86_64-darwin12.3.0] version ruby 2.1.0dev (2013-04-01 trunk 40029) [x86_64-darwin12.3.0] , and my rbenv version is 0.4.0.

+7
source share
1 answer

According to the documentation for ruby-build :

Both ruby-build and rbenv install accept the -k or -keep flag, which tells ruby-build to save the loaded source after installation. This can be useful if you need to use gdb and memprof with Ruby.

So try ruby-build install X -k , where X is the version number.

+1
source

All Articles