Bug #9759
closed[TracePoint API] return event missing when raising exception
Added by deivid (David Rodríguez) over 11 years ago. Updated about 6 years ago.
Description
I think I found another bug in the TracePoint API, which seems related to #9321. In this case, the failing event is a return event from a method inside of which the exception was generated.
I wrote a failing test case, adapting the code from factory_girl, which is where I first found the strange behaviour.
Thanks a lot in advance!
Files
| tracepoint_missing_return_bug.rb (1.37 KB) tracepoint_missing_return_bug.rb | deivid (David Rodríguez), 04/19/2014 12:08 PM |
Updated by deivid (David Rodríguez) over 11 years ago
Actions
#1
[ruby-core:62097]
Also, I'm not sure whether those [:b_call, :create] and [:b_return, :create] events should be emitted at all. The block is run when defining the method, not when running it... Right?
Updated by deivid (David Rodríguez) over 11 years ago
Actions
#2
[ruby-core:62216]
Bump, @ko1 (Koichi Sasada)?
Updated by ko1 (Koichi Sasada) over 11 years ago
Actions
#3
[ruby-core:62244]
- Category set to core
- Assignee set to ko1 (Koichi Sasada)
Updated by ko1 (Koichi Sasada) over 11 years ago
Actions
#4
[ruby-core:62250]
- % Done changed from 0 to 100
- Status changed from Open to Closed
Applied in changeset r45758.
- vm.c (invoke_block_from_c): add VM_FRAME_FLAG_BMETHOD to record
it is bmethod frame. - vm.c (vm_exec): invoke RUBY_EVENT_RETURN event if rollbacked frame
is VM_FRAME_FLAG_BMETHOD.
[Bug #9759] - test/ruby/test_settracefunc.rb: add a test for TracePoint/set_trace_func.
- vm_core.h: renmae rb_thread_t::passed_me to
rb_thread_t::passed_bmethod_me to clarify the usage. - vm_insnhelper.c (vm_call_bmethod_body): use renamed member.
Updated by ko1 (Koichi Sasada) over 11 years ago
Actions
#5
[ruby-core:62251]
- Backport changed from 2.0.0: UNKNOWN, 2.1: UNKNOWN to 2.0.0: UNKNOWN, 2.1: REQUIRED
It can be reproduced by the following code:
class C9759
define_method(:foo){
raise
}
end
events = []
obj = C9759.new
TracePoint.new(:call, :return){|tp|
events << [tp.event, tp.method_id]
}.enable{
obj.foo rescue nil
}
p events
I hope this fix will be applied to 2.1.
Updated by deivid (David Rodríguez) over 11 years ago
Actions
#6
[ruby-core:62252]
Thanks!! So happy that this got fixed!! I hope it'll be added to 2.1 too.
Updated by nagachika (Tomoyuki Chikanaga) over 11 years ago
Actions
#7
[ruby-core:62545]
- Backport changed from 2.0.0: UNKNOWN, 2.1: REQUIRED to 2.0.0: UNKNOWN, 2.1: DONE
r45758 and r45759 were backported into ruby_2_1 branch at r45928.
Updated by deivid (David Rodríguez) over 11 years ago
Actions
#8
[ruby-core:62718]
Hi @Tomoyuki, thanks a lot for backporting this. May I ask for backdport of r44535 as well? It's a related fix and it would really improve byebug's quality and other programs using the tracepoint api.
Furthermore, both revisions would also be needed in the 2.0 branch.
Thanks a lot!!
Updated by nagachika (Tomoyuki Chikanaga) over 11 years ago
Actions
#9
[ruby-core:63236]
Hello, David.
Sorry for late response.
I'll handle about r44535 at #9321.
Thank you for your notice!
Updated by deivid (David Rodríguez) over 11 years ago
Actions
#10
[ruby-core:63307]
Hi Tomoyuki! I´ll follow up at #9321 then. What about backports to 2.0 branch?
Thanks a lot!
Updated by usa (Usaku NAKAMURA) over 11 years ago
Actions
#11
[ruby-core:63563]
- Backport changed from 2.0.0: UNKNOWN, 2.1: DONE to 2.0.0: REQUIRED, 2.1: DONE
r45758 is not enough to resolve this problem for ruby_2_0_0.
But I cannot find what is missing.
ko1, do you have any idea?
Updated by deivid (David Rodríguez) over 11 years ago
Actions
#12
[ruby-core:63714]
Yes, maybe he is aware of this because he only asked for backport to the 2.1 branch. Can you help us, ko1?
Updated by usa (Usaku NAKAMURA) about 11 years ago
Actions
#13
[ruby-core:64688]
- Status changed from Closed to Assigned
(reminder)
Updated by deivid (David Rodríguez) almost 11 years ago
Actions
#14
[ruby-core:66657]
Did you get the chance to have a look at this, ko1? Thanks!
Updated by naruse (Yui NARUSE) almost 8 years ago
Actions
#15
- Target version deleted (
2.2.0)
Updated by jeremyevans0 (Jeremy Evans) about 6 years ago
Actions
#16
- Status changed from Assigned to Closed