From: "NAKAMURA, Hiroshi" Date: 2000-06-23T22:27:49+09:00 Subject: [ruby-talk:03635] [Patch] Trace in debugger Hi, Today I used Ruby-1.5 debugger after a long time, and I found 'list' command did not work. It seems that SCRIPT_LINES__ is not set. I could not retrieve why it is... Apart from this, here is patch for debug.rb to on/off tracer. Matz, I do not know well about Ruby debugger thread aware version, is this right way to patch? // NaHi --- debug.rb.dist Tue May 9 15:59:49 2000 +++ debug.rb Fri Jun 23 22:00:12 2000 @@ -8,4 +8,12 @@ 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 @@ -81,4 +89,5 @@ class DEBUGGER__ @frames = [] @finish_pos = 0 + @trace = false end @@ -217,4 +226,18 @@ class DEBUGGER__ 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 @@ -446,4 +469,5 @@ Commands 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 @@ -573,4 +597,5 @@ EOHELP def trace_func(event, file, line, id, binding, klass) + Tracer.trace_func(event, file, line, id, binding) if @trace @file = file @line = line