summaryrefslogtreecommitdiff
path: root/thread.c
diff options
context:
space:
mode:
authorshugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-11-11 08:42:13 +0000
committershugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-11-11 08:42:13 +0000
commit577eaa60a705efd018a94ec5e752fb77626dba72 (patch)
treeb4edc75a68ef3733d7eb6107e8dae803dcd2f141 /thread.c
parentc5335ee110cfab1179018f6b0dbd504742017a4e (diff)
* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@13877 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread.c')
-rw-r--r--thread.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/thread.c b/thread.c
index 9476017a33..f059e0dc39 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