Project

General

Profile

Actions

Bug #11492

closed

TracePoint API report extra return for defined method

Added by os97673 (Oleg Sukhodolsky) almost 10 years ago. Updated over 9 years ago.

Status:
Closed
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
Actions #1

Updated by os97673 (Oleg Sukhodolsky) almost 10 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

Actions #2

Updated by nagachika (Tomoyuki Chikanaga) almost 10 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
Actions #3

Updated by ko1 (Koichi Sasada) almost 10 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.
Actions #4

Updated by deivid (David Rodríguez) almost 10 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.

Actions #5

Updated by os97673 (Oleg Sukhodolsky) almost 10 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

Actions #6

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

Thanks!

Actions #7

Updated by os97673 (Oleg Sukhodolsky) almost 10 years ago

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

Updated by nagachika (Tomoyuki Chikanaga) over 9 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.

Actions #9

Updated by deivid (David Rodríguez) over 9 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 9 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

Updated by usa (Usaku NAKAMURA) over 9 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.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0