summaryrefslogtreecommitdiff
path: root/lib/debug.rb
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-06-28 08:31:35 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-06-28 08:31:35 +0000
commit224e59c6f82c98da0d507cfae3b39c97b6769d51 (patch)
tree1e844ef7bb01533ce06310b79a92cd0c75a53ba1 /lib/debug.rb
parent1261c7e05550a72f3bb33eae75660142c6ea2a4e (diff)
matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@791 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/debug.rb')
-rw-r--r--lib/debug.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/debug.rb b/lib/debug.rb
index 2f61e8da34..d20d1ebbfc 100644
--- a/lib/debug.rb
+++ b/lib/debug.rb
@@ -7,6 +7,14 @@ if $SAFE > 0
end
SCRIPT_LINES__ = {} unless defined? SCRIPT_LINES__
+require 'tracer'
+class Tracer
+ def Tracer.trace_func(*vars)
+ Single.trace_func *vars
+ end
+end
+
+
class DEBUGGER__
class Mutex
def initialize
@@ -80,6 +88,7 @@ class DEBUGGER__
@no_step = nil
@frames = []
@finish_pos = 0
+ @trace = false
end
def stop_next(n=1)
@@ -216,6 +225,20 @@ class DEBUGGER__
end
case input
+ when /^\s*tr(?:ace)?(?:\s+(on|off))?$/
+ if !defined?( $1 )
+ @trace = !@trace
+ elsif $1 == 'on'
+ @trace = true
+ else
+ @trace = false
+ end
+ if @trace
+ stdout.print "Trace on\n"
+ else
+ stdout.print "Trace off\n"
+ end
+
when /^\s*b(?:reak)?\s+((?:.*?+:)?.+)$/
pos = $1
if pos.index(":")
@@ -445,6 +468,7 @@ Commands
up[ nn] move to higher frame
down[ nn] move to lower frame
fin[ish] return to outer frame
+ tr[ace][ (on|off)] set trace mode
q[uit] exit from debugger
v[ar] g[lobal] show global variables
v[ar] l[ocal] show local variables
@@ -572,6 +596,7 @@ EOHELP
end
def trace_func(event, file, line, id, binding, klass)
+ Tracer.trace_func(event, file, line, id, binding) if @trace
@file = file
@line = line
case event