Bug #4583
closedtrace doesn't work for methods set up by attr_*
Added by QaDeS (Michael Klaus) over 14 years ago. Updated almost 13 years ago.
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
eval.diff (2.29 KB) eval.diff | trace events to attr_* generated methods. includes test | QaDeS (Michael Klaus), 04/17/2011 04:17 PM | |
test_settracefunc.rb.diff (1.4 KB) test_settracefunc.rb.diff | 1.9.2-head Testing trace events for attr_* generated methods | QaDeS (Michael Klaus), 04/17/2011 07:05 PM | |
trace_attr_accessors.patch (2.32 KB) trace_attr_accessors.patch | 1.9.2 Full working patch | QaDeS (Michael Klaus), 04/18/2011 06:24 AM | |
test_settracefunc-1.8.7.patch (2.08 KB) test_settracefunc-1.8.7.patch | 1.8.7 Test for correct binding - succeeds | QaDeS (Michael Klaus), 04/18/2011 07:56 AM | |
test_settracefunc-1.9.2.patch (2.27 KB) test_settracefunc-1.9.2.patch | 1.9.2 Test for correct binding - fails | QaDeS (Michael Klaus), 04/18/2011 07:56 AM |
Updated by QaDeS (Michael Klaus) over 14 years ago
Actions
#1
[ruby-core:35792]
=begin
See also issue #4584 for Ruby 1.8.
=end
Updated by kosaki (Motohiro KOSAKI) over 14 years ago
Actions
#2
[ruby-core:35794]
- 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) over 14 years ago
Actions
#3
[ruby-core:35796]
Updated by QaDeS (Michael Klaus) over 14 years ago
Actions
#4
[ruby-core:35797]
=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) over 14 years ago
Actions
#5
[ruby-core:35798]
=begin
Working patch for 1.9.2-head
=end
Updated by QaDeS (Michael Klaus) over 14 years ago
Actions
#6
[ruby-core:35799]
=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) over 14 years ago
Actions
#7
[ruby-core:35800]
- 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) over 14 years ago
Actions
#8
[ruby-core:36928]
- 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) over 14 years ago
Actions
#9
[ruby-core:36998]
- Status changed from Assigned to Feedback
Updated by ko1 (Koichi Sasada) almost 13 years ago
Actions
#10
[ruby-core:48570]
- Status changed from Feedback to Rejected
No feedback.