C:\dev\ruby\ruby-prof>ruby -vrtracer test_array.rb
ruby 1.9.2dev (2010-07-02) [i386-mingw32]
#0:test_array.rb:1::-: a = [1,2,3]
#0:test_array.rb:2::-: a.each{|n|
#0:test_array.rb:3::-: p n
1
#0:test_array.rb:3::-: p n
2
#0:test_array.rb:3::-: p n
3
This on windows and Linux.
Unless it's expected, in which case it's just missing the return statement.
Thanks.
-r
=end
=begin
It's worth mentioning that tracer is broken in JRuby for the same reason. Depending on caller to be the same all the time is a bit fragile. Ideally there'd be a better marker for whether tracer should be started up right away or not.
=end
=begin
This isn't actually a problem with "-rtracer" not turning Tracer.on, it's that it does output, but outputs far fewer symbols (mostly missing tons of returns).
Cheers!
-r
=end
If you want to print c-func and c-return event, please set:
Tracer::display_c_call = true
...
However, with 1.9.2+ I get almost no output:
C:\dev\ruby\ruby-prof>ruby -vrtracer test_array.rb
ruby 1.9.2dev (2010-07-02) [i386-mingw32]
#0:test_array.rb:1::-: a = [1,2,3]
#0:test_array.rb:2::-: a.each{|n|
#0:test_array.rb:3::-: p n
1
#0:test_array.rb:3::-: p n
2
#0:test_array.rb:3::-: p n
3
It works.
Still seems a bit odd to me that it doesn't appear to log a "return"
call from the #each method unless you have display_c_call turned on
[?]