1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
nahi 2003-07-27 05:49:03 +00:00
parent 8d64baf2a8
commit f5b3d426c8
2 changed files with 35 additions and 27 deletions

View file

@ -1,3 +1,8 @@
Sun Jul 27 14:43:37 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
* lib/debug.rb: fix breakpoint parameter parsing/checking.
(?:(file|class):)(line_number|method)
Sun Jul 27 10:21:28 2003 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
* lib/drb/unix.rb: add UNIXFileOwner, UNIXFileGroup.
@ -61,12 +66,12 @@ Sat Jul 26 01:20:29 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
Fri Jul 26 00:04:25 2003 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>
* 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 <gotoyuzo@notwork.org>
@ -908,7 +913,7 @@ Fri Jun 20 03:09:21 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
Fri Jun 20 00:45:19 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
* lib/csv.rb: Import csv module.
* lib/csv.rb: import csv module.
Thu Jun 19 22:51:41 2003 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>

View file

@ -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 <nahi@ruby-lang.org>
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 <<EOHELP
Debugger help v.-0.002b
Commands
b[reak] [file:]<line|method>
b[reak] [file|class:]<line|method>
b[reak] [class.]<line|method>
set breakpoint to some position
wat[ch] <expression> set watchpoint to some expression
cat[ch] <an Exception> 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