東芝の田中です。

On Tue, 21 Jul 1998, Yukihiro Matsumoto wrote:

> した.うちでは再現しないんですよね.web2がないので適当なファ
> イルで試したのがいけないのかも.SEGVしたst_lookupの中で
>   (gdb) p *table
> した結果とか,その上のsearch_methodで
>   (gdb) p *(struct RClass*)klass
> した結果とかを見せて頂けませんか?

もっと簡単な再現パタン(1つのスクリプトで閉じているような)を
作れればいいのでしょうけど・・・

とりあえず構造体の中身を印刷してみました。
よろしくお願いいたします。

(gdb) run aho.rb
Starting program: /usr/local/bin/ruby aho.rb

Program received signal SIGSEGV, Segmentation fault.
0x3d29e in st_lookup (table=0x445090, 
    key=0xb41 <Error reading address 0xb41: Invalid argument>, 
    value=0xefbfd1c4) at st.c:134
134         hash_val = do_hash(key, table);
(gdb) bt
#0  0x3d29e in st_lookup (table=0x445090, 
    key=0xb41 <Error reading address 0xb41: Invalid argument>, 
    value=0xefbfd1c4) at st.c:134
#1  0x16c2 in search_method (klass=4314848, id=2881, origin=0xefbfd1ec)
    at eval.c:136
#2  0x170a in rb_get_method_body (klassp=0xefbfd220, idp=0xefbfd214, 
    noexp=0xefbfd210) at eval.c:157
#3  0x8265 in rb_call (klass=4314848, recv=4314868, mid=2881, argc=0, 
    argv=0x0, scope=1) at eval.c:3634
#4  0x8421 in rb_funcall (recv=4314868, mid=2881, n=0) at eval.c:3723
#5  0x10f78 in any_hash (a=4314868, mod=21343) at hash.c:101
#6  0x3d5b6 in rehash (table=0xa7f20) at st.c:243
#7  0x3d383 in st_insert (table=0xa7f20, key=0x40719c "\a\030", 
    value=0x1 <Error reading address 0x1: Invalid argument>) at st.c:177
#8  0x116f5 in hash_aset (hash=536784, key=4223408, val=1) at hash.c:486
#9  0x7aab in rb_call0 (klass=559624, recv=536784, id=333, argc=2, 
    argv=0xefbfd3c8, body=0x88788, nosuper=1) at eval.c:3382
#10 0x82f0 in rb_call (klass=559624, recv=536784, mid=333, argc=2, 
    argv=0xefbfd3c8, scope=0) at eval.c:3649
#11 0x4ce8 in rb_eval (self=581864, node=0x83198) at eval.c:1999
#12 0x4026 in rb_eval (self=581864, node=0x83148) at eval.c:1717
#13 0x3d46 in rb_eval (self=581864, node=0x83120) at eval.c:1608
#14 0x251a in eval_node (self=581864) at eval.c:925
#15 0x264d in ruby_run () at eval.c:955
#16 0x1611 in main (argc=2, argv=0xefbfd9e0, envp=0xefbfd9ec) at main.c:32
(gdb) p *table
$1 = {type = 0x72616966, num_bins = 10, num_entries = 0, bins = 0x0}
(gdb) up
#1  0x16c2 in search_method (klass=4314848, id=2881, origin=0xefbfd1ec)
    at eval.c:136
136         while (!st_lookup(RCLASS(klass)->m_tbl, id, &body)) {
(gdb) p *(struct RClass*)klass
$2 = {basic = {flags = 0, klass = 4314828}, iv_tbl = 0x5, m_tbl = 0x445090, 
  super = 0}
(gdb) down
#0  0x3d29e in st_lookup (table=0x445090, 
    key=0xb41 <Error reading address 0xb41: Invalid argument>, 
    value=0xefbfd1c4) at st.c:134
134         hash_val = do_hash(key, table);
(gdb) info locals
table = (st_table *) 0x445090
key = 0xb41 <Error reading address 0xb41: Invalid argument>
hash_val = 366380
ptr = (st_table_entry *) 0x41d6e0
(gdb) up
#1  0x16c2 in search_method (klass=4314848, id=2881, origin=0xefbfd1ec)
    at eval.c:136
136         while (!st_lookup(RCLASS(klass)->m_tbl, id, &body)) {
(gdb) info locals
klass = 4314848
id = 2881
body = (NODE *) 0x476000
(gdb)