mirror of
https://github.com/ruby/ruby.git
synced 2025-08-28 15:36:16 +02:00
* vm_trace.c (rb_threadptr_exec_event_hooks_and_pop_frame):
pop a frame before JUMP_TAG() if exception occurred. This change fix bug of Ruby 1.9. [ruby-core:51128] [ruby-trunk - Bug #7624] * vm_core.h (EXEC_EVENT_HOOK_AND_POP_FRAME): add to use `rb_threadptr_exec_event_hooks_and_pop_frame()'. * vm.c (vm_exec): use EXEC_EVENT_HOOK_AND_POP_FRAME() while exception handling. While exception hadnling, if an exception is raised in hooks, need to pop current frame and raise this raised exception by hook. * test/ruby/test_settracefunc.rb: add a test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38601 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0f63b60f23
commit
c2693f8bd6
5 changed files with 69 additions and 9 deletions
|
@ -848,4 +848,27 @@ class TestSetTraceFunc < Test::Unit::TestCase
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
class FOO_ERROR < RuntimeError; end
|
||||
class BAR_ERROR < RuntimeError; end
|
||||
def m1_test_trace_point_at_return_when_exception
|
||||
m2_test_trace_point_at_return_when_exception
|
||||
end
|
||||
def m2_test_trace_point_at_return_when_exception
|
||||
raise BAR_ERROR
|
||||
end
|
||||
|
||||
def test_trace_point_at_return_when_exception
|
||||
bug_7624 = '[ruby-core:51128] [ruby-trunk - Bug #7624]'
|
||||
TracePoint.new{|tp|
|
||||
if tp.event == :return &&
|
||||
tp.method_id == :m2_test_trace_point_at_return_when_exception
|
||||
raise FOO_ERROR
|
||||
end
|
||||
}.enable do
|
||||
assert_raise(FOO_ERROR, bug_7624) do
|
||||
m1_test_trace_point_at_return_when_exception
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue