Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cc371cc

Browse files
committed
merge revision(s) 63727: [Backport #14865]
vm.c: fix infinite loop * vm.c: use EXEC_EVENT_HOOK_AND_POP_FRAME. While exception handling, if an exception is raised in hooks, need to pop current frame and raise this raised exception by hook. [ruby-dev:50582] [Bug #14865] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@64438 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent 05d7488 commit cc371cc

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

test/ruby/test_settracefunc.rb

+15
Original file line numberDiff line numberDiff line change
@@ -855,6 +855,21 @@ def test_tracepoint_exception_at_return
855855
end
856856
end
857857

858+
def test_tracepoint_exception_at_c_return
859+
assert_nothing_raised(Timeout::Error, 'infinite trace') do
860+
assert_normal_exit %q{
861+
begin
862+
TracePoint.new(:c_return){|tp|
863+
raise
864+
}.enable{
865+
tap{ itself }
866+
}
867+
rescue
868+
end
869+
}, '', timeout: 3
870+
end
871+
end
872+
858873
def test_tracepoint_with_multithreads
859874
assert_nothing_raised do
860875
TracePoint.new{

version.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#define RUBY_VERSION "2.5.2"
22
#define RUBY_RELEASE_DATE "2018-08-18"
3-
#define RUBY_PATCHLEVEL 79
3+
#define RUBY_PATCHLEVEL 80
44

55
#define RUBY_RELEASE_YEAR 2018
66
#define RUBY_RELEASE_MONTH 8

vm.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -1802,10 +1802,10 @@ vm_exec(rb_execution_context_t *ec)
18021802

18031803
while (ec->cfp->pc == 0 || ec->cfp->iseq == 0) {
18041804
if (UNLIKELY(VM_FRAME_TYPE(ec->cfp) == VM_FRAME_MAGIC_CFUNC)) {
1805-
EXEC_EVENT_HOOK(ec, RUBY_EVENT_C_RETURN, ec->cfp->self,
1806-
rb_vm_frame_method_entry(ec->cfp)->def->original_id,
1807-
rb_vm_frame_method_entry(ec->cfp)->called_id,
1808-
rb_vm_frame_method_entry(ec->cfp)->owner, Qnil);
1805+
EXEC_EVENT_HOOK_AND_POP_FRAME(ec, RUBY_EVENT_C_RETURN, ec->cfp->self,
1806+
rb_vm_frame_method_entry(ec->cfp)->def->original_id,
1807+
rb_vm_frame_method_entry(ec->cfp)->called_id,
1808+
rb_vm_frame_method_entry(ec->cfp)->owner, Qnil);
18091809
RUBY_DTRACE_CMETHOD_RETURN_HOOK(ec,
18101810
rb_vm_frame_method_entry(ec->cfp)->owner,
18111811
rb_vm_frame_method_entry(ec->cfp)->def->original_id);

0 commit comments

Comments
 (0)