From: ts Date: 2007-12-27T23:16:55+09:00 Subject: [1.9] rb_catch() Well, surely I'm making something stupid but here the problem vgs% cat a.c #include static VALUE a_catch(VALUE val, VALUE args) { return rb_yield(args); } static VALUE a_a(VALUE obj, VALUE a) { return rb_catch_obj(a, a_catch, obj); } static VALUE a_b(VALUE obj, VALUE a) { rb_throw_obj(a, Qnil); return Qnil; } void Init_a() { VALUE c = rb_define_class("A", rb_cObject); rb_define_method(c, "a", a_a, 1); rb_define_method(c, "b", a_b, 1); } vgs% vgs% ruby --disable-gems -vra -e 'a = A.new; catch(:a) { throw(:a) }' ruby 1.9.0 (2007-12-27 revision 0) [i686-linux] vgs% vgs% ruby --disable-gems -vra -e 'a = A.new; catch(:a) { a.b(:a) }' ruby 1.9.0 (2007-12-27 revision 0) [i686-linux] vgs% vgs% ruby --disable-gems -vra -e 'a = A.new; a.a(:a) { throw(:a) }' ruby 1.9.0 (2007-12-27 revision 0) [i686-linux] -- control frame ---------- c:0004 p:---- s:0011 b:0011 l:000010 d:000010 CFUNC :a c:0003 p:0025 s:0007 b:0007 l:000006 d:000006 TOP -e:1 c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH :inherited c:0001 p:0000 s:0002 b:0002 l:000001 d:000001 TOP :17 --------------------------- -- control frame ---------- c:0011 p:---- s:302637054 b:-001 l:000000 d:000000 ------ c:0010 p:---- s:302637054 b:-001 l:000000 d:000000 ------ c:0009 p:---- s:0020 b:0020 l:000019 d:000019 CFUNC :throw c:0008 p:0009 s:0016 b:0016 l:000006 d:000015 BLOCK -e:1 c:0007 p:---- s:0017 b:0017 l:000016 d:000016 FINISH :initialize c:0006 p:---- s:0015 b:0015 l:000010 d:000014 IFUNC :each c:0005 p:---- s:0013 b:0013 l:000012 d:000012 CFUNC :catch c:0004 p:---- s:0011 b:0011 l:000010 d:000010 CFUNC :a c:0003 p:0025 s:0007 b:0007 l:000006 d:000006 TOP -e:1 c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH :inherited c:0001 p:0000 s:0002 b:0002 l:000001 d:000001 TOP :17 --------------------------- -e:1: [BUG] cfp consistency error - call0 ruby 1.9.0 (2007-12-27 revision 0) [i686-linux] -- control frame ---------- c:0006 p:---- s:0015 b:0015 l:000010 d:000014 IFUNC :each c:0005 p:---- s:0013 b:0013 l:000012 d:000012 CFUNC :catch c:0004 p:---- s:0011 b:0011 l:000010 d:000010 CFUNC :a c:0003 p:0025 s:0007 b:0007 l:000006 d:000006 TOP -e:1 c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH :inherited c:0001 p:0000 s:0002 b:0002 l:000001 d:000001 TOP :17 --------------------------- DBG> : "-e:1:in `catch'" DBG> : "-e:1:in `a'" DBG> : "-e:1:in `
'" -- backtrace of native function call (Use addr2line) -- 0x80f0cba 0x810eb9c 0x810ec0b 0x80efe04 0x805d738 0x805da30 0x805dda5 0x805dff1 0x805bf10 0x805bfc7 0xb7d5063e 0x80ef58b 0x80eb000 0x80ee879 0x80eeb9b 0x805cbec 0x80609da 0x805a7d0 0xb7e21050 0x805a701 ------------------------------------------------------- Aborted (core dumped) vgs% Guy Decoux