Class: Debugger::AddBreakpoint
- Inherits:
-
Command
- Object
- Command
- Debugger::AddBreakpoint
show all
- Defined in:
- lib/ruby-debug/commands/breakpoints.rb
Overview
Constant Summary
Constants inherited
from Command
Command::DEF_OPTIONS
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Command
commands, inherited, #initialize, load_commands, #match, method_missing, options
Class Method Details
.help(cmd) ⇒ Object
58
59
60
61
62
63
|
# File 'lib/ruby-debug/commands/breakpoints.rb', line 58
def help(cmd)
%{
b[reak] [file|class(:|.|#)]<line|method> [if expr] -
\tset breakpoint to some position, (optionally) if expr == true
}
end
|
.help_command ⇒ Object
54
55
56
|
# File 'lib/ruby-debug/commands/breakpoints.rb', line 54
def help_command
'break'
end
|
Instance Method Details
#execute ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/ruby-debug/commands/breakpoints.rb', line 20
def execute
if @match[1]
pos, _, _, expr = @match.captures
else
_, file, pos, expr = @match.captures
end
if file.nil?
file = File.basename(@state.file)
else
if pos !~ /^\d+$/
klass = debug_silent_eval(file)
if klass && !klass.kind_of?(Module)
print "Unknown class #{file}\n"
throw :debug_error
end
file = klass.name if klass
else
file = File.expand_path(file) if file.index(File::SEPARATOR) || \
File::ALT_SEPARATOR && file.index(File::ALT_SEPARATOR)
end
end
if pos =~ /^\d+$/
pos = pos.to_i
else
pos = pos.intern.id2name
end
b = Debugger.add_breakpoint file, pos, expr
print "Set breakpoint %d at %s:%s\n", b.id, file, pos.to_s
end
|
#regexp ⇒ Object
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/ruby-debug/commands/breakpoints.rb', line 5
def regexp
/ ^\s*
b(?:reak)?
\s+
(?:
(\d+) |
(.+?)[:.#]([^.:\s]+)
)
(?:\s+
if\s+(.+)
)?
$
/x
end
|