Sha256: e9f830b71178f8b75c887c0c83cec03b7217c60c56cae3c3db163f165dfa92d0
Contents?: true
Size: 1.02 KB
Versions: 2
Compression:
Stored size: 1.02 KB
Contents
require 'pp' require 'sane/os' def xray require 'xray' proc { Process.kill "QUIT", Process.pid; '' } end if Thread.current.respond_to? :backtrace fella = proc { out = {} Thread.list.each{|t| out[t] = t.backtrace } out } elsif respond_to? :caller_for_all_threads if OS.windows? fella = proc { caller_for_all_threads } else fella = xray end else # weak sauce for the old school users :) if OS.windows? trap("ILL") { puts "All threads:" + Thread.list.inspect, "Current thread:" + Thread.current.to_s, caller } # puts current thread caller fella = proc { Process.kill "ILL", Process.pid } # send myself a signal else fella = xray end end time = $ping_interval || 5 # seconds time = 1 if $0 == __FILE__ Thread.new { loop { sleep time pp 'current stack trace', Time.now, fella.call } } require File.dirname(__FILE__) + '/backtracer' # we want the normal backtracer, too if $0 == __FILE__ # i.e. a test sleep end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
backtracer-0.4.1 | lib/backtracer_ping.rb |
backtracer-0.4.0 | lib/backtracer_ping.rb |