Project

General

Profile

Bug #11492

TracePoint API report extra return for defined method

Added by os97673 (Oleg Sukhodolsky) almost 4 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Normal
Target version:
-
ruby -v:
ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin14]
[ruby-core:<unknown>]

Description

class A
  define_method "method1" do
    # puts "#{method_name}(#{arg})"
    return 1
  end
end

a = A.new

TracePoint.new do |tp|
  printf "%8s %13s %s:%-2d\n", tp.event, tp.method_id, tp.path, tp.lineno
end.enable do
  a.method1
end

Related issues

Related to Backport21 - Backport #11646: Please backport r51713ClosedActions

Associated revisions

Revision 868c98dc
Added by ko1 (Koichi Sasada) almost 4 years ago

  • vm.c (hook_before_rewind): prevent kicking :return event while finishing vm_exec func because invoke_block_from_c() kick a :return event for bmethods. [Bug #11492]
  • test/ruby/test_settracefunc.rb: add a test.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51713 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 51713
Added by ko1 (Koichi Sasada) almost 4 years ago

  • vm.c (hook_before_rewind): prevent kicking :return event while finishing vm_exec func because invoke_block_from_c() kick a :return event for bmethods. [Bug #11492]
  • test/ruby/test_settracefunc.rb: add a test.

Revision 51713
Added by ko1 (Koichi Sasada) almost 4 years ago

  • vm.c (hook_before_rewind): prevent kicking :return event while finishing vm_exec func because invoke_block_from_c() kick a :return event for bmethods. [Bug #11492]
  • test/ruby/test_settracefunc.rb: add a test.

Revision 51713
Added by ko1 (Koichi Sasada) almost 4 years ago

  • vm.c (hook_before_rewind): prevent kicking :return event while finishing vm_exec func because invoke_block_from_c() kick a :return event for bmethods. [Bug #11492]
  • test/ruby/test_settracefunc.rb: add a test.

Revision 51713
Added by ko1 (Koichi Sasada) almost 4 years ago

  • vm.c (hook_before_rewind): prevent kicking :return event while finishing vm_exec func because invoke_block_from_c() kick a :return event for bmethods. [Bug #11492]
  • test/ruby/test_settracefunc.rb: add a test.

Revision 51713
Added by ko1 (Koichi Sasada) almost 4 years ago

  • vm.c (hook_before_rewind): prevent kicking :return event while finishing vm_exec func because invoke_block_from_c() kick a :return event for bmethods. [Bug #11492]
  • test/ruby/test_settracefunc.rb: add a test.

Revision 0518d299
Added by nagachika (Tomoyuki Chikanaga) over 3 years ago

merge revision(s) 51713: [Backport #11492]

    * vm.c (hook_before_rewind): prevent kicking :return event while
      finishing vm_exec func because invoke_block_from_c() kick a :return
      event for bmethods.
      [Bug #11492]

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

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@52308 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 52308
Added by nagachika (Tomoyuki Chikanaga) over 3 years ago

merge revision(s) 51713: [Backport #11492]

* vm.c (hook_before_rewind): prevent kicking :return event while
  finishing vm_exec func because invoke_block_from_c() kick a :return
  event for bmethods.
  [Bug #11492]

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

Revision bc090868
Added by usa (Usaku NAKAMURA) over 3 years ago

merge revision(s) 51713: [Backport #11492] [Backport #11646]

    * vm.c (hook_before_rewind): prevent kicking :return event while
      finishing vm_exec func because invoke_block_from_c() kick a :return
      event for bmethods.
      [Bug #11492]

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

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@52639 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 52639
Added by usa (Usaku NAKAMURA) over 3 years ago

merge revision(s) 51713: [Backport #11492] [Backport #11646]

* vm.c (hook_before_rewind): prevent kicking :return event while
  finishing vm_exec func because invoke_block_from_c() kick a :return
  event for bmethods.
  [Bug #11492]

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

History

#1

Updated by os97673 (Oleg Sukhodolsky) almost 4 years ago

MRI 2.2.3 introduced problem with TracePoint events.
For the provided test it reports extra return event for method1

  b_call               ruby-17051.rb:14
    line               ruby-17051.rb:15
    call       method1 ruby-17051.rb:2 
  b_call       method1 ruby-17051.rb:2 
    line       method1 ruby-17051.rb:4 
b_return       method1 ruby-17051.rb:4 
  return       method1 ruby-17051.rb:4 
  return       method1 ruby-17051.rb:15
b_return               ruby-17051.rb:16

while 2.2.2 reports

  b_call               ruby-17051.rb:14
    line               ruby-17051.rb:15
    call       method1 ruby-17051.rb:2 
  b_call       method1 ruby-17051.rb:2 
    line       method1 ruby-17051.rb:4 
b_return       method1 ruby-17051.rb:4 
  return       method1 ruby-17051.rb:15
b_return               ruby-17051.rb:16

This breaks calculation of frame stack's size which is used in debase and byebug

#2

Updated by nagachika (Tomoyuki Chikanaga) almost 4 years ago

  • Status changed from Open to Assigned
  • Backport changed from 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN to 2.0.0: DONTNEED, 2.1: DONTNEED, 2.2: REQUIRED
#3

Updated by ko1 (Koichi Sasada) almost 4 years ago

  • Status changed from Assigned to Closed

Applied in changeset r51713.


  • vm.c (hook_before_rewind): prevent kicking :return event while finishing vm_exec func because invoke_block_from_c() kick a :return event for bmethods. [Bug #11492]
  • test/ruby/test_settracefunc.rb: add a test.
#4

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

Oleg, could you link to the original report where you found this out? I'd like to know what kind of bug reports to expect and maybe add a regression test in byebug itself.

#5

Updated by os97673 (Oleg Sukhodolsky) almost 4 years ago

David Rodríguez wrote:

Oleg, could you link to the original report where you found this out? I'd like to know what kind of bug reports to expect and maybe add a regression test in byebug itself.

originally the problem was reported here (https://youtrack.jetbrains.com/issue/RUBY-17051) unfortunately user was unable to provide test and I've investigated the problem using log of event reported by debase

#7

Updated by os97673 (Oleg Sukhodolsky) almost 4 years ago

Reporter of original bug confirmed that ruby-head does fix the problem.

Updated by nagachika (Tomoyuki Chikanaga) over 3 years ago

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

Backported into ruby_2_2 branch at r52308.

#9

Updated by deivid (David Rodríguez) over 3 years ago

Hi, this is indeed a regression in 2.2.3, but also a bug present in 2.1.7. Could we get it backported to 2.1 as well? Thanks!

Updated by usa (Usaku NAKAMURA) over 3 years ago

  • Backport changed from 2.0.0: DONTNEED, 2.1: DONTNEED, 2.2: DONE to 2.0.0: DONTNEED, 2.1: REQUIRED, 2.2: DONE
#11

Updated by usa (Usaku NAKAMURA) over 3 years ago

Updated by usa (Usaku NAKAMURA) over 3 years ago

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

ruby_2_1 r52639 merged revision(s) 51713.

Also available in: Atom PDF