[ruby-dev:50000] Re: メソッド呼び出し時の引数の値を VM 側で取得する方法について
From:
Tetsuo Handa <penguin-kernel@...>
Date:
2017-03-01 11:28:25 UTC
List:
ruby-dev #50000
SASADA Koichi さんは書きました:
> On 2017/02/28 14:53, Tetsuo Handa wrote:
> > dump_function_entry() 呼び出しを cfp->sp の設定後に移動させてみましたが、
> > 同じ結果でした。 rb_inspect() に渡すことができないオブジェクトが存在するのでしょうか?
>
> うーん、そんなことはないと思うんですが、そういうこともあるのかもしれませ
> ん。これ以上はちゃんとデバッグしないとわかんないっすね...。
>
git のソースに対して同様の処理を試したところ、 core ファイルを取得できました。
以下に事象の再現手順を示します。何か手がかりが得られそうでしょうか?
(1) 普通にコンパイルする。
----------------------------------------
# git clone git://github.com/ruby/ruby.git
# cd ruby/
# autoconf
# ./configure
# make
----------------------------------------
(2) 以下のパッチを当てて再コンパイルする。
----------------------------------------
# patch -p1
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index 9e8ea9c..09b3fb2 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -1503,6 +1503,78 @@ vm_call_iseq_setup_2(rb_thread_t *th, rb_control_frame_t *cfp, struct rb_calling
}
}
+/* ///// */
+VALUE rb_class_path_no_cache(VALUE _klass);
+static void dump_function_entry(rb_thread_t *th, int argc, VALUE *argv)
+{
+ static FILE *fp = NULL;
+ static __thread _Bool dump_recurse = 0;
+ VALUE _klass = 0;
+ VALUE _id = 0;
+ if (dump_recurse)
+ return;
+ dump_recurse = 1;
+ if (!fp)
+ fp = fopen("/tmp/ruby.log", "a");
+ rb_thread_method_id_and_class((th), &_id, 0, &_klass);
+ if (!_klass || !fp) {
+ dump_recurse = 0;
+ return;
+ }
+ if (RB_TYPE_P(_klass, T_ICLASS))
+ _klass = RBASIC(_klass)->klass;
+ else if (FL_TEST(_klass, FL_SINGLETON))
+ _klass = rb_iv_get(_klass, "__attached__");
+ switch (TYPE(_klass)) {
+ case T_CLASS:
+ case T_ICLASS:
+ case T_MODULE:
+ {
+ int i;
+ VALUE _name = rb_class_path_no_cache(_klass);
+ const char *classname = !NIL_P(_name) ? StringValuePtr(_name) : "<unknown>";
+ const char *methodname = rb_id2name(_id);
+ const char *filename = rb_sourcefile();
+ fprintf(fp, "class=%s method=%s filename=%s line=%u argc=%u",
+ classname, methodname, filename, rb_sourceline(), argc);
+ fflush(fp);
+ for (i = 0; i < argc; i++) {
+ VALUE rstr;
+ /*
+ switch (TYPE(argv[i])) {
+ case T_CLASS:
+ case T_FLOAT:
+ case T_STRING:
+ case T_REGEXP:
+ case T_ARRAY:
+ case T_HASH:
+ case T_STRUCT:
+ case T_BIGNUM:
+ case T_DATA:
+ case T_COMPLEX:
+ case T_RATIONAL:
+ case T_SYMBOL:
+ break;
+ default:
+ continue;
+ }
+ */
+ fprintf(fp, " argv[%u,%u]", i, TYPE(argv[i]));
+ fflush(fp);
+ rstr = rb_inspect(argv[i]);
+ fprintf(fp, "=");
+ fflush(fp);
+ fprintf(fp, "%s", StringValueCStr(rstr));
+ fflush(fp);
+ }
+ fprintf(fp, "\n");
+ fflush(fp);
+ break;
+ }
+ }
+ dump_recurse = 0;
+}
+
static inline VALUE
vm_call_iseq_setup_normal(rb_thread_t *th, rb_control_frame_t *cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc,
int opt_pc, int param_size, int local_size)
@@ -1518,6 +1590,7 @@ vm_call_iseq_setup_normal(rb_thread_t *th, rb_control_frame_t *cfp, struct rb_ca
iseq->body->iseq_encoded + opt_pc, sp,
local_size - param_size,
iseq->body->stack_max);
+ dump_function_entry(th, calling->argc, argv);
return Qundef;
}
@@ -1564,6 +1637,7 @@ vm_call_iseq_setup_tailcall(rb_thread_t *th, rb_control_frame_t *cfp, struct rb_
iseq->body->iseq_encoded + opt_pc, sp,
iseq->body->local_table_size - iseq->body->param.size,
iseq->body->stack_max);
+ dump_function_entry(th, calling->argc, argv);
cfp->sp = sp_orig;
RUBY_VM_CHECK_INTS(th);
# ulimit -c unlimited
# make
CC = gcc
LD = ld
LDSHARED = gcc -shared
CFLAGS = -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Werror=implicit-int -Werror=pointer-arith -Werror=write-strings -Werror=declaration-after-statement -Werror=implicit-function-declaration -Werror=deprecated-declarations -Wno-packed-bitfield-compat -Wsuggest-attribute=noreturn -Wsuggest-attribute=format -std=gnu99
XCFLAGS = -D_FORTIFY_SOURCE=2 -fstack-protector -fno-strict-overflow -fvisibility=hidden -fexcess-precision=standard -DRUBY_EXPORT -fPIE
CPPFLAGS = -I. -I.ext/include/x86_64-linux -I./include -I. -I./enc/unicode/9.0.0
DLDFLAGS = -fstack-protector -pie
SOLIBS =
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-11)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
compiling vm.c
linking miniruby
generating encdb.h
/root/ruby/lib/optparse.rb:655: [BUG] Segmentation fault at 0x000000000074f9
ruby 2.5.0dev (2017-03-01 trunk 57751) [x86_64-linux]
-- Control frame information -----------------------------------------------
c:0013 p:---- s:0100 e:000099 CFUNC :to_s
c:0012 p:0000 s:0097 e:000096 METHOD /root/ruby/lib/optparse.rb:655
c:0011 p:0099 s:0092 e:000091 METHOD /root/ruby/lib/optparse.rb:496
c:0010 p:0858 s:0086 E:000868 BLOCK /root/ruby/lib/optparse.rb:1409 [FINISH]
c:0009 p:---- s:0082 e:000081 CFUNC :each
c:0008 p:0101 s:0078 E:002560 METHOD /root/ruby/lib/optparse.rb:1341
c:0007 p:0016 s:0052 e:000050 METHOD /root/ruby/lib/optparse.rb:1466
c:0006 p:0015 s:0044 e:000043 METHOD /root/ruby/lib/optparse.rb:1475
c:0005 p:0014 s:0038 E:001198 BLOCK ./tool/generic_erb.rb:20
c:0004 p:0109 s:0034 e:000033 METHOD /root/ruby/lib/optparse.rb:1062 [FINISH]
c:0003 p:---- s:0027 e:000026 CFUNC :new
c:0002 p:0109 s:0023 E:0024f8 EVAL ./tool/generic_erb.rb:19 [FINISH]
c:0001 p:0000 s:0003 E:000790 (none) [FINISH]
-- Ruby level backtrace information ----------------------------------------
./tool/generic_erb.rb:19:in `<main>'
./tool/generic_erb.rb:19:in `new'
/root/ruby/lib/optparse.rb:1062:in `initialize'
./tool/generic_erb.rb:20:in `block in <main>'
/root/ruby/lib/optparse.rb:1475:in `on'
/root/ruby/lib/optparse.rb:1466:in `define'
/root/ruby/lib/optparse.rb:1341:in `make_switch'
/root/ruby/lib/optparse.rb:1341:in `each'
/root/ruby/lib/optparse.rb:1409:in `block in make_switch'
/root/ruby/lib/optparse.rb:496:in `guess'
/root/ruby/lib/optparse.rb:655:in `incompatible_argument_styles'
/root/ruby/lib/optparse.rb:655:in `to_s'
-- Machine register context ------------------------------------------------
RIP: 0x00007f9ada3f2e88 RBP: 0x00007f9adad1c500 RSP: 0x00007ffc19a801d0
RAX: 0x00000000000074f1 RBX: 0x00007f9adad1c500 RCX: 0x0000000000000000
RDX: 0x000000000000001a RDI: 0x00007f9adad1c500 RSI: 0x00000000000072e1
R8: 0x00007f9ada1e4dd0 R9: 0x0000000000000001 R10: 0x00007ffc19a802e0
R11: 0x0000000000000000 R12: 0x0000000000000008 R13: 0x00007f9adad1c500
R14: 0x00007f9adabab810 R15: 0x0000000000000000 EFL: 0x0000000000010206
-- C level backtrace information -------------------------------------------
/root/ruby/miniruby(rb_vm_bugreport+0x528) [0x7f9ada41bb78] vm_dump.c:683
/root/ruby/miniruby(rb_bug_context+0xd0) [0x7f9ada28fa60] error.c:502
/root/ruby/miniruby(sigsegv+0x3e) [0x7f9ada389d6e] signal.c:907
/lib64/libpthread.so.0 [0x7f9ad9dc6370]
/root/ruby/miniruby(rb_class_name+0x28) [0x7f9ada3f2e88] variable.c:186
/root/ruby/miniruby(rb_mod_to_s+0xf0) [0x7f9ada306990] object.c:1577
/root/ruby/miniruby(vm_call0_body.constprop.140+0x1ca) [0x7f9ada40e9ba] vm_eval.c:131
/root/ruby/miniruby(rb_call0+0x1b8) [0x7f9ada40f7a8] vm_eval.c:61
/root/ruby/miniruby(rb_inspect+0x14) [0x7f9ada306824] object.c:553
/root/ruby/miniruby(dump_function_entry.isra.118+0x198) [0x7f9ada401108] vm_insnhelper.c:1564
/root/ruby/miniruby(vm_call_iseq_setup+0x290) [0x7f9ada401530] vm_insnhelper.c:1593
/root/ruby/miniruby(vm_call_method+0xe3) [0x7f9ada40ce93] vm_insnhelper.c:2376
/root/ruby/miniruby(vm_exec_core+0x2241) [0x7f9ada406591] insns.def:1066
/root/ruby/miniruby(vm_exec+0x87) [0x7f9ada40ab77] vm.c:1705
/root/ruby/miniruby(rb_yield+0x5df) [0x7f9ada4155ff] vm.c:962
/root/ruby/miniruby(rb_ary_each+0x3d) [0x7f9ada21bc3d] array.c:1824
/root/ruby/miniruby(vm_call_cfunc+0xf1) [0x7f9ada3fcd81] vm_insnhelper.c:1836
/root/ruby/miniruby(vm_call_method+0xe3) [0x7f9ada40ce93] vm_insnhelper.c:2376
/root/ruby/miniruby(vm_exec_core+0x2f80) [0x7f9ada4072d0] insns.def:967
/root/ruby/miniruby(vm_exec+0x87) [0x7f9ada40ab77] vm.c:1705
/root/ruby/miniruby(rb_call0+0x1b8) [0x7f9ada40f7a8] vm_eval.c:61
/root/ruby/miniruby(rb_class_s_new+0x21) [0x7f9ada306cd1] object.c:1935
/root/ruby/miniruby(vm_call_cfunc+0xf1) [0x7f9ada3fcd81] vm_insnhelper.c:1836
/root/ruby/miniruby(vm_call_method+0xe3) [0x7f9ada40ce93] vm_insnhelper.c:2376
/root/ruby/miniruby(vm_exec_core+0x2f80) [0x7f9ada4072d0] insns.def:967
/root/ruby/miniruby(vm_exec+0x87) [0x7f9ada40ab77] vm.c:1705
/root/ruby/miniruby(ruby_exec_internal+0xad) [0x7f9ada295b3d] eval.c:244
/root/ruby/miniruby(ruby_run_node+0x2d) [0x7f9ada29907d] eval.c:308
/root/ruby/miniruby(main+0x4b) [0x7f9ada21a13b] addr2line.c:177
-- Other runtime information -----------------------------------------------
* Loaded script: ./tool/generic_erb.rb
* Loaded features:
0 enumerator.so
1 thread.rb
2 rational.so
3 complex.so
4 /root/ruby/lib/cgi/util.rb
5 /root/ruby/lib/erb.rb
6 /root/ruby/lib/optparse.rb
7 /root/ruby/lib/fileutils.rb
8 /root/ruby/tool/vpath.rb
* Process memory map:
7f9ad17fc000-7f9ad1a02000 r--s 00000000 fd:01 67151207 /usr/lib64/libc-2.17.so
7f9ad1a02000-7f9ad2977000 r--s 00000000 fd:01 687169 /root/ruby/miniruby
7f9ad2977000-7f9ad298c000 r-xp 00000000 fd:01 69752800 /usr/lib64/libgcc_s-4.8.5-20150702.so.1
7f9ad298c000-7f9ad2b8b000 ---p 00015000 fd:01 69752800 /usr/lib64/libgcc_s-4.8.5-20150702.so.1
7f9ad2b8b000-7f9ad2b8c000 r--p 00014000 fd:01 69752800 /usr/lib64/libgcc_s-4.8.5-20150702.so.1
7f9ad2b8c000-7f9ad2b8d000 rw-p 00015000 fd:01 69752800 /usr/lib64/libgcc_s-4.8.5-20150702.so.1
7f9ad2b8d000-7f9ad90b6000 r--p 00000000 fd:01 100675358 /usr/lib/locale/locale-archive
7f9ad90b6000-7f9ad90b8000 r-xp 00000000 fd:01 67151197 /usr/lib64/libfreebl3.so
7f9ad90b8000-7f9ad92b7000 ---p 00002000 fd:01 67151197 /usr/lib64/libfreebl3.so
7f9ad92b7000-7f9ad92b8000 r--p 00001000 fd:01 67151197 /usr/lib64/libfreebl3.so
7f9ad92b8000-7f9ad92b9000 rw-p 00002000 fd:01 67151197 /usr/lib64/libfreebl3.so
7f9ad92b9000-7f9ad946f000 r-xp 00000000 fd:01 67151207 /usr/lib64/libc-2.17.so
7f9ad946f000-7f9ad966f000 ---p 001b6000 fd:01 67151207 /usr/lib64/libc-2.17.so
7f9ad966f000-7f9ad9673000 r--p 001b6000 fd:01 67151207 /usr/lib64/libc-2.17.so
7f9ad9673000-7f9ad9675000 rw-p 001ba000 fd:01 67151207 /usr/lib64/libc-2.17.so
7f9ad9675000-7f9ad967a000 rw-p 00000000 00:00 0
7f9ad967a000-7f9ad977a000 r-xp 00000000 fd:01 67151567 /usr/lib64/libm-2.17.so
7f9ad977a000-7f9ad997a000 ---p 00100000 fd:01 67151567 /usr/lib64/libm-2.17.so
7f9ad997a000-7f9ad997b000 r--p 00100000 fd:01 67151567 /usr/lib64/libm-2.17.so
7f9ad997b000-7f9ad997c000 rw-p 00101000 fd:01 67151567 /usr/lib64/libm-2.17.so
7f9ad997c000-7f9ad9984000 r-xp 00000000 fd:01 67151261 /usr/lib64/libcrypt-2.17.so
7f9ad9984000-7f9ad9b83000 ---p 00008000 fd:01 67151261 /usr/lib64/libcrypt-2.17.so
7f9ad9b83000-7f9ad9b84000 r--p 00007000 fd:01 67151261 /usr/lib64/libcrypt-2.17.so
7f9ad9b84000-7f9ad9b85000 rw-p 00008000 fd:01 67151261 /usr/lib64/libcrypt-2.17.so
7f9ad9b85000-7f9ad9bb3000 rw-p 00000000 00:00 0
7f9ad9bb3000-7f9ad9bb5000 r-xp 00000000 fd:01 67151265 /usr/lib64/libdl-2.17.so
7f9ad9bb5000-7f9ad9db5000 ---p 00002000 fd:01 67151265 /usr/lib64/libdl-2.17.so
7f9ad9db5000-7f9ad9db6000 r--p 00002000 fd:01 67151265 /usr/lib64/libdl-2.17.so
7f9ad9db6000-7f9ad9db7000 rw-p 00003000 fd:01 67151265 /usr/lib64/libdl-2.17.so
7f9ad9db7000-7f9ad9dce000 r-xp 00000000 fd:01 67151686 /usr/lib64/libpthread-2.17.so
7f9ad9dce000-7f9ad9fcd000 ---p 00017000 fd:01 67151686 /usr/lib64/libpthread-2.17.so
7f9ad9fcd000-7f9ad9fce000 r--p 00016000 fd:01 67151686 /usr/lib64/libpthread-2.17.so
7f9ad9fce000-7f9ad9fcf000 rw-p 00017000 fd:01 67151686 /usr/lib64/libpthread-2.17.so
7f9ad9fcf000-7f9ad9fd3000 rw-p 00000000 00:00 0
7f9ad9fd3000-7f9ad9ff3000 r-xp 00000000 fd:01 67151200 /usr/lib64/ld-2.17.so
7f9ada0ba000-7f9ada0de000 r--s 00000000 fd:01 67151686 /usr/lib64/libpthread-2.17.so
7f9ada0de000-7f9ada0e5000 r--s 00000000 fd:01 118432 /usr/lib64/gconv/gconv-modules.cache
7f9ada0e5000-7f9ada1ec000 rw-p 00000000 00:00 0
7f9ada1ec000-7f9ada1ed000 rw-p 00000000 00:00 0
7f9ada1ed000-7f9ada1ee000 ---p 00000000 00:00 0
7f9ada1ee000-7f9ada1f2000 rw-p 00000000 00:00 0 [stack:20783]
7f9ada1f2000-7f9ada1f3000 r--p 0001f000 fd:01 67151200 /usr/lib64/ld-2.17.so
7f9ada1f3000-7f9ada1f4000 rw-p 00020000 fd:01 67151200 /usr/lib64/ld-2.17.so
7f9ada1f4000-7f9ada1f5000 rw-p 00000000 00:00 0
7f9ada1f5000-7f9ada4f9000 r-xp 00000000 fd:01 687169 /root/ruby/miniruby
7f9ada6f8000-7f9ada6fd000 r--p 00303000 fd:01 687169 /root/ruby/miniruby
7f9ada6fd000-7f9ada6fe000 rw-p 00308000 fd:01 687169 /root/ruby/miniruby
7f9ada6fe000-7f9ada710000 rw-p 00000000 00:00 0
7f9adab48000-7f9adadf9000 rw-p 00000000 00:00 0 [heap]
7ffc19284000-7ffc19a83000 rw-p 00000000 00:00 0
7ffc19bb8000-7ffc19bba000 r-xp 00000000 00:00 0 [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]
[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html
make: *** [encdb.h] Aborted (core dumped)
# gdb miniruby core.20782
GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-94.el7
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /root/ruby/miniruby...done.
[New LWP 20782]
[New LWP 20783]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Core was generated by `./miniruby -I./lib -I. -I.ext/common ./tool/generic_erb.rb -c -o encdb.h ./temp'.
Program terminated with signal 6, Aborted.
#0 0x00007f9ad92ee1d7 in __GI_raise (sig=sig@entry=6)
at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
56 return INLINE_SYSCALL (tgkill, 3, pid, selftid, sig);
warning: File "/root/ruby/.gdbinit" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load:/usr/bin/mono-gdb.py".
To enable execution of this file add
add-auto-load-safe-path /root/ruby/.gdbinit
line to your configuration file "/root/.gdbinit".
To completely disable this security protection add
set auto-load safe-path /
line to your configuration file "/root/.gdbinit".
For more information about this security protection see the
"Auto-loading safe path" section in the GDB manual. E.g., run from the shell:
info "(gdb)Auto-loading safe path"
(gdb) bt
#0 0x00007f9ad92ee1d7 in __GI_raise (sig=sig@entry=6)
at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#1 0x00007f9ad92ef8c8 in __GI_abort () at abort.c:90
#2 0x00007f9ada28fa6d in die () at error.c:474
#3 rb_bug_context (ctx=ctx@entry=0x7f9adabb7980,
fmt=fmt@entry=0x7f9ada44fcc2 "Segmentation fault at %p") at error.c:504
#4 0x00007f9ada389d6e in sigsegv (sig=<optimized out>, info=0x7f9adabb7ab0, ctx=0x7f9adabb7980)
at signal.c:907
#5 <signal handler called>
#6 0x00007f9ada3f2e88 in classname (permanent=<synthetic pointer>, klass=140303072871680)
at variable.c:186
#7 rb_tmp_class_path (cache_path=0x7f9ada3efa60 <ivar_cache>, permanent=<synthetic pointer>,
klass=140303072871680) at variable.c:262
#8 rb_class_path (klass=140303072871680) at variable.c:298
#9 rb_class_name (klass=klass@entry=140303072871680) at variable.c:446
#10 0x00007f9ada306990 in rb_mod_to_s (klass=140303072871680) at object.c:1577
#11 0x00007f9ada40e9ba in vm_call0_cfunc_with_frame (ci=<optimized out>, cc=<optimized out>,
argv=0x0, calling=<optimized out>, th=0x7f9adab495d0) at vm_eval.c:131
#12 vm_call0_cfunc (argv=0x0, cc=0x7f9adabab810, ci=<optimized out>, calling=0x7ffc19a80230,
th=0x7f9adab495d0) at vm_eval.c:148
#13 vm_call0_body (th=0x7f9adab495d0, calling=calling@entry=0x7ffc19a802f0,
ci=ci@entry=0x7ffc19a802e0, cc=cc@entry=0x7ffc19a80310, argv=argv@entry=0x0) at vm_eval.c:180
#14 0x00007f9ada40f7a8 in vm_call0 (me=<optimized out>, argv=0x0, argc=0, id=2721,
recv=140303072871680, th=<optimized out>) at vm_eval.c:61
#15 rb_call0 (recv=140303072871680, mid=mid@entry=2721, argc=argc@entry=0, argv=argv@entry=0x0,
scope=scope@entry=CALL_FCALL, self=<optimized out>) at vm_eval.c:342
#16 0x00007f9ada4100ca in rb_call (scope=CALL_FCALL, argv=argv@entry=0x0, argc=argc@entry=0,
mid=mid@entry=2721, recv=<optimized out>) at vm_eval.c:852
#17 rb_funcallv (recv=<optimized out>, mid=mid@entry=2721, argc=argc@entry=0, argv=argv@entry=0x0)
at vm_eval.c:853
#18 0x00007f9ada306824 in rb_inspect (obj=<optimized out>) at object.c:553
#19 0x00007f9ada401108 in dump_function_entry (argc=argc@entry=2, argv=<optimized out>,
th=<optimized out>) at vm_insnhelper.c:1564
#20 0x00007f9ada401530 in vm_call_iseq_setup_normal (cfp=<optimized out>, ci=<optimized out>,
cc=<optimized out>, local_size=<optimized out>, param_size=<optimized out>,
opt_pc=<optimized out>, calling=<optimized out>, th=0x7f9adab495d0) at vm_insnhelper.c:1593
#21 vm_call_iseq_setup_2 (ci=<optimized out>, local_size=<optimized out>,
param_size=<optimized out>, opt_pc=<optimized out>, cc=<optimized out>,
calling=<optimized out>, cfp=<optimized out>, th=0x7f9adab495d0) at vm_insnhelper.c:1499
#22 vm_call_iseq_setup (th=0x7f9adab495d0, cfp=<optimized out>, calling=<optimized out>,
ci=<optimized out>, cc=<optimized out>) at vm_insnhelper.c:1491
#23 0x00007f9ada40ce93 in vm_call_method (th=0x7f9adab495d0, cfp=0x7f9ada1e4e00,
calling=<optimized out>, ci=<optimized out>, cc=<optimized out>) at vm_insnhelper.c:2376
#24 0x00007f9ada406591 in vm_exec_core (th=th@entry=0x7f9adab495d0, initial=initial@entry=0)
at insns.def:1066
#25 0x00007f9ada40ab77 in vm_exec (th=th@entry=0x7f9adab495d0) at vm.c:1705
#26 0x00007f9ada4155ff in invoke_block (captured=<optimized out>, opt_pc=<optimized out>,
type=<optimized out>, cref=0x0, self=140303071166360, iseq=0x7f9adace8a20, th=0x7f9adab495d0)
at vm.c:962
#27 invoke_iseq_block_from_c (is_lambda=<optimized out>, splattable=1, cref=0x0,
passed_block_handler=0, argv=0x7ffc19a80a68, argc=1, self=140303071166360,
captured=0x7f9ada1e4ea8, th=0x7f9adab495d0) at vm.c:1007
#28 invoke_block_from_c_splattable (passed_block_handler=<optimized out>,
is_lambda=<optimized out>, cref=<optimized out>, argv=<optimized out>, argc=<optimized out>,
block_handler=<optimized out>, th=<optimized out>) at vm.c:1025
#29 vm_yield (argc=1, argv=0x7ffc19a80a68, th=0x7f9adab495d0) at vm.c:1062
#30 rb_yield_0 (argv=0x7ffc19a80a68, argc=1) at vm_eval.c:1009
#31 rb_yield_1 (val=140303071155360) at vm_eval.c:1015
#32 rb_yield (val=<optimized out>) at vm_eval.c:1025
#33 0x00007f9ada21bc3d in rb_ary_each (ary=140303071153600) at array.c:1824
#34 0x00007f9ada3fcd81 in vm_call_cfunc_with_frame (ci=0x7f9adad00890, cc=<optimized out>,
calling=<optimized out>, reg_cfp=0x7f9ada1e4e90, th=0x7f9adab495d0) at vm_insnhelper.c:1836
#35 vm_call_cfunc (th=0x7f9adab495d0, reg_cfp=0x7f9ada1e4e90, calling=<optimized out>,
ci=0x7f9adad00890, cc=<optimized out>) at vm_insnhelper.c:1931
#36 0x00007f9ada40ce93 in vm_call_method (th=0x7f9adab495d0, cfp=0x7f9ada1e4e90,
calling=<optimized out>, ci=<optimized out>, cc=<optimized out>) at vm_insnhelper.c:2376
#37 0x00007f9ada4072d0 in vm_exec_core (th=th@entry=0x7f9adab495d0, initial=initial@entry=0)
at insns.def:967
#38 0x00007f9ada40ab77 in vm_exec (th=0x7f9adab495d0) at vm.c:1705
#39 0x00007f9ada40e90a in vm_call0_body (th=<optimized out>, calling=calling@entry=0x7ffc19a81190,
ci=ci@entry=0x7ffc19a81180, cc=cc@entry=0x7ffc19a811b0, argv=argv@entry=0x7f9ada0e50d0)
at vm_eval.c:176
#40 0x00007f9ada40f7a8 in vm_call0 (me=<optimized out>, argv=0x7f9ada0e50d0, argc=0, id=3057,
recv=140303071166360, th=<optimized out>) at vm_eval.c:61
#41 rb_call0 (recv=recv@entry=140303071166360, mid=mid@entry=3057, argc=0, argc@entry=3057,
argv=0x7f9ada0e50d0, argv@entry=0x0, scope=scope@entry=CALL_FCALL, self=<optimized out>)
at vm_eval.c:342
#42 0x00007f9ada4100ca in rb_call (scope=CALL_FCALL, argv=argv@entry=0x0, argc=argc@entry=3057,
mid=mid@entry=3057, recv=recv@entry=140303071166360) at vm_eval.c:852
#43 rb_funcallv (recv=recv@entry=140303071166360, mid=mid@entry=3057, argc=argc@entry=0,
argv=argv@entry=0x7f9ada0e50d0) at vm_eval.c:853
#44 0x00007f9ada29a6e3 in rb_obj_call_init (obj=obj@entry=140303071166360, argc=argc@entry=0,
argv=argv@entry=0x7f9ada0e50d0) at eval.c:1425
#45 0x00007f9ada306cd1 in rb_class_s_new (argc=0, argv=0x7f9ada0e50d0, klass=<optimized out>)
at object.c:1935
#46 0x00007f9ada3fcd81 in vm_call_cfunc_with_frame (ci=0x7f9adac73360, cc=<optimized out>,
calling=<optimized out>, reg_cfp=0x7f9ada1e4fb0, th=0x7f9adab495d0) at vm_insnhelper.c:1836
#47 vm_call_cfunc (th=0x7f9adab495d0, reg_cfp=0x7f9ada1e4fb0, calling=<optimized out>,
ci=0x7f9adac73360, cc=<optimized out>) at vm_insnhelper.c:1931
#48 0x00007f9ada40ce93 in vm_call_method (th=0x7f9adab495d0, cfp=0x7f9ada1e4fb0,
calling=<optimized out>, ci=<optimized out>, cc=<optimized out>) at vm_insnhelper.c:2376
#49 0x00007f9ada4072d0 in vm_exec_core (th=th@entry=0x7f9adab495d0, initial=initial@entry=0)
at insns.def:967
#50 0x00007f9ada40ab77 in vm_exec (th=0x7f9adab495d0) at vm.c:1705
#51 0x00007f9ada415b51 in rb_iseq_eval_main (iseq=iseq@entry=0x7f9adab6d1c8) at vm.c:1951
#52 0x00007f9ada295b3d in ruby_exec_internal (n=0x7f9adab6d1c8) at eval.c:244
#53 0x00007f9ada29907d in ruby_exec_node (n=0x7f9adab6d1c8) at eval.c:308
#54 ruby_run_node (n=<optimized out>) at eval.c:300
#55 0x00007f9ada21a13b in main (argc=11, argv=0x7ffc19a81b18) at main.c:36
(gdb)
----------------------------------------
/tmp/ruby.log の最後は以下のようになっていました。
----------------------------------------
class=OptionParser::List method=search filename=/root/ruby/lib/optparse.rb line=825 argc=2 argv[0,20]=:atype argv[1,5]="-t"
class=OptionParser::List method=search filename=/root/ruby/lib/optparse.rb line=825 argc=2 argv[0,20]=:atype argv[1,5]="-t"
class=OptionParser method=search filename=/root/ruby/lib/optparse.rb line=1716 argc=2 argv[0,20]=:atype argv[1,5]="--timestamp[=PATH]"
class=OptionParser method=visit filename=/root/ruby/lib/optparse.rb line=1705 argc=3 argv[0,20]=:search argv[1,7]=[:atype, "--timestamp[=PATH]"] argv[2,12]=#<Proc:0x007f9adab73a78@/root/ruby/lib/optparse.rb:1718>
class=OptionParser::List method=search filename=/root/ruby/lib/optparse.rb line=825 argc=2 argv[0,20]=:atype argv[1,5]="--timestamp[=PATH]"
class=OptionParser::List method=search filename=/root/ruby/lib/optparse.rb line=825 argc=2 argv[0,20]=:atype argv[1,5]="--timestamp[=PATH]"
class=OptionParser::List method=search filename=/root/ruby/lib/optparse.rb line=825 argc=2 argv[0,20]=:atype argv[1,5]="--timestamp[=PATH]"
class=OptionParser method=notwice filename=/root/ruby/lib/optparse.rb line=1264 argc=3 argv[0,2]=NilClass argv[1,17]=nil argv[2,5]="type"
class=OptionParser::Switch method=guess filename=/root/ruby/lib/optparse.rb line=485 argc=1 argv[0,5]="[=PATH]"
class=OptionParser::Switch::NoArgument method=incompatible_argument_styles filename=/root/ruby/lib/optparse.rb line=655 argc=2 argv[0,7]=["[=PATH]", OptionParser::Switch::OptionalArgument] argv[1,26]
----------------------------------------
26 は T_IMEMO なので、 compile.c の dump_object_functions[] が
ibf_dump_object_unsupported となっている種別をスキップするように
してみましたが、他の場所で問題が発生するため、解決策になっていませんでした。