mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	* 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
This commit is contained in:
		
							parent
							
								
									4556a9ec65
								
							
						
					
					
						commit
						9709448474
					
				
					 7 changed files with 64 additions and 12 deletions
				
			
		| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue