From 7689e6b971542e083e3ef004ebb363e9767bd94e Mon Sep 17 00:00:00 2001 From: shugo Date: Sun, 11 Nov 2007 08:42:13 +0000 Subject: * insnhelper.ci (vm_call_method): pass mn->nd_clss to vm_call_cfunc() instead of klass. * vm.c (rb_thread_method_id_and_klass): traverse parent_iseq. * thread.c (call_trace_proc): use rb_thread_method_id_and_klass(). git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@13877 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- thread.c | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) (limited to 'thread.c') diff --git a/thread.c b/thread.c index 9476017a3..f059e0dc3 100644 --- a/thread.c +++ b/thread.c @@ -2890,22 +2890,32 @@ call_trace_proc(VALUE args) VALUE eventname = rb_str_new2(get_event_name(p->event)); VALUE filename = rb_str_new2(rb_sourcefile()); int line = rb_sourceline(); - VALUE mid; + ID id = 0; + VALUE klass = 0; - if (p->id == ID_ALLOCATOR) { - mid = ID2SYM(rb_intern("allocate")); - } - else if (p->id) { - mid = ID2SYM(p->id); + if (p->event == RUBY_EVENT_C_CALL || + p->event == RUBY_EVENT_C_RETURN) { + id = p->id; + klass = p->klass; } else { - mid = Qnil; + rb_thread_method_id_and_klass(GET_THREAD(), &id, &klass); + } + if (id == ID_ALLOCATOR) + return; + if (klass) { + if (TYPE(klass) == T_ICLASS) { + klass = RBASIC(klass)->klass; + } + else if (FL_TEST(klass, FL_SINGLETON)) { + klass = rb_iv_get(klass, "__attached__"); + } } return rb_proc_call(p->proc, rb_ary_new3(6, eventname, filename, INT2FIX(line), - mid, + id ? ID2SYM(id) : Qnil, p->self ? rb_binding_new() : Qnil, - p->klass ? p->klass : Qnil)); + klass ? klass : Qnil)); } static void -- cgit