From 5181fa2a558ca99fc2185475d540b36f9680532d Mon Sep 17 00:00:00 2001 From: akr Date: Sat, 21 Nov 2009 09:49:30 +0000 Subject: [PATCH] * vm_eval.c (rb_search_method_entry): show flags and klass value in not implemented error message. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25882 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ vm_eval.c | 31 +++++++++++++++++++++---------- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3fd581aa81..ffdf369015 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sat Nov 21 18:48:35 2009 Tanaka Akira + + * vm_eval.c (rb_search_method_entry): show flags and klass value in + not implemented error message. + Sat Nov 21 16:38:50 2009 Nobuyoshi Nakada * marshal.c (marshal_dump): use normal object as the buffer so diff --git a/vm_eval.c b/vm_eval.c index 49fe49dbba..d975809f31 100644 --- a/vm_eval.c +++ b/vm_eval.c @@ -336,22 +336,33 @@ rb_search_method_entry(VALUE recv, ID mid) VALUE klass = CLASS_OF(recv); if (!klass) { - if (!IMMEDIATE_P(recv) && RBASIC(recv)->flags != 0) { + if (IMMEDIATE_P(recv)) { + rb_raise(rb_eNotImpError, + "method `%s' called on unexpected immediate object (%p)", + rb_id2name(mid), (void *)recv); + } + if (RBASIC(recv)->flags == 0) { + rb_raise(rb_eNotImpError, + "method `%s' called on terminated object" + " (%p flags=0x%"PRIxVALUE" klass=0x%"PRIxVALUE")", + rb_id2name(mid), (void *)recv, + RBASIC(recv)->flags, RBASIC(recv)->klass); + } + else { int type = BUILTIN_TYPE(recv); const char *typestr = rb_type_str(type); if (typestr) rb_raise(rb_eNotImpError, - "method `%s' called on hidden %s object (%p)", - rb_id2name(mid), typestr, (void *)recv); + "method `%s' called on hidden %s object" + " (%p flags=0x%"PRIxVALUE" klass=0x%"PRIxVALUE")", + rb_id2name(mid), typestr, (void *)recv, + RBASIC(recv)->flags, RBASIC(recv)->klass); else rb_raise(rb_eNotImpError, - "method `%s' called on hidden T_???" "(0x%02x) object (%p)", - rb_id2name(mid), type, (void *)recv); - } - else { - rb_raise(rb_eNotImpError, - "method `%s' called on terminated object (%p)", - rb_id2name(mid), (void *)recv); + "method `%s' called on hidden T_???" "(0x%02x) object" + " (%p flags=0x%"PRIxVALUE" klass=0x%"PRIxVALUE")", + rb_id2name(mid), type, (void *)recv, + RBASIC(recv)->flags, RBASIC(recv)->klass); } } return rb_method_entry(klass, mid);