"David Alan Black" <dblack / wobblini.net> schrieb im Newsbeitrag
news:m3smeg8h4h.fsf / wobblini.net...
> Hi --
>
> Gavin Sinclair <gsinclair / soyabean.com.au> writes:
>
> > I'd like to be able to write a program that, halfway through
> > execution, stops what it's doing and opens an irb session with the
> > current state.  This would be an excellent tool for debugging.
> >
> > Does anyone know if it's possible?  My instinct says it's probably
> > not.  If that's the case, I'd like to if some modification to Ruby
> > could make it possible, to feed into a potential RCR.
>
> $ ruby -e 'require "irb"; print "irb? "; IRB.start if /y/.match(gets)'
> irb? yes
> irb(main):001:0>
>
> New scope, of course, but still running same program.  I don't know
> that there's any way to get local variables involved, except maybe
> grabbing the binding directly.

The program could provide a callback in some global var that presents all
interesting infos.  Of course, locals were still not (directly)
accessible, but one could hack something together using set_trace_func.

Otherwise it might be better to use the debugger anyway...

Regards

    robert