Project

General

Profile

Actions

Backport #8489

closed

Tracepoint API: B_RETURN_EVENT not triggered when "next" used

Added by deivid (David Rodríguez) almost 11 years ago. Updated almost 11 years ago.


Description

I'm using the Tracepoint API in my gem and I notice that when the keyword next is used inside a block, a block return event (B_RETURN_EVENT) is not triggered. For example, I would expect the same number of B_CALL_EVENT and B_RETURN_EVENT in the piece of code:

traceBlocks = TracePoint.new(:b_call, :b_return) do |tp|
p "#{tp.event == :b_call ? 'Block called' : 'Block returned'}"
end.enable do
3.times do
next
end
end

but instead there are 4 B_CALL_EVENT and 1 B_RETURN_EVENT. As I understand it, "next" causes the block to exit immediately, returning control to the iterator, which may invoke the block again, so I would say a block return event should be triggered.

Thanks a lot.

Updated by deivid (David Rodríguez) almost 11 years ago

This is the "no replies after 10 days reminder".

If this is not a priority right now, I can try have a look at this myself (not sure how it will go though...).

Thanks again.

Actions #2

Updated by ko1 (Koichi Sasada) almost 11 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r41300.
David, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • compile.c (rb_iseq_compile_node): fix location of a `trace'
    instruction (b_return event).
    [ruby-core:55305] [ruby-trunk - Bug #8489]
    (need a backport to 2.0.0?)
  • test/ruby/test_settracefunc.rb: add a test.

Updated by ko1 (Koichi Sasada) almost 11 years ago

Thank youf for your report.
I fixed it. Could you check it?

(2013/06/14 17:55), deivid (David Rodríguez) wrote:

Issue #8489 has been updated by deivid (David Rodríguez).

This is the "no replies after 10 days reminder".

If this is not a priority right now, I can try have a look at this myself (not sure how it will go though...).

Thanks again.

Bug #8489: Tracepoint API: B_RETURN_EVENT not triggered when "next" used
https://bugs.ruby-lang.org/issues/8489#change-39925

Author: deivid (David Rodríguez)
Status: Open
Priority: Normal
Assignee:
Category:
Target version:
ruby -v: ruby 2.0.0p201 (2013-06-04) [i686-linux]
Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN

I'm using the Tracepoint API in my gem and I notice that when the keyword next is used inside a block, a block return event (B_RETURN_EVENT) is not triggered. For example, I would expect the same number of B_CALL_EVENT and B_RETURN_EVENT in the piece of code:

traceBlocks = TracePoint.new(:b_call, :b_return) do |tp|
p "#{tp.event == :b_call ? 'Block called' : 'Block returned'}"
end.enable do
3.times do
next
end
end

but instead there are 4 B_CALL_EVENT and 1 B_RETURN_EVENT. As I understand it, "next" causes the block to exit immediately, returning control to the iterator, which may invoke the block again, so I would say a block return event should be triggered.

Thanks a lot.

--
// SASADA Koichi at atdot dot net

Updated by nagachika (Tomoyuki Chikanaga) almost 11 years ago

  • Backport changed from 1.9.3: UNKNOWN, 2.0.0: UNKNOWN to 1.9.3: UNKNOWN, 2.0.0: REQUIRED

Updated by deivid (David Rodríguez) almost 11 years ago

Just tried it @ko1 (Koichi Sasada), it works perfectly!

@nagachika (Tomoyuki Chikanaga), forgive my ignorance but "Backport to 2.0.0" means the patch will be released with the next patchlevel release?

Thanks a lot!!

Updated by zzak (zzak _) almost 11 years ago

On Sat, Jun 15, 2013 at 12:41 AM, deivid (David Rodríguez)
wrote:

@nagachika (Tomoyuki Chikanaga), forgive my ignorance but "Backport to 2.0.0" means the patch will be released with the next patchlevel release?

Yes, nagachika-san is the 2.0.0 release manager, he will backport this
for the next patchlevel release of ruby 2.0.0 series.

Updated by deivid (David Rodríguez) almost 11 years ago

Sweet, thanks a lot guys!

Actions #8

Updated by nagachika (Tomoyuki Chikanaga) almost 11 years ago

  • Tracker changed from Bug to Backport
  • Project changed from Ruby master to Backport200
  • Status changed from Closed to Assigned
  • Assignee set to nagachika (Tomoyuki Chikanaga)

Hello, deivid.
Never mind. It's my work to check if a changeset need to backport :)

And I'm going to backport r41300.

Actions #9

Updated by nagachika (Tomoyuki Chikanaga) almost 11 years ago

  • Status changed from Assigned to Closed

This issue was solved with changeset r41319.
David, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


merge revision(s) 41300: [Backport #8489]

* compile.c (rb_iseq_compile_node): fix location of a `trace'
  instruction (b_return event).
  [ruby-core:55305] [ruby-trunk - Bug #8489]
  (need a backport to 2.0.0?)

* test/ruby/test_settracefunc.rb: add a test.
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0