* 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:
parent
8d64baf2a8
commit
f5b3d426c8
15
ChangeLog
15
ChangeLog
@ -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>
|
Sun Jul 27 10:21:28 2003 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
|
||||||
|
|
||||||
* lib/drb/unix.rb: add UNIXFileOwner, UNIXFileGroup.
|
* 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>
|
Fri Jul 26 00:04:25 2003 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>
|
||||||
|
|
||||||
* ext/openssl/sample: Add samples.
|
* ext/openssl/sample: add samples.
|
||||||
- cert2text.rb: Dump certificate file as text.
|
- cert2text.rb: dump certificate file as text.
|
||||||
- crlstore.rb: CRL store implementation. Fetch CRL via HTTP when
|
- crlstore.rb: CRL store implementation. Fetch CRL via HTTP when
|
||||||
http-access2 is installed.
|
http-access2 is installed.
|
||||||
- certstore.rb: Certificate store implementation.
|
- certstore.rb: certificate store implementation.
|
||||||
- cert_store_view.rb: Certificate store viewer with FXRuby. Uses
|
- cert_store_view.rb: certificate store viewer with FXRuby. Uses
|
||||||
c_rehash.rb, crlstore.rb and certstore.rb.
|
c_rehash.rb, crlstore.rb and certstore.rb.
|
||||||
|
|
||||||
Fri Jul 25 15:47:39 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
|
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>
|
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>
|
Thu Jun 19 22:51:41 2003 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
|
||||||
|
|
||||||
|
47
lib/debug.rb
47
lib/debug.rb
@ -1,5 +1,6 @@
|
|||||||
# Copyright (C) 2000 Network Applied Communication Laboratory, Inc.
|
# Copyright (C) 2000 Network Applied Communication Laboratory, Inc.
|
||||||
# Copyright (C) 2000 Information-technology Promotion Agency, Japan
|
# Copyright (C) 2000 Information-technology Promotion Agency, Japan
|
||||||
|
# Copyright (C) 2000-2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
|
||||||
|
|
||||||
if $SAFE > 0
|
if $SAFE > 0
|
||||||
STDERR.print "-r debug.rb is not available in safe mode\n"
|
STDERR.print "-r debug.rb is not available in safe mode\n"
|
||||||
@ -299,23 +300,24 @@ class Context
|
|||||||
stdout.print "Trace off.\n"
|
stdout.print "Trace off.\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
when /^\s*b(?:reak)?\s+(.+)[#.](.+)$/
|
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+(?:(.+):)?(.+)$/
|
|
||||||
pos = $2
|
pos = $2
|
||||||
file = File.basename($1 || file)
|
file = $1 || file
|
||||||
|
klass = debug_silent_eval($1, binding)
|
||||||
if pos =~ /^\d+$/
|
if pos =~ /^\d+$/
|
||||||
pname = pos
|
pname = pos
|
||||||
pos = pos.to_i
|
pos = pos.to_i
|
||||||
else
|
else
|
||||||
pname = pos = pos.intern.id2name
|
pname = pos = pos.intern.id2name
|
||||||
end
|
end
|
||||||
break_points.push [true, 0, file, pos]
|
break_points.push [true, 0, klass || file, pos]
|
||||||
stdout.printf "Set breakpoint %d at %s:%s\n", break_points.size, file, pname
|
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+(.+)$/
|
when /^\s*wat(?:ch)?\s+(.+)$/
|
||||||
exp = $1
|
exp = $1
|
||||||
@ -537,7 +539,8 @@ class Context
|
|||||||
stdout.print <<EOHELP
|
stdout.print <<EOHELP
|
||||||
Debugger help v.-0.002b
|
Debugger help v.-0.002b
|
||||||
Commands
|
Commands
|
||||||
b[reak] [file:]<line|method>
|
b[reak] [file|class:]<line|method>
|
||||||
|
b[reak] [class.]<line|method>
|
||||||
set breakpoint to some position
|
set breakpoint to some position
|
||||||
wat[ch] <expression> set watchpoint to some expression
|
wat[ch] <expression> set watchpoint to some expression
|
||||||
cat[ch] <an Exception> set catchpoint to an exception
|
cat[ch] <an Exception> set catchpoint to an exception
|
||||||
@ -652,16 +655,18 @@ EOHELP
|
|||||||
end
|
end
|
||||||
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?
|
return false if break_points.empty?
|
||||||
# file = File.basename(file)
|
|
||||||
n = 1
|
n = 1
|
||||||
for b in break_points
|
for b in break_points
|
||||||
if b[0]
|
if b[0] # valid
|
||||||
if b[1] == 0 and b[2] == file and b[3] == pos
|
if b[1] == 0 # breakpoint
|
||||||
stdout.printf "Breakpoint %d, %s at %s:%s\n", n, debug_funcname(id), file, pos
|
if (b[2] == file and b[3] == pos) or
|
||||||
return true
|
(klass and b[2] == klass and b[3] == pos)
|
||||||
elsif b[1] == 1
|
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)
|
if debug_silent_eval(b[2], binding)
|
||||||
stdout.printf "Watchpoint %d, %s at %s:%s\n", n, debug_funcname(id), file, pos
|
stdout.printf "Watchpoint %d, %s at %s:%s\n", n, debug_funcname(id), file, pos
|
||||||
return true
|
return true
|
||||||
@ -709,7 +714,7 @@ EOHELP
|
|||||||
else
|
else
|
||||||
# nothing to do. skipped.
|
# nothing to do. skipped.
|
||||||
end
|
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
|
@no_step = nil
|
||||||
suspend_all
|
suspend_all
|
||||||
debug_command(file, line, id, binding)
|
debug_command(file, line, id, binding)
|
||||||
@ -717,9 +722,7 @@ EOHELP
|
|||||||
|
|
||||||
when 'call'
|
when 'call'
|
||||||
@frames.unshift [binding, file, line, id]
|
@frames.unshift [binding, file, line, id]
|
||||||
if check_break_points(file, id.id2name, binding, id) or
|
if check_break_points(file, klass, id.id2name, binding, id)
|
||||||
check_break_points(klass.to_s, id.id2name, binding, id) or
|
|
||||||
check_break_points(klass, id.id2name, binding, id)
|
|
||||||
suspend_all
|
suspend_all
|
||||||
debug_command(file, line, id, binding)
|
debug_command(file, line, id, binding)
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user