--001636c92fceb977d10474b3a5bb
Content-Type: text/plain; charset=ISO-2022-JP
Content-Transfer-Encoding: 7bit

On Tue, Sep 29, 2009 at 4:03 AM, Mark Moseley <mark / fast-software.com>wrote:

> Ryan Davis wrote:
>
>> /**
>>>  @c setting
>>>  @e trace
>>>  @j trace Ѥ̿ᡣ
>>>  */
>>> DEFINE_INSN
>>> trace
>>> (rb_num_t nf)
>>> ()
>>> ()
>>> {
>>>    rb_event_flag_t flag  rb_event_flag_t)nf;
>>>
>>>    EXEC_EVENT_HOOK(th, flag, GET_SELF(), 0, 0 /* TODO: id, klass */);
>>> }
>>>
>>
>> Am I missing something? Does this TODO imply that the event hook mechanism
>> isn't supposed to work yet?
>>
>>
>>
>>
>>
> The hook works fine, it just doesn't pass in the id and klass variables.
> You can get them pretty easily, though
> (ruby_current_thread->cfp->iseq->defined_method_id and
> ruby_current_thread->cfp->iseq->klass).
>

That C code is easy? To each his/her own.

This works if there is an instruction sequence associated with the stopping
point. If not, the binding parameter of the trace hook call may be useful to
get the class.

If you are inside a VM C frame (like "times" or "upto"  there is no VM
instruction sequence, the method name is recorded, but you need to get at
via other means since C frames don't have iseq's.


> Mark
>
>
>

--001636c92fceb977d10474b3a5bb
Content-Type: text/html; charset=ISO-2022-JP
Content-Transfer-Encoding: base64

PGJyPjxicj48ZGl2IGNsYXNzPSJnbWFpbF9xdW90ZSI+T24gVHVlLCBTZXAgMjksIDIwMDkgYXQg
NDowMyBBTSwgTWFyayBNb3NlbGV5IDxzcGFuIGRpcj0ibHRyIj4mbHQ7PGEgaHJlZj0ibWFpbHRv
Om1hcmtAZmFzdC1zb2Z0d2FyZS5jb20iPm1hcmtAZmFzdC1zb2Z0d2FyZS5jb208L2E+Jmd0Ozwv
c3Bhbj4gd3JvdGU6PGJyPjxibG9ja3F1b3RlIGNsYXNzPSJnbWFpbF9xdW90ZSIgc3R5bGU9ImJv
cmRlci1sZWZ0OiAxcHggc29saWQgcmdiKDIwNCwgMjA0LCAyMDQpOyBtY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