Document binding behavior for C call/return events for TracePoint/set_trace_func
C methods do not have bindings, so binding returns the binding of the nearest C method. Fixes [Bug #9009]
This commit is contained in:
parent
203eeeefdd
commit
d585799d73
@ -309,15 +309,21 @@ class TracePoint
|
|||||||
Primitive.tracepoint_attr_defined_class
|
Primitive.tracepoint_attr_defined_class
|
||||||
end
|
end
|
||||||
|
|
||||||
# Return the generated binding object from event
|
# Return the generated binding object from event.
|
||||||
|
#
|
||||||
|
# Note that for +c_call+ and +c_return+ events, the binding returned is the
|
||||||
|
# binding of the nearest Ruby method calling the C method, since C methods
|
||||||
|
# themselves do not have bindings.
|
||||||
def binding
|
def binding
|
||||||
Primitive.tracepoint_attr_binding
|
Primitive.tracepoint_attr_binding
|
||||||
end
|
end
|
||||||
|
|
||||||
# Return the trace object during event
|
# Return the trace object during event
|
||||||
#
|
#
|
||||||
# Same as TracePoint#binding:
|
# Same as the following, except it returns the correct object (the method
|
||||||
# trace.binding.eval('self')
|
# receiver) for +c_call+ and +c_return+ events:
|
||||||
|
#
|
||||||
|
# trace.binding.eval('self')
|
||||||
def self
|
def self
|
||||||
Primitive.tracepoint_attr_self
|
Primitive.tracepoint_attr_self
|
||||||
end
|
end
|
||||||
|
@ -519,6 +519,10 @@ static void call_trace_func(rb_event_flag_t, VALUE data, VALUE self, ID id, VALU
|
|||||||
* line prog.rb:3 test Test
|
* line prog.rb:3 test Test
|
||||||
* line prog.rb:4 test Test
|
* line prog.rb:4 test Test
|
||||||
* return prog.rb:4 test Test
|
* return prog.rb:4 test Test
|
||||||
|
*
|
||||||
|
* Note that for +c-call+ and +c-return+ events, the binding returned is the
|
||||||
|
* binding of the nearest Ruby method calling the C method, since C methods
|
||||||
|
* themselves do not have bindings.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
|
Loading…
x
Reference in New Issue
Block a user