Project

General

Profile

Actions

Bug #10724

closed

[TracePointAPI] Missing return event from initialize method when using `domain_name` gem

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

Status:
Closed
Target version:
-
ruby -v:
ruby 2.3.0dev (2015-01-09 trunk 49194) [i686-linux]
[ruby-core:67463]

Description

The domain_name gem defines a DomainName object which has a pretty complex initialize method. The TracePoint API misses the return event from this method when instantiating a DomainName object.

I attach a failing test case.

Thanks!!


Files

test_tracepoint_with_domain_name.rb (896 Bytes) test_tracepoint_with_domain_name.rb deivid (David Rodríguez), 01/09/2015 10:43 AM
test_for_issue_10724.rb (726 Bytes) test_for_issue_10724.rb deivid (David Rodríguez), 01/20/2015 01:22 PM

Updated by deivid (David Rodríguez) about 9 years ago

Hi again, I've been able to reduce this to the following minimal program which misses the return event for the initialize call. Attaching a failing test case.

class A
  def initialize
    loop { return }
  end
end

A.new

Thanks!!

Updated by ko1 (Koichi Sasada) about 9 years ago

  • Assignee set to ko1 (Koichi Sasada)

Thank you. I can reproduce it.

class A
  def initialize
    loop{return}
  end

  def foo
    loop { return }
  end

  def bar
  end
end

TracePoint.new(:return){|tp|
  p tp
}.enable{
  a = A.new
  a.foo
  a.bar
}
# #<TracePoint:return `foo'@t.rb:8>
# #<TracePoint:return `bar'@t.rb:12>
Actions #4

Updated by deivid (David Rodríguez) about 9 years ago

@ko1 (Koichi Sasada), any updates?

Thanks!

Actions #5

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

@ko1 (Koichi Sasada), is this in your plans? Just asking so that I can find some time myself to have a look at it if you don't want or don't have the time to do it.

Actions #6

Updated by ko1 (Koichi Sasada) almost 9 years ago

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

Applied in changeset r50206.


  • vm.c (vm_exec): check other events when RETURN is thrown.
    [Bug #10724]
  • test/ruby/test_settracefunc.rb: add a test.
Actions #7

Updated by ko1 (Koichi Sasada) almost 9 years ago

  • Backport changed from 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN to 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: REQUIRED

Sorry for long absent.

I fixed it.

Idea is given by wanabe-san.
https://twitter.com/wannabe53/status/578555803445035009

Actions #8

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

Great! Thanks a lot to both for the fix.

I'd like this backported to 2.0 and 2.1, too, if possible

Actions #9

Updated by usa (Usaku NAKAMURA) almost 9 years ago

  • Backport changed from 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: REQUIRED to 2.0.0: WONTFIX, 2.1: REQUIRED, 2.2: REQUIRED
Actions #10

Updated by usa (Usaku NAKAMURA) almost 9 years ago

  • Backport changed from 2.0.0: WONTFIX, 2.1: REQUIRED, 2.2: REQUIRED to 2.0.0: WONTFIX, 2.1: DONE, 2.2: REQUIRED

ruby_2_1 r50576 merged revision(s) 50206.

Updated by nagachika (Tomoyuki Chikanaga) almost 9 years ago

  • Backport changed from 2.0.0: WONTFIX, 2.1: DONE, 2.2: REQUIRED to 2.0.0: WONTFIX, 2.1: DONE, 2.2: DONE

Backported into ruby_2_2 branch at r50624.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0