朝っぱらから SEGV だし……。 えーと、
C = Struct.new(:a,:b,:c,:d, :e,:f,:g,:h, :i,:j,:k,:l) c = C.new(0,0,0,0, 0,0,0,0, 0,0,0,0) c.k
これで死亡か。やだなあ。
バックトーレス
(gdb) bt #0 0x00000000 in ?? () #1 0x0805f4e9 in rb_call0 (klass=1075345696, recv=1075355776, id=10497, oid=2, argc=0, argv=0x0, body=0x400092c4, nosuper=-1073745676) at ../../src/ruby/eval.c:5549 #2 0x0806014e in rb_call (klass=1075505016, recv=1075503856, mid=10497, argc=0, argv=0x0, scope=0) at ../../src/ruby/eval.c:5911 #3 0x0805b78e in rb_eval (self=1075571216, n=0x0) at ../../src/ruby/ruby.h:641 #4 0x08069b05 in ruby_exec_internal () at ../../src/ruby/eval.c:1528 #5 0x08069b26 in ruby_exec () at ../../src/ruby/eval.c:1549 #6 0x08069d30 in ruby_run () at ../../src/ruby/eval.c:1566 #7 0x08053c98 in main () at ../../src/ruby/main.c:38 #8 0x400874ad in __libc_start_main () from /lib/libc.so.6
……なんか変な感じ
(gdb) f 1 #1 0x0805f4e9 in rb_call0 (klass=1075345696, recv=1075355776, id=10497, oid=2, argc=0, argv=0x0, body=0x400092c4, nosuper=-1073745676) at ../../src/ruby/eval.c:5549 5549 case 0: (gdb) list 5544 return (*func)(recv, rb_ary_new4(argc, argv)); 5545 break; 5546 case -1: 5547 return (*func)(argc, argv, recv); 5548 break; 5549 case 0: 5550 return (*func)(recv); 5551 break; 5552 case 1: 5553 return (*func)(recv, argv[0]); (gdb) p func No symbol "func" in current context.
は? しかもこれは call_cfunc() の中に見えるんですが。
あー……そうか、static inline なのね。 しかも gcc 3.4 を入れていたような気がする。 そういうことか。めんどくさいので gcc を 2.95 に戻して回避だ!
/d/rsrc/Ci-delta6 % ruby t aamine@harmony t:3: [BUG] Segmentation fault ruby 1.9.0 (2005-05-26) [i686-linux] zsh: 19877 abort (core dumped) ruby t
な お ら な い
ちょっと待ってよー、なんなんだよこれ。 inline 取ってもなおらないどころか -O0 にしても起こるし。 コンパイラじゃないのか。
GC を止めても起きる。ますます嫌だ。
/d/rsrc/Ci-delta6 % gdb /d/obj/ruby/ruby aamine@harmony GNU gdb 5.2.1 Copyright 2002 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i686-pc-linux-gnu"... (gdb) run t Starting program: /d/obj/ruby/ruby t Program received signal SIGSEGV, Segmentation fault. 0x00000000 in ?? () (gdb) bt #0 0x00000000 in ?? () #1 0x0805db79 in call_cfunc (func=0, recv=1075503856, len=0, argc=0, argv=0x0) at ../../src/ruby/eval.c:5550 #2 0x0805e242 in rb_call0 (klass=1075505016, recv=1075503856, id=10497, oid=10497, argc=0, argv=0x0, body=0x401ae390, nosuper=0) at ../../src/ruby/eval.c:5689 #3 0x0805eaf9 in rb_call (klass=1075505016, recv=1075503856, mid=10497, argc=0, argv=0x0, scope=0) at ../../src/ruby/eval.c:5911 #4 0x080594bf in rb_eval (self=1075571216, n=0x401ae804) at ../../src/ruby/eval.c:3334 #5 0x0805553d in eval_node (self=1075571216, node=0x401ae804) at ../../src/ruby/eval.c:1350 #6 0x08055aae in ruby_exec_internal () at ../../src/ruby/eval.c:1528 #7 0x08055b07 in ruby_exec () at ../../src/ruby/eval.c:1549 #8 0x08055b46 in ruby_run () at ../../src/ruby/eval.c:1566 #9 0x08053d36 in Letext () at ../../src/ruby/main.c:38 #10 0x400874ad in __libc_start_main () from /lib/libc.so.6 (gdb) f 1 #1 0x0805db79 in call_cfunc (func=0, recv=1075503856, len=0, argc=0, argv=0x0) at ../../src/ruby/eval.c:5550 5550 return (*func)(recv); (gdb) p func $1 = (VALUE (*)()) 0
うお……。なんで func が NULL になってんだ
(gdb) p *body $3 = {flags = 98847, nd_file = 0x813e2e1 "t", u1 = {node = 0x0, id = 0, value = 0, cfunc = 0, tbl = 0x0}, u2 = {node = 0x0, id = 0, argc = 0, value = 0}, u3 = {node = 0x0, id = 0, state = 0, entry = 0x0, cnt = 0, value = 0}}
body がまっ白になってらっしゃいます。
うーん。Struct のほうから攻略してみよう。
これか―――――――っ!
--- struct.c 18 Apr 2005 06:38:30 -0000 1.63 +++ struct.c 27 May 2005 23:24:04 -0000 @@ -132,7 +132,7 @@ static VALUE rb_struct_ref8(obj) VALUE obj; {return RSTRUCT(obj)->ptr[8];} static VALUE rb_struct_ref9(obj) VALUE obj; {return RSTRUCT(obj)->ptr[9];} -static VALUE (*ref_func[10])() = { +static VALUE (*ref_func[])() = { rb_struct_ref0, rb_struct_ref1, rb_struct_ref2, @@ -211,7 +211,7 @@ for (i=0; i< RARRAY(members)->len; i++) { ID id = SYM2ID(RARRAY(members)->ptr[i]); if (rb_is_local_id(id) || rb_is_const_id(id)) { - if (i<sizeof(ref_func)) { + if (i < sizeof(ref_func) / sizeof(VALUE (*)())) { rb_define_method_id(nstr, id, ref_func[i], 0); } else {
(08:41)
Copyright (c) 2002-2007 青木峰郎 / Minero Aoki. All rights reserved.