def self.trace_func(event, file, line, id, binding, klass, *rest)
return if file == __FILE__
return if (event != 'call' and event != 'c-call')
return if klass == Class and id == :inherited
return if klass == Module and id == :method_added
return if klass == Kernel and id == :singleton_method_added
saved_crit = Thread.critical
Thread.critical = true
the_self = eval("self",binding)
flag = Class === the_self ? "." : "#"
fullname = "#{klass}#{flag}#{id}"
file.replace @@expand_path[file]
if event == 'call'
@@whereis << [file, line, fullname] if file !~ /\(eval\)$/
file, line, rest = caller(4)[0].split(/:/)
file.replace @@expand_path[file]
p caller(0) if $DEBUG
line = line.to_i
end
@@methods[file][line] << fullname if event =~ /call/
Thread.critical = saved_crit
end