なひです.

> From: NAKAMURA, Hiroshi
> Sent: Sunday, August 27, 2000 8:50 PM

> というわけでPatchです.debug_evalは:debug_errorをthrowして

駄目だこれじゃwatch式がfalseの時に他のスレッドをブロックしてしまう.
[ruby-dev:10687]は捨ててください.

check_break_point全体でロックを管理するようにしました.

# 若干遅くなるかも知れず.
# debug_safe_eval -> debug_silent_evalに名称変更.

--- debug.rb-1.5.dist	Tue Aug 15 17:45:23 2000
+++ debug.rb	Mon Aug 28 12:55:09 2000
@@ -120,4 +120,13 @@
     end
 
+    def debug_silent_eval(str, binding)
+      begin
+	val = eval(str, binding)
+	val
+      rescue StandardError, ScriptError
+	nil
+      end
+    end
+
     def var_list(ary, binding)
       ary.sort!
@@ -308,7 +317,7 @@
 	  when /^\s*disp(?:lay)?\s+(.+)$/
 	    exp = $1
-	    display.push.push [true, exp]
-	    stdout.printf "  %d: %s = %s\n", display.size, exp,
-	      eval(exp, binding) rescue "--"
+	    display.push [true, exp]
+	    stdout.printf "%d: ", display.size
+	    display_expression(exp, binding)
 
 	  when /^\s*disp(?:lay)?$/
@@ -494,5 +503,6 @@
       for d in display
 	if d[0]
-	  stdout.printf "%d: %s = %s\n", n, d[1], debug_eval(d[1], binding).to_s
+          stdout.printf "%d: ", n
+	  display_expression(d[1], binding)
 	end
 	n += 1
@@ -500,4 +510,8 @@
     end
 
+    def display_expression(exp, binding)
+      stdout.printf "%s = %s\n", exp, debug_silent_eval(exp, binding).to_s
+    end
+
     def frame_set_pos(file, line)
       if @frames[0]
@@ -560,4 +574,6 @@
 
     def check_break_points(file, pos, binding, id)
+      return false if break_points.empty?
+      MUTEX.lock
       file = File.basename(file)
       n = 1
@@ -565,15 +581,16 @@
 	if b[0]
 	  if b[1] == 0 and b[2] == file and b[3] == pos
-	    MUTEX.lock
 	    stdout.printf "breakpoint %d, %s at %s:%s\n", n, debug_funcname(id), file, pos
 	    return true
-	  elsif b[1] == 1 and debug_eval(b[2], binding)
-	    MUTEX.lock
-	    stdout.printf "watchpoint %d, %s at %s:%s\n", n, debug_funcname(id), file, pos
-	    return true
+	  elsif b[1] == 1
+	    if debug_silent_eval(b[2], binding)
+	      stdout.printf "watchpoint %d, %s at %s:%s\n", n, debug_funcname(id), file, pos
+	      return true
+	    end
 	  end
 	end
 	n += 1
       end
+      MUTEX.unlock
       return false
     end