ruby-debug 0.10.1 → 0.10.2
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 +7 -0
- data/ChangeLog +315 -278
- data/Rakefile +6 -6
- data/bin/rdebug +7 -3
- data/cli/ruby-debug.rb +2 -2
- data/cli/ruby-debug/commands/breakpoints.rb +15 -15
- data/cli/ruby-debug/commands/catchpoint.rb +18 -6
- data/cli/ruby-debug/commands/continue.rb +12 -6
- data/cli/ruby-debug/commands/info.rb +3 -3
- data/cli/ruby-debug/commands/irb.rb +2 -2
- data/cli/ruby-debug/commands/list.rb +1 -1
- data/cli/ruby-debug/commands/method.rb +44 -2
- data/cli/ruby-debug/commands/save.rb +16 -6
- data/cli/ruby-debug/commands/set.rb +11 -8
- data/cli/ruby-debug/commands/show.rb +28 -24
- data/cli/ruby-debug/commands/trace.rb +35 -11
- data/cli/ruby-debug/commands/variables.rb +47 -4
- data/cli/ruby-debug/interface.rb +28 -8
- data/cli/ruby-debug/processor.rb +6 -4
- data/rdbg.rb +0 -0
- data/test/base/base.rb +0 -0
- data/test/base/binding.rb +0 -0
- data/test/base/catchpoint.rb +0 -0
- data/test/bp_loop_issue.rb +3 -0
- data/test/classes.rb +11 -0
- data/test/cli/commands/catchpoint_test.rb +35 -0
- data/test/data/break_loop_bug.cmd +5 -0
- data/test/data/break_loop_bug.right +15 -0
- data/test/data/breakpoints.cmd +1 -1
- data/test/data/breakpoints.right +8 -12
- data/test/data/catch.cmd +17 -0
- data/test/data/catch.right +37 -0
- data/test/data/emacs_basic.right +2 -7
- data/test/data/frame.cmd +3 -0
- data/test/data/frame.right +4 -0
- data/test/data/method.cmd +10 -0
- data/test/data/method.right +21 -0
- data/test/data/methodsig.cmd +10 -0
- data/test/data/methodsig.right +20 -0
- data/test/data/output.right +0 -10
- data/test/data/quit.right +0 -9
- data/test/data/raise.right +1 -1
- data/test/data/save.cmd +33 -0
- data/test/data/save.right +59 -0
- data/test/data/setshow.cmd +13 -0
- data/test/data/setshow.right +25 -0
- data/test/dollar-0.rb +0 -0
- data/test/gcd-dbg.rb +0 -0
- data/test/helper.rb +24 -2
- data/test/pm-base.rb +0 -0
- data/test/pm.rb +0 -0
- data/test/raise.rb +0 -0
- data/test/tdebug.rb +5 -6
- data/test/test-annotate.rb +0 -0
- data/test/test-break-bad.rb +11 -0
- data/test/test-breakpoints.rb +0 -0
- data/test/test-catch.rb +25 -0
- data/test/test-condition.rb +0 -0
- data/test/test-ctrl.rb +0 -0
- data/test/test-display.rb +0 -0
- data/test/test-dollar-0.rb +0 -0
- data/test/test-edit.rb +0 -0
- data/test/test-emacs-basic.rb +2 -2
- data/test/test-enable.rb +0 -0
- data/test/test-finish.rb +0 -0
- data/test/test-frame.rb +11 -3
- data/test/test-help.rb +0 -0
- data/test/test-hist.rb +0 -0
- data/test/test-info-thread.rb +0 -0
- data/test/test-info-var.rb +0 -0
- data/test/test-info.rb +0 -0
- data/test/test-init.rb +3 -1
- data/test/test-list.rb +0 -0
- data/test/test-method.rb +34 -0
- data/test/test-output.rb +0 -0
- data/test/test-pm.rb +0 -0
- data/test/test-quit.rb +0 -0
- data/test/test-raise.rb +0 -0
- data/test/test-save.rb +25 -0
- data/test/test-setshow.rb +0 -0
- data/test/test-source.rb +0 -0
- data/test/test-stepping.rb +0 -0
- data/test/test-trace.rb +0 -0
- metadata +178 -155
- data/cli/ruby-debug/commands/disassemble.RB +0 -38
- data/test/except-bug2.rb +0 -7
@@ -0,0 +1,37 @@
|
|
1
|
+
pm.rb:3
|
2
|
+
def zero_div
|
3
|
+
# # ***************************************************
|
4
|
+
# # Test catch
|
5
|
+
# # ***************************************************
|
6
|
+
# set debuggertesting on
|
7
|
+
Currently testing the debugger is on.
|
8
|
+
# set autoeval off
|
9
|
+
autoeval is off.
|
10
|
+
# set basename on
|
11
|
+
basename is on.
|
12
|
+
# info catch
|
13
|
+
No exceptions set to be caught.
|
14
|
+
# catch ZeroDivisionError off
|
15
|
+
*** Catch for exception ZeroDivisionError not found.
|
16
|
+
# catch ZeroDivisionError off afdasdf
|
17
|
+
*** Unknown command: "catch ZeroDivisionError off afdasdf". Try "help".
|
18
|
+
# catch ZeroDivisionError
|
19
|
+
Catch exception ZeroDivisionError.
|
20
|
+
# info catch
|
21
|
+
ZeroDivisionError
|
22
|
+
# catch ZeroDivisionError off
|
23
|
+
Catch for exception ZeroDivisionError removed.
|
24
|
+
# info catch
|
25
|
+
No exceptions set to be caught.
|
26
|
+
# catch ZeroDivisionError
|
27
|
+
Catch exception ZeroDivisionError.
|
28
|
+
# c
|
29
|
+
Catchpoint at pm.rb:5: `divided by 0' (ZeroDivisionError)
|
30
|
+
from ../rdbg.rb:23:in `runner'
|
31
|
+
from ../rdbg.rb:32
|
32
|
+
pm.rb:5
|
33
|
+
1/0
|
34
|
+
# where
|
35
|
+
--> #0 Object./ at line pm.rb:5
|
36
|
+
#1 at line pm.rb:8
|
37
|
+
# quit
|
data/test/data/emacs_basic.right
CHANGED
@@ -42,9 +42,8 @@ return nil if a <= 0
|
|
42
42
|
# info program
|
43
43
|
Program stopped. It stopped at a breakpoint.
|
44
44
|
# c 10
|
45
|
-
|
46
|
-
|
47
|
-
def gcd(a, b)
|
45
|
+
gcd.rb:10
|
46
|
+
return nil if a <= 0
|
48
47
|
# info break
|
49
48
|
Num Enb What
|
50
49
|
1 y at gcd.rb:6
|
@@ -52,7 +51,6 @@ Num Enb What
|
|
52
51
|
2 y at gcd.rb:10
|
53
52
|
breakpoint already hit 1 time
|
54
53
|
3 y at Object:gcd
|
55
|
-
breakpoint already hit 1 time
|
56
54
|
# break foo
|
57
55
|
*** Invalid breakpoint location: foo.
|
58
56
|
# info break
|
@@ -62,7 +60,6 @@ Num Enb What
|
|
62
60
|
2 y at gcd.rb:10
|
63
61
|
breakpoint already hit 1 time
|
64
62
|
3 y at Object:gcd
|
65
|
-
breakpoint already hit 1 time
|
66
63
|
# disable 1
|
67
64
|
# info break
|
68
65
|
Num Enb What
|
@@ -71,7 +68,6 @@ Num Enb What
|
|
71
68
|
2 y at gcd.rb:10
|
72
69
|
breakpoint already hit 1 time
|
73
70
|
3 y at Object:gcd
|
74
|
-
breakpoint already hit 1 time
|
75
71
|
# enable breakpoint 1
|
76
72
|
# enable br 10
|
77
73
|
Enable breakpoints argument '10' needs to at most 3.
|
@@ -82,7 +78,6 @@ Num Enb What
|
|
82
78
|
2 y at gcd.rb:10
|
83
79
|
breakpoint already hit 1 time
|
84
80
|
3 y at Object:gcd
|
85
|
-
breakpoint already hit 1 time
|
86
81
|
# # We should still be able to access 2
|
87
82
|
# disable 2
|
88
83
|
# enable
|
data/test/data/frame.cmd
CHANGED
data/test/data/frame.right
CHANGED
@@ -7,6 +7,10 @@ def gcd(a, b)
|
|
7
7
|
Currently testing the debugger is on.
|
8
8
|
# set callstyle last
|
9
9
|
Frame call-display style is last.
|
10
|
+
# # Invalid line number in continue command
|
11
|
+
# continue 3
|
12
|
+
*** Line 3 is not a stopping point in file "gcd.rb".
|
13
|
+
# # This time, for sure!
|
10
14
|
# continue 6
|
11
15
|
gcd.rb:6
|
12
16
|
if a > b
|
@@ -0,0 +1,21 @@
|
|
1
|
+
classes.rb:1
|
2
|
+
class Mine
|
3
|
+
# # ********************************************************
|
4
|
+
# # This tests the 'method' command
|
5
|
+
# # ********************************************************
|
6
|
+
# set debuggertesting on
|
7
|
+
Currently testing the debugger is on.
|
8
|
+
# set autoeval off
|
9
|
+
autoeval is off.
|
10
|
+
# b 11
|
11
|
+
Breakpoint 1 file ./classes.rb, line 11
|
12
|
+
# c
|
13
|
+
Breakpoint 1 at classes.rb:11
|
14
|
+
classes.rb:11
|
15
|
+
metoo = Mine(new)
|
16
|
+
# method Mine
|
17
|
+
mymethod
|
18
|
+
|
19
|
+
# m iv me
|
20
|
+
@myvar = "init"
|
21
|
+
# quit
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# ********************************************************
|
2
|
+
# This tests the 'method' command
|
3
|
+
# ********************************************************
|
4
|
+
set debuggertesting on
|
5
|
+
set autoeval off
|
6
|
+
b 3
|
7
|
+
c
|
8
|
+
method sig initialize
|
9
|
+
method sig mymethod
|
10
|
+
quit
|
@@ -0,0 +1,20 @@
|
|
1
|
+
classes.rb:1
|
2
|
+
class Mine
|
3
|
+
# # ********************************************************
|
4
|
+
# # This tests the 'method' command
|
5
|
+
# # ********************************************************
|
6
|
+
# set debuggertesting on
|
7
|
+
Currently testing the debugger is on.
|
8
|
+
# set autoeval off
|
9
|
+
autoeval is off.
|
10
|
+
# b 3
|
11
|
+
Breakpoint 1 file ./classes.rb, line 3
|
12
|
+
# c
|
13
|
+
Breakpoint 1 at classes.rb:3
|
14
|
+
classes.rb:3
|
15
|
+
@myvar = 'init'
|
16
|
+
# method sig initialize
|
17
|
+
Mine#initialize()
|
18
|
+
# method sig mymethod
|
19
|
+
Mine#mymethod(a, b=5, &block)
|
20
|
+
# quit
|
data/test/data/output.right
CHANGED
data/test/data/quit.right
CHANGED
@@ -1,9 +0,0 @@
|
|
1
|
-
tdebug.rb:53
|
2
|
-
if bt
|
3
|
-
# # ***************************************************
|
4
|
-
# # This tests the quit.
|
5
|
-
# # ***************************************************
|
6
|
-
# set debuggertesting on
|
7
|
-
Currently testing the debugger is on.
|
8
|
-
# # FIXME need to test --no-quit.
|
9
|
-
# quit
|
data/test/data/raise.right
CHANGED
data/test/data/save.cmd
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# This tests the functioning of some set/show debugger commands
|
2
|
+
set debuggertesting on
|
3
|
+
### *******************************
|
4
|
+
### *** save/source commands ***
|
5
|
+
### *******************************
|
6
|
+
########################################
|
7
|
+
### test args and baseneme...
|
8
|
+
########################################
|
9
|
+
set basename off
|
10
|
+
set autoeval off
|
11
|
+
# Should have nothing set
|
12
|
+
info break
|
13
|
+
info catch
|
14
|
+
# Should save nothing
|
15
|
+
save temp
|
16
|
+
eval File.open("temp").readlines
|
17
|
+
# Should read in nothing
|
18
|
+
source temp
|
19
|
+
info break
|
20
|
+
# Now try saving something interesting
|
21
|
+
break 10
|
22
|
+
catch RuntimeError
|
23
|
+
save temp
|
24
|
+
eval File.open("temp").readlines
|
25
|
+
# FIXME: The below is broken
|
26
|
+
## Change parameters above
|
27
|
+
## catch RuntimeError off
|
28
|
+
## info catch
|
29
|
+
##set listsize 55
|
30
|
+
source temp
|
31
|
+
##info break
|
32
|
+
##info catch
|
33
|
+
##show listsize
|
@@ -0,0 +1,59 @@
|
|
1
|
+
gcd.rb:4
|
2
|
+
def gcd(a, b)
|
3
|
+
# # This tests the functioning of some set/show debugger commands
|
4
|
+
# set debuggertesting on
|
5
|
+
Currently testing the debugger is on.
|
6
|
+
# ### *******************************
|
7
|
+
# ### *** save/source commands ***
|
8
|
+
# ### *******************************
|
9
|
+
# ########################################
|
10
|
+
# ### test args and baseneme...
|
11
|
+
# ########################################
|
12
|
+
# set basename off
|
13
|
+
basename is off.
|
14
|
+
# set autoeval off
|
15
|
+
autoeval is off.
|
16
|
+
# # Should have nothing set
|
17
|
+
# info break
|
18
|
+
No breakpoints.
|
19
|
+
# info catch
|
20
|
+
No exceptions set to be caught.
|
21
|
+
# # Should save nothing
|
22
|
+
# save temp
|
23
|
+
Saved to 'temp'
|
24
|
+
# eval File.open("temp").readlines
|
25
|
+
["set autoeval off\n", "set basename off\n", "set debuggertesting on\n", "set autolist off\n", "set autoirb off\n"]
|
26
|
+
# # Should read in nothing
|
27
|
+
# source temp
|
28
|
+
autoeval is off.
|
29
|
+
basename is off.
|
30
|
+
Currently testing the debugger is on.
|
31
|
+
autolist is off.
|
32
|
+
autoirb is off.
|
33
|
+
# info break
|
34
|
+
No breakpoints.
|
35
|
+
# # Now try saving something interesting
|
36
|
+
# break 10
|
37
|
+
Breakpoint 1 file ./gcd.rb, line 10
|
38
|
+
# catch RuntimeError
|
39
|
+
Catch exception RuntimeError.
|
40
|
+
# save temp
|
41
|
+
Saved to 'temp'
|
42
|
+
# eval File.open("temp").readlines
|
43
|
+
["break gcd.rb:10\n", "catch RuntimeError\n", "set autoeval off\n", "set basename on\n", "set debuggertesting on\n", "set autolist off\n", "set autoirb off\n"]
|
44
|
+
# # FIXME: The below is broken
|
45
|
+
# ## Change parameters above
|
46
|
+
# ## catch RuntimeError off
|
47
|
+
# ## info catch
|
48
|
+
# ##set listsize 55
|
49
|
+
# source temp
|
50
|
+
Breakpoint 2 file gcd.rb, line 10
|
51
|
+
Catch exception RuntimeError.
|
52
|
+
autoeval is off.
|
53
|
+
basename is on.
|
54
|
+
Currently testing the debugger is on.
|
55
|
+
autolist is off.
|
56
|
+
autoirb is off.
|
57
|
+
# ##info break
|
58
|
+
# ##info catch
|
59
|
+
# ##show listsize
|
data/test/data/setshow.cmd
CHANGED
@@ -41,3 +41,16 @@ set history save off
|
|
41
41
|
show history save
|
42
42
|
set history save 1
|
43
43
|
show history save
|
44
|
+
#### Test 'autoeval'...
|
45
|
+
set autoeval on
|
46
|
+
puts 'printed via autoeval'
|
47
|
+
set autoeval off
|
48
|
+
puts 'autoeval should not run this'
|
49
|
+
#### Test 'callstyle'...
|
50
|
+
set callstyle
|
51
|
+
set callstyle short
|
52
|
+
set callstyle last
|
53
|
+
set callstyle tracked
|
54
|
+
set callstyle foo
|
55
|
+
|
56
|
+
|
data/test/data/setshow.right
CHANGED
@@ -70,3 +70,28 @@ Saving of history save is off.
|
|
70
70
|
Saving of history save is on.
|
71
71
|
# show history save
|
72
72
|
Saving of history save is on.
|
73
|
+
# #### Test 'autoeval'...
|
74
|
+
# set autoeval on
|
75
|
+
autoeval is on.
|
76
|
+
# puts 'printed via autoeval'
|
77
|
+
printed via autoeval
|
78
|
+
nil
|
79
|
+
# set autoeval off
|
80
|
+
autoeval is off.
|
81
|
+
# puts 'autoeval should not run this'
|
82
|
+
*** Unknown command: "puts 'autoeval should not run this'". Try "help".
|
83
|
+
# #### Test 'callstyle'...
|
84
|
+
# set callstyle
|
85
|
+
Invalid call style . Should be one of: 'short', 'last', or 'tracked'.
|
86
|
+
Frame call-display style is last.
|
87
|
+
# set callstyle short
|
88
|
+
Frame call-display style is short.
|
89
|
+
# set callstyle last
|
90
|
+
Frame call-display style is last.
|
91
|
+
# set callstyle tracked
|
92
|
+
Frame call-display style is tracked.
|
93
|
+
# set callstyle foo
|
94
|
+
Invalid call style foo. Should be one of: 'short', 'last', or 'tracked'.
|
95
|
+
Frame call-display style is tracked.
|
96
|
+
#
|
97
|
+
#
|
data/test/dollar-0.rb
CHANGED
File without changes
|
data/test/gcd-dbg.rb
CHANGED
File without changes
|
data/test/helper.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# Some common routines used in testing.
|
2
2
|
|
3
3
|
require 'fileutils'
|
4
|
+
require 'yaml'
|
4
5
|
# require 'diff/lcs'
|
5
6
|
# require 'diff/lcs/hunk'
|
6
7
|
|
@@ -21,12 +22,13 @@ module TestHelper
|
|
21
22
|
end
|
22
23
|
|
23
24
|
ENV['RDEBUG'] = debug_pgm
|
25
|
+
|
24
26
|
if old_code
|
25
27
|
cmd = "/bin/sh #{File.join('..', 'runner.sh')} #{args} >#{outfile}"
|
26
28
|
else
|
27
|
-
cmd = "../rdbg.rb #{args}
|
29
|
+
cmd = "#{"#{load_ruby} #{load_params} "}../rdbg.rb #{args} > #{outfile}"
|
28
30
|
end
|
29
|
-
# puts cmd
|
31
|
+
# puts "'#{cmd}'"
|
30
32
|
output = `#{cmd}`
|
31
33
|
|
32
34
|
got_lines = File.read(outfile).split(/\n/)
|
@@ -112,6 +114,26 @@ module TestHelper
|
|
112
114
|
# # Handle the last remaining hunk
|
113
115
|
# output << oldhunk.diff(format) << '\n'
|
114
116
|
# end
|
117
|
+
|
118
|
+
# Loads key from the _config_._yaml_ file.
|
119
|
+
def config_load(key, may_be_nil=false, default_value='')
|
120
|
+
conf = File.join('config.private.yaml') # try private first
|
121
|
+
conf = File.join('config.yaml') unless File.exists?(conf)
|
122
|
+
value = YAML.load_file(conf)[key]
|
123
|
+
assert_not_nil(value, "#{key} is set in config.yaml") unless may_be_nil
|
124
|
+
value || default_value
|
125
|
+
end
|
126
|
+
module_function :config_load
|
115
127
|
|
128
|
+
def load_ruby
|
129
|
+
config_load('ruby', true)
|
130
|
+
end
|
131
|
+
module_function :load_ruby
|
132
|
+
|
133
|
+
def load_params
|
134
|
+
config_load('ruby_params', true)
|
135
|
+
end
|
136
|
+
module_function :load_params
|
137
|
+
|
116
138
|
end
|
117
139
|
|
data/test/pm-base.rb
CHANGED
File without changes
|
data/test/pm.rb
CHANGED
File without changes
|
data/test/raise.rb
CHANGED
File without changes
|
data/test/tdebug.rb
CHANGED
@@ -49,7 +49,7 @@ def debug_program(options)
|
|
49
49
|
end
|
50
50
|
$0[0..-1] = d0
|
51
51
|
end
|
52
|
-
bt = Debugger.debug_load(Debugger::PROG_SCRIPT, !options.nostop)
|
52
|
+
bt = Debugger.debug_load(Debugger::PROG_SCRIPT, !options.nostop, false)
|
53
53
|
if bt
|
54
54
|
if options.post_mortem
|
55
55
|
Debugger.handle_post_mortem(bt)
|
@@ -188,9 +188,12 @@ trap('INT') { Debugger.interrupt_last }
|
|
188
188
|
Debugger.wait_connection = false
|
189
189
|
Debugger.keep_frame_binding = options.frame_bind
|
190
190
|
|
191
|
-
#
|
191
|
+
# Add Debugger trace hook.
|
192
192
|
Debugger.start
|
193
193
|
|
194
|
+
# start control thread
|
195
|
+
Debugger.start_control(options.host, options.cport) if options.control
|
196
|
+
|
194
197
|
# activate post-mortem
|
195
198
|
Debugger.post_mortem if options.post_mortem
|
196
199
|
|
@@ -210,10 +213,6 @@ if $?.exitstatus != 0 and RUBY_PLATFORM !~ /mswin/
|
|
210
213
|
puts output
|
211
214
|
exit $?.exitstatus
|
212
215
|
end
|
213
|
-
# activate debugger
|
214
|
-
Debugger.start
|
215
|
-
# start control thread
|
216
|
-
Debugger.start_control(options.host, options.cport) if options.control
|
217
216
|
|
218
217
|
# load initrc script (e.g. .rdebugrc)
|
219
218
|
Debugger.run_init_script(StringIO.new) unless options.nx
|