From: Katsuyuki Komatsu Date: 2000-10-14T23:40:33+09:00 Subject: [ruby-dev:11214] Re: Thread.new with irb (PR#20) 小松です. In the message of "Re: Thread.new with irb (PR#20)" on 2000/10/14 03:40 matz@zetabits.com (Yukihiro Matsumoto) wrote: |--- eval.c 2000/10/13 09:01:53 1.119 |+++ eval.c 2000/10/13 18:39:51 |@@ -7675,3 +7674,2 @@ | th->gid = 1;\ |- th->locals = 0;\ | } while(0) ここでth->localsの初期化がないと,以下の操作で変なところに アクセスして落ちてしましました.削らないほうがよいと思います. % ruby -v ruby 1.6.2 (2000-10-12) [sparc-solaris2.5.1] % irb irb(main):001:0> Thread.new ThreadError: must be called with a block (irb):1:in `initialize' (irb):1:in `new' (irb):1:in `irb_binding' irb(main):002:0> quit 異常終了 (コアダンプしました。) % gdb 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 "sparc-sun-solaris2.5.1"... (gdb) run /usr/local/bin/irb Starting program: /usr/local/bin/ruby /usr/local/bin/irb irb(main):001:0> Thread.new ThreadError: must be called with a block (irb):1:in `initialize' (irb):1:in `new' (irb):1:in `irb_binding' irb(main):002:0> quit Program received signal SIGSEGV, Segmentation fault. st_free_table (table=0x68) at ../st.c:212 212 for(i = 0; i <= table->num_bins; i++) { (gdb) bt #0 st_free_table (table=0x68) at ../st.c:212 #1 0xef6b75d4 in thread_free (th=0x86fa8) at ../eval.c:6717 #2 0xef6c18b8 in rb_gc_call_finalizer_at_exit () at ../gc.c:1238 #3 0xef6a6470 in ruby_run () at ../eval.c:1152 #4 0x10eec in main (argc=0, argv=0xeffff754, envp=0xeffff760) at ../main.c:80 (gdb) print table $1 = (st_table *) 0x68 (gdb) up #1 0xef6b75d4 in thread_free (th=0x86fa8) at ../eval.c:6717 6717 if (th->locals) st_free_table(th->locals); (gdb) print th $2 = 0x86fa8 (gdb) print *th $3 = {next = 0x0, prev = 0x0, context = {0, -268461800, -278159900, -268461680, -278201644, 673343858, 1646273907, 673542953, 573317234, 1982603328, 1279349588, 1599426628}, result = 0, stk_len = 6164, stk_max = 6164, stk_ptr = 0x0, stk_pos = 0xefff96a0, frame = 0xefff9af0, scope = 0xd6968, dyna_vars = 0x0, block = 0x0, iter = 0xefff9b20, tag = 0xefff9f28, klass = 380816, wrapper = 0, flags = 0, file = 0xdd220 "(irb)", line = 1, tracing = 0, errinfo = 4, last_status = 4, last_line = 4, last_match = 4, safe = 0, status = THREAD_RUNNABLE, wait_for = 0, fd = 0, readfds = {fds_bits = {0 }}, writefds = {fds_bits = {0 }}, exceptfds = {fds_bits = { 0 }}, select_value = 1229801812, delay = 0, join = 0x0, abort = 0, priority = 0, gid = 1, locals = 0x68, thread = 796560} (gdb) quit The program is running. Exit anyway? (y or n) y % -- 小松克行 / Katsuyuki Komatsu