mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 16:44:01 +02:00
* eval.c, vm.c, vm_eval.c, vm_insnhelper.c: fix issues about
return and c-return trace. This issue skips (c-)return event with global jump such as break or return. This fix make vm invoke hooks at stack rewind timing. fix [ruby-core:27606] [Bug #2610]. * test/ruby/test_settracefunc.rb: add a test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26395 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
2979842520
commit
618445576f
6 changed files with 121 additions and 40 deletions
25
eval.c
25
eval.c
|
@ -352,11 +352,10 @@ rb_frozen_class_p(VALUE klass)
|
|||
NORETURN(static void rb_longjmp(int, volatile VALUE));
|
||||
|
||||
static void
|
||||
rb_longjmp(int tag, volatile VALUE mesg)
|
||||
setup_exception(rb_thread_t *th, int tag, volatile VALUE mesg)
|
||||
{
|
||||
VALUE at;
|
||||
VALUE e;
|
||||
rb_thread_t *th = GET_THREAD();
|
||||
const char *file;
|
||||
volatile int line = 0;
|
||||
|
||||
|
@ -425,10 +424,15 @@ rb_longjmp(int tag, volatile VALUE mesg)
|
|||
rb_trap_restore_mask();
|
||||
|
||||
if (tag != TAG_FATAL) {
|
||||
EXEC_EVENT_HOOK(th, RUBY_EVENT_RAISE, th->cfp->self,
|
||||
0 /* TODO: id */, 0 /* TODO: klass */);
|
||||
EXEC_EVENT_HOOK(th, RUBY_EVENT_RAISE, th->cfp->self, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
rb_longjmp(int tag, volatile VALUE mesg)
|
||||
{
|
||||
rb_thread_t *th = GET_THREAD();
|
||||
setup_exception(th, tag, mesg);
|
||||
rb_thread_raised_clear(th);
|
||||
JUMP_TAG(tag);
|
||||
}
|
||||
|
@ -559,9 +563,18 @@ void
|
|||
rb_raise_jump(VALUE mesg)
|
||||
{
|
||||
rb_thread_t *th = GET_THREAD();
|
||||
rb_control_frame_t *cfp = th->cfp;
|
||||
VALUE klass = cfp->me->klass;
|
||||
VALUE self = cfp->self;
|
||||
ID mid = cfp->me->called_id;
|
||||
|
||||
th->cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(th->cfp);
|
||||
/* TODO: fix me */
|
||||
rb_longjmp(TAG_RAISE, mesg);
|
||||
|
||||
setup_exception(th, TAG_RAISE, mesg);
|
||||
|
||||
EXEC_EVENT_HOOK(th, RUBY_EVENT_C_RETURN, self, mid, klass);
|
||||
rb_thread_raised_clear(th);
|
||||
JUMP_TAG(TAG_RAISE);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue