From: Jason Roelofs Date: 2009-08-02T03:29:19+09:00 Subject: Re: Fwd: ruby_frame in 1.8 is what in 1.9? --0016e645fae8b50309047018b6cb Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On Sat, Aug 1, 2009 at 10:19 AM, Mark Moseley wrote: > Jason Roelofs wrote: > > So I have some C++ extension code that nicely uses ruby_frame->orig_func > > and > > ruby_frame->self to figure out the current status of the VM at a given > > method call. Trying to port this to 1.9 is running into some issues, > > mainly > > that I can't find a replacement for ruby_frame->self. I've found > > rb_frame_callee() to replace ruby_frame->orig_func but cannot find out > > how > > to get access to the current Ruby "self" object for the call. > > > > Jason > > My best guess: try GET_THREAD()->cfp->self. That's probably not going to > work, because the variables inside the frame are all different. I'd have > to see what you need to do with the "self" object. > -- > Posted via http://www.ruby-forum.com/. > > I'll take a look at ruby_debug for sure, but for more information, here's what I'm up against: http://github.com/jameskilton/rice/blob/master/rice/Director.cpp With tests to show example usage: http://github.com/jameskilton/rice/blob/master/test/test_Director.cpp If you're familiar with SWIG's %director, this is what I've got. This class gets subclassed and helps define an intermediary between C++ and Ruby to allow polymorphism and super calls to work seemlessly across the two languages. What's there works great for 1.8, and it's best shown how it works in the test: int process(int num) { if(callIsFromRuby("process")) { raisePureVirtual(); } else { return from_ruby( getSelf().call("process", num) ); } } So for 1.9 I need to figure out the current self object of the frame, along with the name of the function currently being called, aka, how do I port this line of code to work with 1.9? return (getSelf().value() == ruby_frame->self) && ( rb_id2name(ruby_frame->orig_func) != methodName ); Thanks. Jason --0016e645fae8b50309047018b6cb--