From f5b3d426c86ae0513d608ccafcfe4168d683000d Mon Sep 17 00:00:00 2001 From: nahi Date: Sun, 27 Jul 2003 05:49:03 +0000 Subject: * lib/debug.rb: fix breakpoint parameter parsing/checking. (?:(file|class):)(line_number|method) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4180 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 15 ++++++++++----- lib/debug.rb | 47 +++++++++++++++++++++++++---------------------- 2 files changed, 35 insertions(+), 27 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6975b435cc..cbf70afab6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sun Jul 27 14:43:37 2003 NAKAMURA, Hiroshi + + * lib/debug.rb: fix breakpoint parameter parsing/checking. + (?:(file|class):)(line_number|method) + Sun Jul 27 10:21:28 2003 Masatoshi SEKI * lib/drb/unix.rb: add UNIXFileOwner, UNIXFileGroup. @@ -61,12 +66,12 @@ Sat Jul 26 01:20:29 2003 Yukihiro Matsumoto Fri Jul 26 00:04:25 2003 NAKAMURA, Hiroshi - * ext/openssl/sample: Add samples. - - cert2text.rb: Dump certificate file as text. + * ext/openssl/sample: add samples. + - cert2text.rb: dump certificate file as text. - crlstore.rb: CRL store implementation. Fetch CRL via HTTP when http-access2 is installed. - - certstore.rb: Certificate store implementation. - - cert_store_view.rb: Certificate store viewer with FXRuby. Uses + - certstore.rb: certificate store implementation. + - cert_store_view.rb: certificate store viewer with FXRuby. Uses c_rehash.rb, crlstore.rb and certstore.rb. Fri Jul 25 15:47:39 2003 GOTOU Yuuzou @@ -908,7 +913,7 @@ Fri Jun 20 03:09:21 2003 Yukihiro Matsumoto Fri Jun 20 00:45:19 2003 NAKAMURA, Hiroshi - * lib/csv.rb: Import csv module. + * lib/csv.rb: import csv module. Thu Jun 19 22:51:41 2003 Masatoshi SEKI diff --git a/lib/debug.rb b/lib/debug.rb index 74026233c7..9126a11b5f 100644 --- a/lib/debug.rb +++ b/lib/debug.rb @@ -1,5 +1,6 @@ # Copyright (C) 2000 Network Applied Communication Laboratory, Inc. # Copyright (C) 2000 Information-technology Promotion Agency, Japan +# Copyright (C) 2000-2003 NAKAMURA, Hiroshi if $SAFE > 0 STDERR.print "-r debug.rb is not available in safe mode\n" @@ -299,23 +300,24 @@ class Context stdout.print "Trace off.\n" end - when /^\s*b(?:reak)?\s+(.+)[#.](.+)$/ - pos = $2.intern.id2name - file = debug_eval($1, binding) - break_points.push [true, 0, file, pos] - stdout.printf "Set breakpoint %d at %s.%s\n", break_points.size, file, pos - - when /^\s*b(?:reak)?\s+(?:(.+):)?(.+)$/ + when /^\s*b(?:reak)?\s+(?:(.+):)?([^.:]+)$/ pos = $2 - file = File.basename($1 || file) + file = $1 || file + klass = debug_silent_eval($1, binding) if pos =~ /^\d+$/ pname = pos pos = pos.to_i else pname = pos = pos.intern.id2name end - break_points.push [true, 0, file, pos] - stdout.printf "Set breakpoint %d at %s:%s\n", break_points.size, file, pname + break_points.push [true, 0, klass || file, pos] + stdout.printf "Set breakpoint %d at %s:%s\n", break_points.size, klass || file, pname + + when /^\s*b(?:reak)?\s+(.+)[#.]([^.:]+)$/ + pos = $2.intern.id2name + klass = debug_eval($1, binding) + break_points.push [true, 0, klass, pos] + stdout.printf "Set breakpoint %d at %s.%s\n", break_points.size, klass, pos when /^\s*wat(?:ch)?\s+(.+)$/ exp = $1 @@ -537,7 +539,8 @@ class Context stdout.print < + b[reak] [file|class:] + b[reak] [class.] set breakpoint to some position wat[ch] set watchpoint to some expression cat[ch] set catchpoint to an exception @@ -652,16 +655,18 @@ EOHELP end end - def check_break_points(file, pos, binding, id) + def check_break_points(file, klass, pos, binding, id) return false if break_points.empty? -# file = File.basename(file) n = 1 for b in break_points - if b[0] - if b[1] == 0 and b[2] == file and b[3] == pos - stdout.printf "Breakpoint %d, %s at %s:%s\n", n, debug_funcname(id), file, pos - return true - elsif b[1] == 1 + if b[0] # valid + if b[1] == 0 # breakpoint + if (b[2] == file and b[3] == pos) or + (klass and b[2] == klass and b[3] == pos) + stdout.printf "Breakpoint %d, %s at %s:%s\n", n, debug_funcname(id), file, pos + return true + end + elsif b[1] == 1 # watchpoint if debug_silent_eval(b[2], binding) stdout.printf "Watchpoint %d, %s at %s:%s\n", n, debug_funcname(id), file, pos return true @@ -709,7 +714,7 @@ EOHELP else # nothing to do. skipped. end - if @stop_next == 0 or check_break_points(file, line, binding, id) + if @stop_next == 0 or check_break_points(file, nil, line, binding, id) @no_step = nil suspend_all debug_command(file, line, id, binding) @@ -717,9 +722,7 @@ EOHELP when 'call' @frames.unshift [binding, file, line, id] - if check_break_points(file, id.id2name, binding, id) or - check_break_points(klass.to_s, id.id2name, binding, id) or - check_break_points(klass, id.id2name, binding, id) + if check_break_points(file, klass, id.id2name, binding, id) suspend_all debug_command(file, line, id, binding) end -- cgit v1.2.3