aboutsummaryrefslogtreecommitdiffstats
path: root/lib/tracer.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/tracer.rb')
-rw-r--r--lib/tracer.rb32
1 files changed, 16 insertions, 16 deletions
diff --git a/lib/tracer.rb b/lib/tracer.rb
index 1fdc608960..8e6586d7c6 100644
--- a/lib/tracer.rb
+++ b/lib/tracer.rb
@@ -1,12 +1,12 @@
#
-# tracer.rb -
+# tracer.rb -
# $Release Version: 0.2$
# $Revision: 1.8 $
# by Keiju ISHITSUKA(Nippon Rational Inc.)
#
# --
#
-#
+#
#
#
@@ -22,7 +22,7 @@ class Tracer
alias verbose? verbose
attr_accessor :stdout
end
-
+
EVENT_SYMBOL = {
"line" => "-",
"call" => ">",
@@ -32,7 +32,7 @@ class Tracer
"c-call" => ">",
"c-return" => "<",
}
-
+
def initialize
@threads = Hash.new
if defined? Thread.main
@@ -45,7 +45,7 @@ class Tracer
@filters = []
end
-
+
def stdout
Tracer.stdout
end
@@ -63,7 +63,7 @@ class Tracer
stdout.print "Trace on\n" if Tracer.verbose?
end
end
-
+
def off
set_trace_func nil
stdout.print "Trace off\n" if Tracer.verbose?
@@ -76,7 +76,7 @@ class Tracer
def set_get_line_procs(file, p = proc)
@get_line_procs[file] = p
end
-
+
def get_line(file, line)
if p = @get_line_procs[file]
return p.call(line)
@@ -85,7 +85,7 @@ class Tracer
unless list = SCRIPT_LINES__[file]
begin
f = open(file)
- begin
+ begin
SCRIPT_LINES__[file] = list = f.readlines
ensure
f.close
@@ -101,7 +101,7 @@ class Tracer
"-\n"
end
end
-
+
def get_thread_no
if no = @threads[Thread.current.object_id]
no
@@ -109,14 +109,14 @@ class Tracer
@threads[Thread.current.object_id] = @threads.size
end
end
-
+
def trace_func(event, file, line, id, binding, klass, *)
return if file == __FILE__
-
+
for p in @filters
return unless p.call event, file, line, id, binding, klass
end
-
+
# saved_crit = Thread.critical
# Thread.critical = true
stdout.printf("#%d:%s:%d:%s:%s: %s",
@@ -137,11 +137,11 @@ class Tracer
Single.on
end
end
-
+
def Tracer.off
Single.off
end
-
+
def Tracer.set_get_line_procs(file_name, p = proc)
Single.set_get_line_procs(file_name, p)
end
@@ -149,14 +149,14 @@ class Tracer
def Tracer.add_filter(p = proc)
Single.add_filter(p)
end
-
+
end
SCRIPT_LINES__ = {} unless defined? SCRIPT_LINES__
if $0 == __FILE__
# direct call
-
+
$0 = ARGV[0]
ARGV.shift
Tracer.on