永井@知能.九工大です.

From: Hidetoshi NAGAI <nagai / ai.kyutech.ac.jp>
Subject: [ruby-dev:22393] Re: Tk.callback_break causes seg-fault or hang-up
Date: Thu, 25 Dec 2003 00:57:23 +0900
Message-ID: <20031225.005722.74721625.nagai / ai.kyutech.ac.jp>
> 簡単なテストスクリプトです.
> -----------------------------------------------------------
> require 'tk'
> b = TkButton.new(:command=>proc{p 'never print me'}).pack
> b.bind('Button-1', proc{p 'clicked!'; Tk.callback_break})
> Tk.mainloop
> -----------------------------------------------------------

こちらではやや発生させづらいようですが,ssh を介したリモート環境で
gdb で動かそうとすると表示以前に以下のようになってしまいました.
[ruby-talk:88781] からのレポートも続いていますが,
この環境では [ruby-talk:88781] のサンプルも同じ場所で止ります.
-----------------------------------------------------------
$ cat ~/xxx.rb
require 'tk'
b = TkButton.new(:command=>proc{p 'never print me'}).pack
b.bind('Button-1', proc{p 'clicked!'; Tk.callback_break})
Tk.mainloop
$ gdb /usr/local/bin/ruby 
GNU gdb 5.0
Copyright 2000 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 "i386-redhat-linux"...
(gdb) r ~/xxx.rb
Starting program: /usr/local/bin/ruby ~/xxx.rb
[New Thread 1024 (LWP 3174)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1024 (LWP 3174)]
rb_newobj () at gc.c:379
379         freelist = freelist->as.free.next;
(gdb) bt
#0  rb_newobj () at gc.c:379
#1  0x080911ff in rb_node_newnode (type=NODE_FCALL, a0=0, a1=11825, 
    a2=1075534024) at parse.y:4421
#2  0x08092981 in new_fcall (m=11825, a=0x401b58c8) at parse.y:5487
#3  0x08089333 in ruby_yyparse () at parse.y:1775
#4  0x0808a890 in yycompile (f=0x8122eb8 "/usr/local/lib/ruby/1.8/tk.rb", 
    line=1) at parse.y:2543
#5  0x0808aae8 in rb_compile_file (
    f=0x8122eb8 "/usr/local/lib/ruby/1.8/tk.rb", file=1075661964, start=1)
    at parse.y:2635
#6  0x080a7865 in load_file (fname=0x8122eb8 "/usr/local/lib/ruby/1.8/tk.rb", 
    script=0) at ruby.c:903
#7  0x080a78c7 in rb_load_file (
    fname=0x8122eb8 "/usr/local/lib/ruby/1.8/tk.rb") at ruby.c:920
#8  0x0805e201 in rb_load (fname=1075662004, wrap=0) at eval.c:5920
#9  0x0805eb68 in rb_require_safe (fname=1075662224, safe=0) at eval.c:6197
#10 0x0805e713 in rb_f_require (obj=1075726624, fname=1075662224)
    at eval.c:6078
#11 0x0805c1eb in rb_call0 (klass=1075731624, recv=1075726624, id=9537, 
    oid=9537, argc=1, argv=0xbfffeb74, body=0x401d680c, nosuper=0)
    at eval.c:4938
#12 0x0805cce6 in rb_call (klass=1075731624, recv=1075726624, mid=9537, 
    argc=1, argv=0xbfffeb74, scope=1) at eval.c:5287
#13 0x08057a4c in rb_eval (self=1075726624, n=0x401d4fd4) at eval.c:3091
#14 0x08053878 in eval_node (self=1075726624, node=0x401d4fd4) at eval.c:1267
#15 0x08053da6 in ruby_exec () at eval.c:1436
#16 0x08053e05 in ruby_run () at eval.c:1457
#17 0x080521d2 in Letext () at main.c:50
#18 0x400a613f in __libc_start_main (main=0x80521b0 <main>, argc=2, 
    ubp_av=0xbffff814, init=0x8051574 <_init>, fini=0x80c5ee0 <_fini>, 
    rtld_fini=0x4000c770 <_dl_fini>, stack_end=0xbffff80c)
    at ../sysdeps/generic/libc-start.c:129
(gdb) 
-----------------------------------------------------------
何かヒントになるでしょうか.

-- 
                                         永井 秀利 (九工大 知能情報)
                                             nagai / ai.kyutech.ac.jp