Hello, I found that set_trace_func is behaving in a weird way,
missing some call events.
Extracting the problem:
$ ruby --version
ruby 1.8.5 (2006-08-25) [i486-linux]
$ ruby -le 'require "fileutils"; set_trace_func proc {|event, file,
line, id, binding, classname| printf "%8s %s:%-2d %10s %8s\n", event,
file, line, id, classname }; FileUtils.remove_entry' 2>/dev/null
line -e:1 false
c-call -e:1 new Class
c-call -e:1 initialize Exception
c-return -e:1 initialize Exception
c-return -e:1 new Class
c-call -e:1 backtrace Exception
c-return -e:1 backtrace Exception
c-call -e:1 set_backtrace Exception
c-return -e:1 set_backtrace Exception
raise -e:1 remove_entry FileUtils
return /usr/lib/ruby/1.8/fileutils.rb:755 remove_entry FileUtils
c-call -e:1 backtrace Exception
c-return -e:1 backtrace Exception
c-call -e:1 write IO
c-return -e:1 write IO
c-call -e:1 message Exception
c-call -e:1 to_s Exception
c-return -e:1 to_s Exception
c-return -e:1 message Exception
c-call -e:1 write IO
c-return -e:1 write IO
c-call -e:1 write IO
c-return -e:1 write IO
c-call -e:1 write IO
c-return -e:1 write IO
c-call -e:1 write IO
c-return -e:1 write IO
c-call -e:1 write IO
c-return -e:1 write IO
c-call -e:1 write IO
c-return -e:1 write IO
$
I'm puzzled by this (and worse - magic/help is puzzled).
Somehow call to FileUtils.remove_entry doesn't get registered,
only ArgumentError.new, and then return from FileUtils.remove_entry.
Calls with bad number of arguments to other functions like Array#[]
work correctly.
$ ruby -le 'require "fileutils"; set_trace_func proc {|event, file,
line, id, binding, classname| printf "%8s %s:%-2d %10s %8s\n", event,
file, line, id, classname }; [][]' 2>/dev/null
line -e:1 false
c-call -e:1 [] Array
c-call -e:1 new Class
c-call -e:1 initialize Exception
c-return -e:1 initialize Exception
c-return -e:1 new Class
c-call -e:1 backtrace Exception
c-return -e:1 backtrace Exception
c-call -e:1 set_backtrace Exception
c-return -e:1 set_backtrace Exception
raise -e:1 [] Array
c-return -e:1 [] Array
c-call -e:1 backtrace Exception
c-return -e:1 backtrace Exception
c-call -e:1 write IO
c-return -e:1 write IO
c-call -e:1 message Exception
c-call -e:1 to_s Exception
c-return -e:1 to_s Exception
c-return -e:1 message Exception
c-call -e:1 write IO
c-return -e:1 write IO
c-call -e:1 write IO
c-return -e:1 write IO
c-call -e:1 write IO
c-return -e:1 write IO
c-call -e:1 write IO
c-return -e:1 write IO
c-call -e:1 write IO
c-return -e:1 write IO
c-call -e:1 write IO
c-return -e:1 write IO
$
Is this a bug or expected behaviour ?
Can it be worked around somehow, so that:
help { FileUtils.remove_entry }
keeps working ?
···
--
Tomasz Wegrzanowski [ http://t-a-w.blogspot.com/ ]