Project

General

Profile

Bug #7976 ยป tp_test.rb

zenspider (Ryan Davis), 02/27/2013 10:25 AM

 
1
tp = TracePoint.new(:call, :return, :c_call, :c_return, :raise) do |t|
2
  warn "%-9p %s:%02d %p" % [t.event, t.path, t.lineno, t.method_id]
3
end
4

    
5
tp.enable
6

    
7
class X
8
  def x
9
    y
10
  end
11

    
12
  def y
13
    z
14
  end
15

    
16
  def z
17
    raise "no"
18
  end
19
end
20

    
21
X.new.x
22

    
23
# :c_return wtf.rb:05 :enable
24
# :c_call   wtf.rb:07 :inherited
25
# :c_return wtf.rb:07 :inherited
26
# :c_call   wtf.rb:08 :method_added
27
# :c_return wtf.rb:08 :method_added
28
# :c_call   wtf.rb:12 :method_added
29
# :c_return wtf.rb:12 :method_added
30
# :c_call   wtf.rb:16 :method_added
31
# :c_return wtf.rb:16 :method_added
32
# :c_call   wtf.rb:21 :new
33
# :c_call   wtf.rb:21 :initialize
34
# :c_return wtf.rb:21 :initialize
35
# :c_return wtf.rb:21 :new
36
# :call     wtf.rb:08 :x
37
# :call     wtf.rb:12 :y
38
# :call     wtf.rb:16 :z
39
# :c_call   wtf.rb:17 :raise
40
# :c_call   wtf.rb:17 :new
41
# :c_call   wtf.rb:17 :initialize
42
# :c_return wtf.rb:17 :initialize
43
# :c_return wtf.rb:17 :new
44
# :c_call   wtf.rb:17 :backtrace
45
# :c_return wtf.rb:17 :backtrace
46
# :raise    wtf.rb:17 :z
47
# :c_return wtf.rb:17 :raise
48
# :return   wtf.rb:17 :z
49
# :return   wtf.rb:13 :y
50
# :return   wtf.rb:09 :x
51
# wtf.rb:17:in `z': no (RuntimeError)
52
#         from wtf.rb:13:in `y'
53
#         from wtf.rb:9:in `x'
54
#         from wtf.rb:21:in `<main>'