Is it possible to get the source code associated with Kernel.eval?

E

Eric Promislow

The Komodo Ruby debugger was capturing the source for calls to
Kernel.eval by redefining the method, trapping calls to it,
saving the source, and then finally calling the true eval method.

This has two problems:

1. Sometimes I couldn't associate the correct binding with the
call to the true eval -- I posted a note on this a couple of
weeks ago asking if anyone had some insight on this.

2. This also throws off the standard tracer by some kind of
interaction I don't completely understand.

So I'm pulling out support for this. By no means am I an expert
on Ruby internals, but it looks like the args to rb_f_eval()
could be saved on the frame stack in the argc and argv fields,
and then a function would be needed to grab that data on
demand. I'm not sure how such a frame would be identified from
Ruby code, as not all frames appear to trigger a call to the
trace function, so just giving an offset wouldn't suffice.
I'd prefer to use the binding, as it is exposed to the Ruby
code via the source function.

Thanks,
Eric
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top