[MacRuby-devel] Debug Shell from GDB

Laurent Sansonetti lsansonetti at apple.com
Sun Nov 9 14:50:48 PST 2008


On Nov 9, 2008, at 2:41 PM, Jordan K. Hubbard wrote:

> On Nov 9, 2008, at 11:57 AM, Laurent Sansonetti wrote:
>
>> This could potentially be possible, if the objc code runs in the GC  
>> environment. You could load MacRuby.framework from GDB (using  
>> NSBundle), then initialize the runtime ([MacRuby sharedRuntime])  
>> then start an IRB session, by evaluating the right expression (- 
>> [evaluateString:]).
>
> I think this also gets back to our previous discussion about having  
> an "irb console" window always open (on its own thread) when any  
> MacRuby application was run in "debugging mode" (or even compiled  
> thusly, with a debugging target).  Then you'd have that console up  
> whether you were in gdb or not and, frankly, would probably be  
> happier with the experience when debugging ruby code (unless you're  
> Laurent and know the internals of MacRuby well enough to make  
> debugging ruby and/or C extension code from gdb a rewarding  
> experience).   Ideally, one should be also able to set "ruby  
> breakpoints" from such an irb console and see control transferred to  
> it whenever one is hit.  It's an interpreted language, how hard can  
> it be? :-)

Sure, when the app in question is a MacRuby app then we can do that  
(there is AFAIK no need to start a new thread, the console can be in  
the runloop.)

But here Daniel was referring to using MacRuby inside a pure objc app,  
I think, which is different, since you need to dynamically load  
MacRuby in the environment.

Laurent


More information about the MacRuby-devel mailing list