From: Jonathan Tran Date: 2012-09-11T04:55:19+09:00 Subject: Re: Using binding + set_trace_func to capture execution state Reginald, Have you made any progress with this? I've been wanting to do a similar thing, so I'm curious how far you've gotten. I have a rough prototype that uses set_trace_func to get the local_variables and their values. Instead of storing the binding, I'm just outputting the variables I care about within my set_trace_func proc. I'm just using #inspect now, but I suppose any view would do. To alleviate the problem of too much data, I'm simply whitelisting the exact methods that I care about exploring. I'm not worrying too much about this right now. Also, I've found the class, method, and line number of set_trace_func to be useful. I've found that the line number matches the line number in Ripper's s-expression output. I don't know if this is the case in general, but it's worked in my proof of concept so far. Combined with the binding and local_variables, I can then display the source being executed with values substituted for variables. That's as far as I've gotten. It's very rough and doesn't handle a lot of parses yet, but honestly, my biggest unknown now is how to present the information to the user in a way he/she can interact with it. I'd love to hear any thoughts or ideas of a better way to accomplish this! Jon -- Posted via http://www.ruby-forum.com/.