[ruby-dev:7921] Re: SEGV at st.c
From:
Kazuhiro Yoshida <moriq@...2.seikyou.ne.jp>
Date:
1999-09-26 05:47:24 UTC
List:
ruby-dev #7921
もりきゅうです.
Yukihiro Matsumoto さんは書きました:
> * gdbのwhereの出力を付ける
したに貼りつけました.
> * 再現するスクリプトをメールする
http://www.users.yun.co.jp/~moriq/ruby/ruby-xlib-0.6.1.tar.gz
を make して,テキストエディット部分をクリックしてスペースキー
を押しっぱなしにすると再現するはず.
>のいずれかまたは両方を行ってください。もちろん第3の選択肢で
>ある「自分でデバッグしてパッチを送る」というのもアリです。
はう.
リンクトリストのしっぽを NULL じゃなくて table->tail とかに
すると直るかも,と思いました.
--
(gdb) run -Ilib sample/hscrable.rb
Starting program: /usr/local/bin/ruby -Ilib sample/hscrable.rb
Program received signal SIGSEGV, Segmentation fault.
st_free_table (table=0x105f80) at st.c:185
185 next = ptr->next;
(gdb) where
#0 st_free_table (table=0x105f80) at st.c:185
#1 0x58778 in rb_free_generic_ivar (obj=518308) at variable.c:819
#2 0x13446 in obj_free (obj=518308) at gc.c:743
#3 0x132b7 in gc_sweep () at gc.c:676
#4 0x138da in rb_gc () at gc.c:955
#5 0x12859 in rb_newobj () at gc.c:279
#6 0x1d51 in new_dvar (id=0, value=0, prev=0x0) at eval.c:499
#7 0x7dc9 in rb_yield_0 (val=596008, self=0, klass=0, acheck=0) at eval.c:3195
#8 0x80c5 in rb_yield (val=596008) at eval.c:3266
#9 0x5a35b in rb_ary_each (ary=503868) at array.c:557
#10 0x90a7 in call_cfunc (func=0x5a340 <rb_ary_each>, recv=503868, len=0,
argc=0, argv=0x0) at eval.c:3716
#11 0x958a in rb_call0 (klass=680368, recv=503868, id=3497, argc=0, argv=0x0,
body=0xa5e54, nosuper=1) at eval.c:3852
#12 0x9c20 in rb_call (klass=680368, recv=503868, mid=3497, argc=0, argv=0x0,
scope=0) at eval.c:4048
#13 0x597c in rb_eval (self=597208, node=0x7d42c) at eval.c:2222
#14 0x4c93 in rb_eval (self=597208, node=0x7cf68) at eval.c:1968
#15 0x453e in rb_eval (self=597208, node=0x7cf40) at eval.c:1756
#16 0x98c1 in rb_call0 (klass=511428, recv=597208, id=9265, argc=0,
argv=0xefbf9de0, body=0x7d83c, nosuper=0) at eval.c:3956
#17 0x9c20 in rb_call (klass=511428, recv=597208, mid=9265, argc=1,
argv=0xefbf9ddc, scope=0) at eval.c:4048
#18 0x597c in rb_eval (self=596948, node=0x88250) at eval.c:2222
#19 0x453e in rb_eval (self=596948, node=0x88110) at eval.c:1756
#20 0x98c1 in rb_call0 (klass=556028, recv=596948, id=9265, argc=0, argv=0x0,
body=0x88110, nosuper=0) at eval.c:3956
#21 0x9c20 in rb_call (klass=556028, recv=596948, mid=9265, argc=0, argv=0x0,
scope=2) at eval.c:4048
#22 0x597c in rb_eval (self=596948, node=0x88ee4) at eval.c:2222
#23 0x98c1 in rb_call0 (klass=556028, recv=596948, id=9780, argc=0,
argv=0xefbfa6d4, body=0x88f20, nosuper=0) at eval.c:3956
#24 0x9c20 in rb_call (klass=556028, recv=596948, mid=9780, argc=1,
argv=0xefbfa6d0, scope=0) at eval.c:4048
#25 0x597c in rb_eval (self=596948, node=0x89290) at eval.c:2222
#26 0x453e in rb_eval (self=596948, node=0x89254) at eval.c:1756
#27 0x98c1 in rb_call0 (klass=556028, recv=596948, id=9825, argc=0,
argv=0xefbfac74, body=0x89268, nosuper=0) at eval.c:3956
#28 0x9c20 in rb_call (klass=556028, recv=596948, mid=9825, argc=1,
argv=0xefbfac70, scope=1) at eval.c:4048
#29 0x597c in rb_eval (self=596948, node=0x89b14) at eval.c:2222
#30 0x453e in rb_eval (self=596948, node=0x89aec) at eval.c:1756
#31 0x98c1 in rb_call0 (klass=556028, recv=596948, id=8817, argc=0,
argv=0xefbfb218, body=0x8c79c, nosuper=0) at eval.c:3956
#32 0x9c20 in rb_call (klass=556028, recv=596948, mid=8817, argc=1,
argv=0xefbfb214, scope=1) at eval.c:4048
#33 0x597c in rb_eval (self=596948, node=0x996b8) at eval.c:2222
#34 0x98c1 in rb_call0 (klass=625588, recv=596948, id=9241, argc=0,
argv=0xefbfb56c, body=0x9967c, nosuper=0) at eval.c:3956
#35 0x9c20 in rb_call (klass=625588, recv=596948, mid=9241, argc=1,
argv=0xefbfb568, scope=0) at eval.c:4048
#36 0x597c in rb_eval (self=652488, node=0x9b5bc) at eval.c:2222
#37 0x7f7b in rb_yield_0 (val=596948, self=652488, klass=0, acheck=0)
at eval.c:3226
#38 0x80c5 in rb_yield (val=596948) at eval.c:3266
#39 0x5a35b in rb_ary_each (ary=592968) at array.c:557
#40 0x90a7 in call_cfunc (func=0x5a340 <rb_ary_each>, recv=592968, len=0,
argc=0, argv=0x0) at eval.c:3716
#41 0x958a in rb_call0 (klass=680368, recv=592968, id=3497, argc=0, argv=0x0,
body=0xa5e54, nosuper=1) at eval.c:3852
#42 0x9c20 in rb_call (klass=680368, recv=592968, mid=3497, argc=0, argv=0x0,
scope=0) at eval.c:4048
#43 0x597c in rb_eval (self=652488, node=0x9b6fc) at eval.c:2222
#44 0x4c93 in rb_eval (self=652488, node=0x9b558) at eval.c:1968
#45 0x98c1 in rb_call0 (klass=595988, recv=652488, id=8817, argc=0,
argv=0xefbfbf44, body=0x9b508, nosuper=0) at eval.c:3956
#46 0x9c20 in rb_call (klass=595988, recv=652488, mid=8817, argc=1,
argv=0xefbfbf40, scope=1) at eval.c:4048
#47 0x597c in rb_eval (self=652488, node=0x996b8) at eval.c:2222
#48 0x98c1 in rb_call0 (klass=625588, recv=652488, id=9241, argc=0,
argv=0xefbfc298, body=0x9967c, nosuper=0) at eval.c:3956
#49 0x9c20 in rb_call (klass=625588, recv=652488, mid=9241, argc=1,
argv=0xefbfc294, scope=0) at eval.c:4048
#50 0x597c in rb_eval (self=598668, node=0x9b5bc) at eval.c:2222
#51 0x7f7b in rb_yield_0 (val=652488, self=598668, klass=0, acheck=0)
at eval.c:3226
#52 0x80c5 in rb_yield (val=652488) at eval.c:3266
#53 0x5a35b in rb_ary_each (ary=592888) at array.c:557
#54 0x90a7 in call_cfunc (func=0x5a340 <rb_ary_each>, recv=592888, len=0,
argc=0, argv=0x0) at eval.c:3716
#55 0x958a in rb_call0 (klass=680368, recv=592888, id=3497, argc=0, argv=0x0,
body=0xa5e54, nosuper=1) at eval.c:3852
#56 0x9c20 in rb_call (klass=680368, recv=592888, mid=3497, argc=0, argv=0x0,
scope=0) at eval.c:4048
#57 0x597c in rb_eval (self=598668, node=0x9b6fc) at eval.c:2222
#58 0x4c93 in rb_eval (self=598668, node=0x9b558) at eval.c:1968
#59 0x98c1 in rb_call0 (klass=620588, recv=598668, id=8817, argc=0,
argv=0xefbfcc70, body=0x9b508, nosuper=0) at eval.c:3956
#60 0x9c20 in rb_call (klass=620588, recv=598668, mid=8817, argc=1,
argv=0xefbfcc6c, scope=1) at eval.c:4048
#61 0x9df9 in rb_funcall (recv=598668, mid=8817, n=1) at eval.c:4122
#62 0x811dc34 in ?? () from /usr/local/pub/src/ruby-xlib/./xlib.so
#63 0x811dc7d in ?? () from /usr/local/pub/src/ruby-xlib/./xlib.so
#64 0x811e90c in ?? () from /usr/local/pub/src/ruby-xlib/./xlib.so
#65 0x90a7 in call_cfunc (func=0x811e6f4 <end+52292>, recv=511128, len=0,
argc=0, argv=0x0) at eval.c:3716
#66 0x958a in rb_call0 (klass=645248, recv=511128, id=8361, argc=0, argv=0x0,
body=0x9d7b8, nosuper=1) at eval.c:3852
#67 0x9c20 in rb_call (klass=645248, recv=511128, mid=8361, argc=0, argv=0x0,
scope=0) at eval.c:4048
#68 0x597c in rb_eval (self=700108, node=0x9eab4) at eval.c:2222
#69 0x49a3 in rb_eval (self=700108, node=0x9eaa0) at eval.c:1904
#70 0x98c1 in rb_call0 (klass=703768, recv=700108, id=8289, argc=0, argv=0x0,
body=0x9ea78, nosuper=0) at eval.c:3956
#71 0x9c20 in rb_call (klass=703768, recv=700108, mid=8289, argc=0, argv=0x0,
scope=2) at eval.c:4048
#72 0x597c in rb_eval (self=700108, node=0x9f5e0) at eval.c:2222
#73 0x290c in eval_node (self=700108) at eval.c:1003
#74 0x2a78 in ruby_run () at eval.c:1039
#75 0x15d1 in main (argc=3, argv=0xefbfd8f8, envp=0xefbfd908) at main.c:39
(gdb) list
180 int i;
181
182 for(i = 0; i < table->num_bins; i++) {
183 ptr = table->bins[i];
184 while (ptr != 0) {
185 next = ptr->next;
186 free(ptr);
187 ptr = next;
188 }
189 }
(gdb) print i
$1 = 0
(gdb) print table->num_bins
$2 = 11
(gdb) print ptr->key
Error accessing memory address 0x64697744: Invalid argument.
(gdb) print table->num_entries
$3 = 1
(gdb) q
----
Kazuhiro Yoshida moriq@ma2.seikyou.ne.jp