summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-08-11 00:39:04 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-08-11 00:39:04 +0000
commit3360e3e7eafd0a7c19af8dc13b9adba4baee0c48 (patch)
treedeba4b631db5c5b1f811bb2b527f7c7f4f37c4ee /test
parente1fd55ae00adc7855f459383a22bb36b4de5ffa5 (diff)
merges r32334 and r32335 from trunk into ruby_1_9_2.
-- * vm_insnhelper.c (vm_call_bmethod): fix to hook call/return event for methods defined by define_method(). * thread.c (call_trace_proc): Fix to skip if class is not given (0). Note that ID and Class object are passed for call/return event if the called method was defined by define_method(). If you are author of tracer/profiler/debugger, this may be an important change. You should check passed class as zero or non-zero instead of checking the event type. * test/ruby/test_settracefunc.rb: add a test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@32924 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_settracefunc.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/ruby/test_settracefunc.rb b/test/ruby/test_settracefunc.rb
index f885cb0042..ddfcaff920 100644
--- a/test/ruby/test_settracefunc.rb
+++ b/test/ruby/test_settracefunc.rb
@@ -354,4 +354,26 @@ class TestSetTraceFunc < Test::Unit::TestCase
assert_equal([], events[:set])
assert_equal([], events[:add])
end
+
+ def test_trace_defined_method
+ events = []
+ eval <<-EOF.gsub(/^.*?: /, "")
+ 1: class FooBar; define_method(:foobar){}; end
+ 2: fb = FooBar.new
+ 3: set_trace_func(Proc.new { |event, file, lineno, mid, binding, klass|
+ 4: events << [event, lineno, mid, klass]
+ 5: })
+ 6: fb.foobar
+ 7: set_trace_func(nil)
+ EOF
+
+ [["c-return", 5, :set_trace_func, Kernel],
+ ["line", 6, __method__, self.class],
+ ["call", 6, :foobar, FooBar],
+ ["return", 6, :foobar, FooBar],
+ ["line", 7, __method__, self.class],
+ ["c-call", 7, :set_trace_func, Kernel]].each{|e|
+ assert_equal(e, events.shift)
+ }
+ end
end