Kernel#caller for non-current thread

Looks like it can be done in C by: set ruby_frame to the particular
th->frame, call backtrace(), and set it back. Is there a better way or
has anybody already done it?

Steve

Steven Lumos wrote:

Looks like it can be done in C by: set ruby_frame to the particular
th->frame, call backtrace(), and set it back. Is there a better way or
has anybody already done it?

Hm, is there anything in the implementation of #backtrace that could cause another thread to run? Maybe Thread.critical=true is needed...

This would be nice to have, if it works.

ยทยทยท

--
       vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407

Joel VanderWerf <vjoel@path.berkeley.edu> writes:

Steven Lumos wrote:

Looks like it can be done in C by: set ruby_frame to the particular
th->frame, call backtrace(), and set it back. Is there a better way or
has anybody already done it?

Hm, is there anything in the implementation of #backtrace that could
cause another thread to run? Maybe Thread.critical=true is needed...

This would be nice to have, if it works.

Unfortunately my initial scan of the source turned out to be too
quick. structs that I assumed would be defined in one of the header
files (struct thread) are actually defined in eval.c. I believe a lot
was opened up in 1.8.5 for Sandbox, but I haven't checked it yet.

Steve