diff options
author | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-11-29 17:55:54 +0000 |
---|---|---|
committer | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-11-29 17:55:54 +0000 |
commit | 970944847455dae54072ade11b4f4247e4707681 (patch) | |
tree | d2f0a8f6abb5dab608b60426768b7c6886ee529c /test/dtrace/test_function_entry.rb | |
parent | 4556a9ec654406c1be43a0b0b3bff99e4d0ed3c1 (diff) |
* vm.c: add a return hook when a method raises an exception.
* probes_helper.h: look up klass and method if none are provided.
* eval.c: update macro usage.
* vm_eval.c: ditto.
* vm_insnhelper.c: ditto.
* test/dtrace/test_function_entry.rb: test for change.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38001 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/dtrace/test_function_entry.rb')
-rw-r--r-- | test/dtrace/test_function_entry.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/dtrace/test_function_entry.rb b/test/dtrace/test_function_entry.rb index 7a5f685f16..c7bf478643 100644 --- a/test/dtrace/test_function_entry.rb +++ b/test/dtrace/test_function_entry.rb @@ -44,6 +44,35 @@ ruby$target:::method-return } end + def test_return_from_raise + program = <<-eoruby + class Foo + def bar; raise; end + def baz + bar + rescue + end + end + + Foo.new.baz + eoruby + + probe = <<-eoprobe +ruby$target:::method-return +/arg0 && arg1 && arg2/ +{ + printf("%s %s %s %d\\n", copyinstr(arg0), copyinstr(arg1), copyinstr(arg2), arg3); +} + eoprobe + + trap_probe(probe, program) { |d_file, rb_file, probes| + foo_calls = probes.map { |line| line.split }.find_all { |row| + row.first == 'Foo' && row[1] == 'bar' + } + assert foo_calls.any? + } + end + private def ruby_program <<-eoruby |