ruby-debug 0.8.1 → 0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGES +15 -0
- data/cli/ruby-debug/command.rb +6 -0
- data/cli/ruby-debug/commands/breakpoints.rb +2 -1
- data/cli/ruby-debug/commands/eval.rb +34 -4
- data/cli/ruby-debug/commands/frame.rb +22 -2
- data/cli/ruby-debug/commands/help.rb +2 -1
- data/cli/ruby-debug/commands/settings.rb +14 -6
- data/cli/ruby-debug/commands/stepping.rb +8 -4
- data/cli/ruby-debug/interface.rb +1 -1
- data/cli/ruby-debug/processor.rb +2 -1
- metadata +3 -3
data/CHANGES
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
0.9
|
2
|
+
- Kernel#debugger method will start the debugger if it's not running.
|
3
|
+
- Added Context#stop_reason method.
|
4
|
+
- Calling a method with a block will create a new frame. This changes the behavior of 'next' command. So in order to step into a block, 'step' command must be used. That fixes bug #9629.
|
5
|
+
- Added the possibility to add a temporary context-specific breakpoint. Context#breakpoint and Context#set_breakpoint methods are added.
|
6
|
+
- 'cont' command now accepts a numerical parameter which implements 'Continue until line' behavior.
|
7
|
+
- Added new Context.frame_class method
|
8
|
+
- Added new 'framefullpath' setting.
|
9
|
+
- Added new 'frameclassname' setting.
|
10
|
+
- All Ruby's 'eval' and require/load methods create a new frame. Fixes bug #9686.
|
11
|
+
|
12
|
+
0.8.1
|
13
|
+
- Added a shortcut module 'debugger'. require "ruby-debug/debugger" will start the debugger and stop at the next line (similar to require 'debug').
|
14
|
+
- Fixed remote debugging.
|
15
|
+
|
1
16
|
0.8
|
2
17
|
- Extract the base debugger API into a separate gem (ruby-debug-base), so it will be easier to add a new interface.
|
3
18
|
- Added 'set autoirb' setting.
|
data/cli/ruby-debug/command.rb
CHANGED
@@ -42,9 +42,15 @@ module Debugger
|
|
42
42
|
def options
|
43
43
|
@options ||= {}
|
44
44
|
end
|
45
|
+
|
46
|
+
def setting(name)
|
47
|
+
class_variable_get("@@#{name}")
|
48
|
+
end
|
45
49
|
end
|
46
50
|
|
47
51
|
@@display_stack_trace = false
|
52
|
+
@@full_file_names = true
|
53
|
+
@@full_class_names = false
|
48
54
|
|
49
55
|
def initialize(state)
|
50
56
|
@state = state
|
@@ -1,6 +1,27 @@
|
|
1
1
|
module Debugger
|
2
|
+
module EvalFunctions
|
3
|
+
def run_with_binding
|
4
|
+
binding = @state.context ? get_binding : TOPLEVEL_BINDING
|
5
|
+
$__dbg_interface = @state.interface
|
6
|
+
eval(<<-EOC, binding)
|
7
|
+
def dbg_print(*args)
|
8
|
+
$__dbg_interface.print(*args)
|
9
|
+
end
|
10
|
+
def dbg_puts(*args)
|
11
|
+
$__dbg_interface.print(*args)
|
12
|
+
$__dbg_interface.print("\n")
|
13
|
+
end
|
14
|
+
EOC
|
15
|
+
yield binding
|
16
|
+
ensure
|
17
|
+
$__dbg_interface = nil
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
2
21
|
class EvalCommand < Command # :nodoc:
|
3
22
|
self.control = true
|
23
|
+
|
24
|
+
include EvalFunctions
|
4
25
|
|
5
26
|
def match(input)
|
6
27
|
@input = input
|
@@ -13,8 +34,9 @@ module Debugger
|
|
13
34
|
|
14
35
|
def execute
|
15
36
|
expr = @match ? @match.post_match : @input
|
16
|
-
|
17
|
-
|
37
|
+
run_with_binding do |b|
|
38
|
+
print "%s\n", debug_eval(expr, b).inspect
|
39
|
+
end
|
18
40
|
end
|
19
41
|
|
20
42
|
class << self
|
@@ -39,14 +61,22 @@ module Debugger
|
|
39
61
|
end
|
40
62
|
|
41
63
|
class PPCommand < Command # :nodoc:
|
64
|
+
self.control = true
|
65
|
+
|
66
|
+
include EvalFunctions
|
67
|
+
|
42
68
|
def regexp
|
43
69
|
/^\s*pp\s+/
|
44
70
|
end
|
45
71
|
|
46
72
|
def execute
|
47
73
|
out = StringIO.new
|
48
|
-
|
74
|
+
run_with_binding do |b|
|
75
|
+
PP.pp(debug_eval(@match.post_match, b), out)
|
76
|
+
end
|
49
77
|
print out.string
|
78
|
+
rescue
|
79
|
+
out.puts $!.message
|
50
80
|
end
|
51
81
|
|
52
82
|
class << self
|
@@ -56,7 +86,7 @@ module Debugger
|
|
56
86
|
|
57
87
|
def help(cmd)
|
58
88
|
%{
|
59
|
-
pp expression\tevaluate expression and print its value
|
89
|
+
pp expression\tevaluate expression and pretty-print its value
|
60
90
|
}
|
61
91
|
end
|
62
92
|
end
|
@@ -39,8 +39,28 @@ module Debugger
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def print_frame(pos, adjust = false)
|
42
|
-
file
|
43
|
-
|
42
|
+
file = @state.context.frame_file(pos)
|
43
|
+
line = @state.context.frame_line(pos)
|
44
|
+
id = @state.context.frame_method(pos)
|
45
|
+
klass = @state.context.frame_class(pos)
|
46
|
+
|
47
|
+
method = ""
|
48
|
+
if id
|
49
|
+
method << " in '"
|
50
|
+
method << "#{klass}." if Command.setting('full_class_names') && klass
|
51
|
+
method << id.id2name
|
52
|
+
method << "'"
|
53
|
+
end
|
54
|
+
|
55
|
+
unless Command.setting('full_file_names')
|
56
|
+
path_components = file.split(/[\\\/]/)
|
57
|
+
if path_components.size > 3
|
58
|
+
path_components[0...-3] = '...'
|
59
|
+
file = path_components.join(File::ALT_SEPARATOR || File::SEPARATOR)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
print "#%d %s:%d%s\n", pos, file, line, method
|
44
64
|
print "\032\032%s:%d\n", file, line if ENV['EMACS'] && adjust
|
45
65
|
end
|
46
66
|
end
|
@@ -7,12 +7,13 @@ module Debugger
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def execute
|
10
|
-
print "ruby-debug help v
|
10
|
+
print "ruby-debug help v#{Debugger::VERSION}\n"
|
11
11
|
cmds = @state.commands.select{ |cmd| [cmd.help_command].flatten.include?(@match[1]) }
|
12
12
|
unless cmds.empty?
|
13
13
|
help = cmds.map{ |cmd| cmd.help(@match[1]) }.join
|
14
14
|
print help.split("\n").reject{|l| l =~ /^\s*$/ }.map{|l| l.gsub(/^ +/, '')}.join("\n")
|
15
15
|
else
|
16
|
+
print "Type 'help <command-name>' for help on a specific command\n\n"
|
16
17
|
print "Available commands:\n"
|
17
18
|
cmds = @state.commands.map{ |cmd| cmd.help_command }
|
18
19
|
cmds = cmds.flatten.uniq.sort
|
@@ -16,7 +16,13 @@ module Debugger
|
|
16
16
|
print "autoeval is #{$1.nil? ? 'on' : 'off'}.\n"
|
17
17
|
when /^(no)?trace$/
|
18
18
|
@@display_stack_trace = $1.nil?
|
19
|
-
print "
|
19
|
+
print "Displaying stack trace is #{$1.nil? ? 'on' : 'off'}.\n"
|
20
|
+
when /^(no)?framefullpath$/
|
21
|
+
@@full_file_names = $1.nil?
|
22
|
+
print "Displaying frame's full file names is #{$1.nil? ? 'on' : 'off'}.\n"
|
23
|
+
when /^(no)?frameclassname$/
|
24
|
+
@@full_class_names = $1.nil?
|
25
|
+
print "Displaying frame's original class name is #{$1.nil? ? 'on' : 'off'}.\n"
|
20
26
|
when /^(no)?autoreload$/
|
21
27
|
Debugger.reload_source_on_change = $1.nil?
|
22
28
|
print "autoreload is #{$1.nil? ? 'on' : 'off'}.\n"
|
@@ -36,11 +42,13 @@ module Debugger
|
|
36
42
|
def help(cmd)
|
37
43
|
%{
|
38
44
|
set <setting>, where <setting>:
|
39
|
-
autolist
|
40
|
-
autoeval
|
41
|
-
autoreload
|
42
|
-
autoirb
|
43
|
-
trace
|
45
|
+
autolist - execute 'list' command on every breakpoint
|
46
|
+
autoeval - evaluate every unrecognized command
|
47
|
+
autoreload - enables automatic source code reloading
|
48
|
+
autoirb - debugger invokes IRB on every stop
|
49
|
+
trace - display stack trace when 'eval' raises exception
|
50
|
+
framefullpath - frame will display full file names
|
51
|
+
frameclassname - frame will display class names
|
44
52
|
To disable setting, use 'no' prefix, like 'noautolist'
|
45
53
|
}
|
46
54
|
end
|
@@ -19,7 +19,7 @@ module Debugger
|
|
19
19
|
|
20
20
|
def help(cmd)
|
21
21
|
%{
|
22
|
-
n[ext][ nnn]\
|
22
|
+
n[ext][ nnn]\tstep over once or nnn times
|
23
23
|
}
|
24
24
|
end
|
25
25
|
end
|
@@ -44,7 +44,7 @@ module Debugger
|
|
44
44
|
|
45
45
|
def help(cmd)
|
46
46
|
%{
|
47
|
-
s[tep][ nnn]\tstep (into methods)
|
47
|
+
s[tep][ nnn]\tstep (into methods) once or nnn times
|
48
48
|
}
|
49
49
|
end
|
50
50
|
end
|
@@ -82,10 +82,14 @@ module Debugger
|
|
82
82
|
|
83
83
|
class ContinueCommand < Command # :nodoc:
|
84
84
|
def regexp
|
85
|
-
/^\s*c(?:ont)?$/
|
85
|
+
/^\s*c(?:ont)?(?:\s+(\d+))?$/
|
86
86
|
end
|
87
87
|
|
88
88
|
def execute
|
89
|
+
if @match[1] && !@state.context.dead?
|
90
|
+
file = File.expand_path(@state.file)
|
91
|
+
@state.context.set_breakpoint(file, @match[1].to_i)
|
92
|
+
end
|
89
93
|
@state.proceed
|
90
94
|
end
|
91
95
|
|
@@ -96,7 +100,7 @@ module Debugger
|
|
96
100
|
|
97
101
|
def help(cmd)
|
98
102
|
%{
|
99
|
-
c[ont]\trun until program ends or
|
103
|
+
c[ont][ nnn]\trun until program ends or hits breakpoint or reaches line nnn
|
100
104
|
}
|
101
105
|
end
|
102
106
|
end
|
data/cli/ruby-debug/interface.rb
CHANGED
data/cli/ruby-debug/processor.rb
CHANGED
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
|
|
3
3
|
specification_version: 1
|
4
4
|
name: ruby-debug
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.
|
7
|
-
date: 2007-
|
6
|
+
version: "0.9"
|
7
|
+
date: 2007-04-01 13:18:02 -04:00
|
8
8
|
summary: Command line interface (CLI) for ruby-debug-base
|
9
9
|
require_paths:
|
10
10
|
- cli
|
@@ -78,5 +78,5 @@ dependencies:
|
|
78
78
|
requirements:
|
79
79
|
- - "="
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version: 0.
|
81
|
+
version: "0.9"
|
82
82
|
version:
|