Project

General

Profile

Actions

Bug #13392

open

TracePoint return event location is incorrect for methods defined with define_method

Added by areman01 (André Kullmann) over 4 years ago. Updated about 1 month ago.

Status:
Open
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
[ruby-core:80515]

Description

Command

ruby tracepoint_bug.rb

Output

ruby-2.4.1-p111 (x86_64-linux)
tracepoint_bug_ext.rb:4 call to_s
tracepoint_bug_ext.rb:5 c_call to_s
tracepoint_bug_ext.rb:5 c_return to_s
racepoint_bug.rb:12 return to_s

Why the call event on to_s is in file tracepoint_bug_ext.rb and the return event in file tracepoint_bug.rb? I think it's a bug. In jruby, for example, the call and the return event are both fired in the tracepoint_bug_ext.rb file.


Files

tracepoint_bug.rb (495 Bytes) tracepoint_bug.rb areman01 (André Kullmann), 03/31/2017 08:26 PM
tracepoint_bug_ext.rb (126 Bytes) tracepoint_bug_ext.rb areman01 (André Kullmann), 03/31/2017 08:26 PM

Related issues

Related to Ruby master - Bug #14817: TracePoint#parameters for bmethod's return event should return the same value as its Method#parametersAssignedko1 (Koichi Sasada)Actions

Updated by jeremyevans0 (Jeremy Evans) about 1 month ago

  • Subject changed from TracePoint doesn't work correct with monkey patches / aliased methods to TracePoint return event location is incorrect for methods defined with define_method

This isn't an issue specific to monkey patches or aliased methods. This is a general issue with the :return event handling of bmethods (methods defined using blocks instead of with def). The return event handling occurs after the related VM frame has been popped instead of before, which is why the return event for bmethods shows the caller location instead of the return location in the callee. I've submitted a pull request to fix this: https://github.com/ruby/ruby/pull/4588

Actions #2

Updated by jeremyevans0 (Jeremy Evans) about 1 month ago

  • Related to Bug #14817: TracePoint#parameters for bmethod's return event should return the same value as its Method#parameters added
Actions

Also available in: Atom PDF