[MacRuby-devel] MacRuby Devel Beginner Question

Laurent Sansonetti lsansonetti at apple.com
Wed Aug 11 15:49:13 PDT 2010


Also, when debugging MacRuby it is better to use the version of libmacruby in the build directory, because the installer strips symbols during installation. From the build directory:

DYLD_LIBRARY_PATH=. gdb --args ./macruby ...

Also, the whole project is compiled with heavy optimizations which makes the debugging of certain things harder (inline functions, optimized variables, etc.). Sometimes it is better to debug a version of MacRuby with no optimization. You can build one using:

rake optz_level=0 macruby

HTH,
Laurent

On Aug 11, 2010, at 3:28 PM, Thibault Martin-Lagardette wrote:

> Hi,
> 
> Good to know you're motivated to get into hacking MacRuby :D
> 
> `rb_marshal_load` is an "API", supposed to be used by extensions for example.
> If you look in `marshal.c`, you'll see that the "load" method is defined by `marshal_load` (without the rb_ prefix):
> 	    rb_objc_define_method(*(VALUE *)rb_mMarshal, "load", marshal_load, -1);
> 
> This means that when a ruby code calls Marshal.load, it will call this method.
> To sum things up, I think you just need to set a breakpoint to marshal_load, not rb_marshal_load :D
> 
> Let us know how things work out!
> -- 
> Thibault Martin-Lagardette
> 
> 
> 
> On Aug 11, 2010, at 13:33, Jeff Hemmelgarn wrote:
> 
>> Hello,
>> 
>> First I want to thank everyone involved in the project for their efforts in bringing MacRuby to us.  I love being able to use GCD with ruby!  I have been on vacation for a week and finally feel like touching a computer again so I thought I would look into doing some MacRuby development.
>> 
>> Since I have no experience with llvm and almost none with ObjectiveC, I decided to pick a low-priority, narrow focus bug to look into.  That should allow me to get used to the environment without going too far into the weeds. I pretty much randomly chose #502 Marshalling large integers returns wrong value.
>> 
>> I have downloaded and built both llvm and the latest code from the git mirror.
>> 
>> I have been trying to reproduce the problem with macirb under gdb.  I have some experience with gdb but I am getting confused trying to set a breakpoint in the Marshal package load function.  It looks like MacRuby is bypassing the globally visible function rb_marshal_load and using rb_objc_define_method to export a pointer to the file local function marshal_load.
>> 
>> The basics of the question is, how do I set a breakpoint in gdb for this function?  Is this problem a result of using llvm?  Will I end up needing to set a generic breakpoint in a dispatch routine with a condition looking for the selector for the load function?
>> 
>> Thank you in advance for any help!
>> 
>> Jeff Hemmelgarn
>> _______________________________________________
>> MacRuby-devel mailing list
>> MacRuby-devel at lists.macosforge.org
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
> 
> _______________________________________________
> MacRuby-devel mailing list
> MacRuby-devel at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20100811/35e38df1/attachment.html>


More information about the MacRuby-devel mailing list