Bug #4583
closedtrace doesn't work for methods set up by attr_*
Description
=begin
Methods set up with (({attr_accessor})) or alike are not traceable:
class Foo
attr_writer :bar
def baz=(value)
@baz = value
end
end
set_trace_func proc{|*args| puts args.inspect}
@foo = Foo.new # will be traced
@foo.bar = 'bar' # call to bar= will not be traced
@foo.baz = 'baz' # call to baz= will be traced
Expected behavior: "c-call" and "c-return" are traced.
=end
Files
Updated by QaDeS (Michael Klaus) about 13 years ago
=begin
See also issue #4584 for Ruby 1.8.
=end
Updated by kosaki (Motohiro KOSAKI) about 13 years ago
- Status changed from Open to Assigned
- Assignee set to ko1 (Koichi Sasada)
=begin
Hi Michael,
Interesting report. Assigned to ko1.
=end
Updated by QaDeS (Michael Klaus) about 13 years ago
=begin
Thanks for the hint on reporting properly. Here's a working patch for 1.8.7
=end
Updated by QaDeS (Michael Klaus) about 13 years ago
=begin
Added test for 1.9.2-head, but changes to vm_eval.c didn't make it work. Next suspect: vm_insnhelper.c
Actually, I have no clue what I'm doing :)
=end
Updated by QaDeS (Michael Klaus) about 13 years ago
=begin
Working patch for 1.9.2-head
=end
Updated by QaDeS (Michael Klaus) about 13 years ago
=begin
Actually, the binding passed to the trace_func is wrong. Should be of the object the attr_accessor is defined in.
=end
Updated by QaDeS (Michael Klaus) about 13 years ago
- File test_settracefunc-1.8.7.patch test_settracefunc-1.8.7.patch added
- File test_settracefunc-1.9.2.patch test_settracefunc-1.9.2.patch added
=begin
Modified the test to show the binding problem.
=end
Updated by ko1 (Koichi Sasada) almost 13 years ago
- ruby -v changed from ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-linux] to -
Hi,
(2011/04/17 11:44), redmine@ruby-lang.org wrote:
Methods set up with (({attr_accessor})) or alike are not traceable:
class Foo
attr_writer :bar
def baz=(value)
@baz = value
end
endset_trace_func proc{|*args| puts args.inspect}
@foo = Foo.new # will be traced
@foo.bar = 'bar' # call to bar= will not be traced
@foo.baz = 'baz' # call to baz= will be tracedExpected behavior: "c-call" and "c-return" are traced.
This is because performance issue. I want to ignore your request.
Any real problem?
--
// SASADA Koichi at atdot dot net
Updated by ko1 (Koichi Sasada) almost 13 years ago
- Status changed from Assigned to Feedback
Updated by ko1 (Koichi Sasada) over 11 years ago
- Status changed from Feedback to Rejected
No feedback.