Segmentation fault at raise exception.

O

O01eg Oleg

I get segfault at any Ruby exception with C API:

(gdb) bt
#0 0x00007ffff58ebd78 in siglongjmp () from /lib/libc.so.6
#1 0x00007ffff719d3e7 in rb_longjmp (tag=6, mesg=6652280) at eval.c:442
#2 0x00007ffff719d422 in rb_exc_raise (mesg=6652280) at eval.c:453
#3 0x00007ffff719a380 in rb_raise (exc=6723760,
fmt=0x7ffff72dc28c "no such file to load -- %s") at error.c:1172

It's caused because GET_THREAD()->tag equal to 0x0.
 
O

O01eg Oleg

It's a initialization code:

int ruby_argc = 1;
char* ruby_argv[ruby_argc];
ruby_argv[0] = "";
char** r_argv = ruby_argv;
Logger::Instance().Log(L"Ruby starting");
ruby_sysinit(&ruby_argc, &r_argv);
Logger::Instance().Log(L"Ruby: Call RUBY_INIT_STACK");
RUBY_INIT_STACK;
Logger::Instance().Log(L"Ruby: Call ruby_init");
ruby_init();
Logger::Instance().Log(L"Ruby: Call ruby_init_loadpath");
ruby_init_loadpath();
Logger::Instance().Log(L"Ruby started");
 
O

O01eg Oleg

Yukihiro said:
You have to wrap every call for Ruby related (possibly exception
raising) functions, e.g. rb_require, rb_eval_string, etc.

Can I use

PUSH_TAG;
rb_requir(...)
rb_eval_string(...)
POP_TAG;

instead

PUSH_TAG;
rb_require(...)
POP_TAG;
PUSH_TAG;
rb_eval_string(...)
POP_TAG;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top