Bug #8622

Tracepoint API: B_RETURN_EVENT not triggered when "return" used inside lambda

Added by David Rodríguez 10 months ago. Updated 7 months ago.

[ruby-core:55924]
Status:Closed
Priority:Normal
Assignee:Koichi Sasada
Category:core
Target version:2.1.0
ruby -v:ruby 2.0.0p247 (2013-06-27 revision 41674) [i686-linux] Backport:1.9.3: UNKNOWN, 2.0.0: UNKNOWN

Description

=begin

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

TracePoint.new(:b_call, :b_return) do |tp|
  warn tp.event
end.enable

a = lambda { return "hola" }.call

# Output:
# b_call
# 
# Expected Output:
# b_call
# b_return 

This seems very similar to issue #8489, so hopefully the fix would be as simple as that one.

Thanks a lot.
=end

Associated revisions

Revision 43237
Added by Koichi Sasada 7 months ago

  • vm.c (vmexec): support :breturn event for "lambda{return}.call". [Bug #8622]
  • test/ruby/test_settracefunc.rb: add a test.

History

#1 Updated by Koichi Sasada 10 months ago

  • Category set to core
  • Assignee set to Koichi Sasada
  • Target version set to 2.1.0

#2 Updated by David Rodríguez 9 months ago

=begin
Notice that I am blaming "return" because this doesn't happen if "return" is not explicited.

TracePoint.new(:b_call, :b_return) do |tp|
  warn tp.event
end.enable

a = lambda { "hola" }.call

# Output:
# b_call
# b_return 

=end

Thanks!

#3 Updated by Koichi Sasada 7 months ago

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

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


  • vm.c (vmexec): support :breturn event for "lambda{return}.call". [Bug #8622]
  • test/ruby/test_settracefunc.rb: add a test.

Also available in: Atom PDF