#include "ruby.h"
int main(int argc, char **argv)
{
int state = 0;
NtInitialize(&argc, &argv);
RUBY_INIT_STACK;
ruby_init();
ruby_script("embedded");
rb_eval_string_protect("puts 'Hello World'", &state);
return 0;
}
This works perfectly in Ruby 1.8, but crashes in Ruby 1.9 inside
rb_eval_string_protect. It crashes on line 1703 in eval.c (using the
latest source from svn as of today, or 2007/09/17):
rb_control_frame_t *cfp = vm_get_ruby_level_cfp(th, th->cfp);
th->base_block = RUBY_VM_GET_BLOCK_PTR_IN_CFP(cfp);
th->base_block->iseq = cfp->iseq; // Crashes here because cfp is NULL
The problem is caused by vm_get_ruby_level_cfp() returning NULL. That
function passes once through its loop, but
RUBY_VM_NORMAL_ISEQ_P(cfp->iseq) is returning false. it works fine if I load/run a file.
|