Debug Shell from GDB
Hello List, Not sure about the feasibility of this, but wouldn't it be great to break out into an embedded macirb session from inside GDB? Exploring the state of a running application this way could really help with debugging objc code. If anyone has insights on how this could be accomplished I'd be interested to hear them. Cheers, - Daniel
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:]). Otherwise if the objc app does not run under GC I don't think there is an easy way to support this feature. Laurent On Nov 9, 2008, at 1:21 PM, Daniel A Carleton wrote:
Hello List,
Not sure about the feasibility of this, but wouldn't it be great to break out into an embedded macirb session from inside GDB? Exploring the state of a running application this way could really help with debugging objc code.
If anyone has insights on how this could be accomplished I'd be interested to hear them.
Cheers,
- Daniel _______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
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? :-) - Jordan
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
On Nov 9, 2008, at 2:50 PM, Laurent Sansonetti wrote:
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.)
Ah, that's even better, yes.
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.
Ahh, OK. So, is there anything we can do to make *that* particular usage scenario any easier? - Jordan
On Nov 9, 2008, at 3:10 PM, Jordan K. Hubbard wrote:
On Nov 9, 2008, at 2:50 PM, Laurent Sansonetti wrote:
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.)
Ah, that's even better, yes.
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.
Ahh, OK. So, is there anything we can do to make *that* particular usage scenario any easier?
The scenario is easy, the only problem as I wrote earlier is that the app must run in GC mode. You cannot load MacRuby in a non GC environment (dyld will complain). Laurent
participants (3)
-
Daniel A Carleton
-
Jordan K. Hubbard
-
Laurent Sansonetti