ruby-debug 0.10.0 → 0.10.1

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.
Files changed (152) hide show
  1. data/CHANGES +94 -2
  2. data/ChangeLog +5225 -0
  3. data/README +30 -1
  4. data/Rakefile +55 -24
  5. data/bin/rdebug +249 -128
  6. data/cli/ruby-debug/command.rb +30 -3
  7. data/cli/ruby-debug/commands/breakpoints.rb +54 -24
  8. data/cli/ruby-debug/commands/catchpoint.rb +13 -12
  9. data/cli/ruby-debug/commands/condition.rb +49 -0
  10. data/cli/ruby-debug/commands/continue.rb +32 -0
  11. data/cli/ruby-debug/commands/control.rb +19 -43
  12. data/cli/ruby-debug/commands/disassemble.RB +38 -0
  13. data/cli/ruby-debug/commands/display.rb +1 -1
  14. data/cli/ruby-debug/commands/edit.rb +48 -0
  15. data/cli/ruby-debug/commands/enable.rb +78 -35
  16. data/cli/ruby-debug/commands/eval.rb +6 -5
  17. data/cli/ruby-debug/commands/finish.rb +42 -0
  18. data/cli/ruby-debug/commands/frame.rb +64 -33
  19. data/cli/ruby-debug/commands/help.rb +19 -15
  20. data/cli/ruby-debug/commands/info.rb +295 -36
  21. data/cli/ruby-debug/commands/irb.rb +3 -1
  22. data/cli/ruby-debug/commands/list.rb +27 -50
  23. data/cli/ruby-debug/commands/quit.rb +38 -0
  24. data/cli/ruby-debug/commands/reload.rb +40 -0
  25. data/cli/ruby-debug/commands/save.rb +80 -0
  26. data/cli/ruby-debug/commands/{settings.rb → set.rb} +50 -12
  27. data/cli/ruby-debug/commands/show.rb +83 -27
  28. data/cli/ruby-debug/commands/source.rb +36 -0
  29. data/cli/ruby-debug/commands/stepping.rb +36 -72
  30. data/cli/ruby-debug/commands/threads.rb +32 -23
  31. data/cli/ruby-debug/commands/variables.rb +34 -4
  32. data/cli/ruby-debug/helper.rb +10 -75
  33. data/cli/ruby-debug/interface.rb +72 -9
  34. data/cli/ruby-debug/processor.rb +203 -100
  35. data/doc/rdebug.1 +7 -2
  36. data/rdbg.rb +33 -0
  37. data/test/{test-ruby-debug-base.rb → base/base.rb} +27 -29
  38. data/test/base/binding.rb +31 -0
  39. data/test/base/catchpoint.rb +26 -0
  40. data/test/base/load.rb +40 -0
  41. data/test/data/annotate.cmd +29 -0
  42. data/test/data/annotate.right +137 -0
  43. data/test/data/break_bad.cmd +18 -0
  44. data/test/data/break_bad.right +28 -0
  45. data/test/data/breakpoints.cmd +38 -0
  46. data/test/data/breakpoints.right +98 -0
  47. data/test/data/condition.cmd +28 -0
  48. data/test/data/condition.right +65 -0
  49. data/test/data/ctrl.cmd +23 -0
  50. data/test/data/ctrl.right +69 -0
  51. data/test/{display.cmd → data/display.cmd} +7 -1
  52. data/test/{display.right → data/display.right} +13 -6
  53. data/test/data/dollar-0.right +2 -0
  54. data/test/data/dollar-0a.right +2 -0
  55. data/test/data/dollar-0b.right +2 -0
  56. data/test/data/edit.cmd +12 -0
  57. data/test/data/edit.right +19 -0
  58. data/test/{breakpoints.cmd → data/emacs_basic.cmd} +0 -0
  59. data/test/{breakpoints.right → data/emacs_basic.right} +24 -12
  60. data/test/data/enable.cmd +20 -0
  61. data/test/data/enable.right +36 -0
  62. data/test/data/finish.cmd +16 -0
  63. data/test/data/finish.right +43 -0
  64. data/test/{frame.cmd → data/frame.cmd} +2 -0
  65. data/test/{frame.right → data/frame.right} +8 -2
  66. data/test/{help.cmd → data/help.cmd} +8 -0
  67. data/test/data/help.right +21 -0
  68. data/test/data/history.right +7 -0
  69. data/test/data/info-thread.cmd +13 -0
  70. data/test/data/info-thread.right +37 -0
  71. data/test/data/info-var-bug2.cmd +5 -0
  72. data/test/data/info-var-bug2.right +10 -0
  73. data/test/{info-var.cmd → data/info-var.cmd} +3 -3
  74. data/test/{info-var.right → data/info-var.right} +20 -15
  75. data/test/{info.cmd → data/info.cmd} +10 -1
  76. data/test/data/info.right +65 -0
  77. data/test/data/linetrace.cmd +6 -0
  78. data/test/data/linetrace.right +32 -0
  79. data/test/data/linetracep.cmd +7 -0
  80. data/test/data/linetracep.right +25 -0
  81. data/test/data/list.cmd +19 -0
  82. data/test/data/list.right +127 -0
  83. data/test/data/noquit.right +1 -0
  84. data/test/data/output.cmd +6 -0
  85. data/test/data/output.right +41 -0
  86. data/test/data/post-mortem-next.cmd +8 -0
  87. data/test/data/post-mortem-next.right +14 -0
  88. data/test/data/post-mortem-osx.right +31 -0
  89. data/test/data/post-mortem.cmd +13 -0
  90. data/test/data/post-mortem.right +31 -0
  91. data/test/{quit.cmd → data/quit.cmd} +2 -5
  92. data/test/data/quit.right +9 -0
  93. data/test/data/raise.cmd +11 -0
  94. data/test/data/raise.right +26 -0
  95. data/test/{setshow.cmd → data/setshow.cmd} +0 -1
  96. data/test/{setshow.right → data/setshow.right} +0 -1
  97. data/test/data/source.cmd +5 -0
  98. data/test/data/source.right +15 -0
  99. data/test/{stepping.cmd → data/stepping.cmd} +6 -2
  100. data/test/{stepping.right → data/stepping.right} +13 -3
  101. data/test/data/test-init-cygwin.right +7 -0
  102. data/test/data/test-init-osx.right +4 -0
  103. data/test/data/test-init.right +5 -0
  104. data/test/data/trace.right +23 -0
  105. data/test/dollar-0.rb +5 -0
  106. data/test/except-bug2.rb +7 -0
  107. data/test/gcd-dbg-nox.rb +31 -0
  108. data/test/gcd-dbg.rb +30 -0
  109. data/test/helper.rb +44 -14
  110. data/test/info-var-bug.rb +2 -0
  111. data/test/info-var-bug2.rb +2 -0
  112. data/test/null.rb +1 -0
  113. data/test/output.rb +2 -0
  114. data/test/pm-base.rb +22 -0
  115. data/test/pm.rb +11 -0
  116. data/test/raise.rb +3 -0
  117. data/test/tdebug.rb +88 -40
  118. data/test/test-annotate.rb +25 -0
  119. data/test/test-break-bad.rb +25 -0
  120. data/test/test-breakpoints.rb +14 -17
  121. data/test/test-condition.rb +25 -0
  122. data/test/test-ctrl.rb +54 -0
  123. data/test/test-display.rb +15 -15
  124. data/test/test-dollar-0.rb +39 -0
  125. data/test/test-edit.rb +26 -0
  126. data/test/test-emacs-basic.rb +26 -0
  127. data/test/test-enable.rb +25 -0
  128. data/test/test-finish.rb +34 -0
  129. data/test/test-frame.rb +15 -16
  130. data/test/test-help.rb +34 -18
  131. data/test/test-hist.rb +68 -0
  132. data/test/test-info-thread.rb +32 -0
  133. data/test/test-info-var.rb +28 -14
  134. data/test/test-info.rb +15 -17
  135. data/test/test-init.rb +41 -0
  136. data/test/test-list.rb +25 -0
  137. data/test/test-output.rb +26 -0
  138. data/test/test-pm.rb +46 -0
  139. data/test/test-quit.rb +19 -17
  140. data/test/test-raise.rb +25 -0
  141. data/test/test-setshow.rb +14 -13
  142. data/test/test-source.rb +25 -0
  143. data/test/test-stepping.rb +14 -14
  144. data/test/test-trace.rb +63 -0
  145. data/test/thread1.rb +26 -0
  146. metadata +125 -31
  147. data/cli/ruby-debug/commands/script.rb +0 -64
  148. data/runner.sh +0 -7
  149. data/test/help.right +0 -4
  150. data/test/info.right +0 -35
  151. data/test/quit.right +0 -22
  152. data/test/test-columnize.rb +0 -46
@@ -0,0 +1,28 @@
1
+ gcd.rb:4
2
+ def gcd(a, b)
3
+ # # ********************************************************
4
+ # # This tests mostly invalid breakpoints.
5
+ # # We have some valid ones too.
6
+ # # ********************************************************
7
+ # set debuggertesting on
8
+ Currently testing the debugger is on.
9
+ # set callstyle last
10
+ Frame call-display style is last.
11
+ # set autoeval off
12
+ autoeval is off.
13
+ # # There aren't 100 lines in gcd.rb.
14
+ # break 100
15
+ *** There are only 18 lines in file "gcd.rb".
16
+ # break gcd.rb:100
17
+ *** There are only 18 lines in file "gcd.rb".
18
+ # # Line one isn't a valid stopping point.
19
+ # # It is a comment.
20
+ # break gcd.rb:1
21
+ *** Line 1 is not a stopping point in file "gcd.rb".
22
+ # # This line is okay
23
+ # break gcd.rb:4
24
+ Breakpoint 1 file gcd.rb, line 4
25
+ # # No class Foo.
26
+ # break Foo.bar
27
+ *** Unknown class Foo.
28
+ # quit
@@ -0,0 +1,38 @@
1
+ # ********************************************************
2
+ # This tests step, next, continue, disable and
3
+ # enable.
4
+ # FIXME: break out enable/disable
5
+ # ********************************************************
6
+ set debuggertesting on
7
+ set callstyle last
8
+ set autoeval off
9
+ break 6
10
+ break 10
11
+ break 11
12
+ continue
13
+ where
14
+ break Object.gcd
15
+ info break
16
+ continue
17
+ where
18
+ info program
19
+ c 10
20
+ info break
21
+ break foo
22
+ info break
23
+ disable 1
24
+ info break
25
+ delete 1
26
+ # We should see breakpoint 2 but not 1
27
+ info break
28
+ # We should still be able to access 2
29
+ disable 2
30
+ disable bar
31
+ disable
32
+ # We should be able to delete 2
33
+ delete 2 3
34
+ info break
35
+ # Should get a message about having no breakpoints.
36
+ disable 1
37
+ enable 1
38
+ quit
@@ -0,0 +1,98 @@
1
+ gcd.rb:4
2
+ def gcd(a, b)
3
+ # # ********************************************************
4
+ # # This tests step, next, continue, disable and
5
+ # # enable.
6
+ # # FIXME: break out enable/disable
7
+ # # ********************************************************
8
+ # set debuggertesting on
9
+ Currently testing the debugger is on.
10
+ # set callstyle last
11
+ Frame call-display style is last.
12
+ # set autoeval off
13
+ autoeval is off.
14
+ # break 6
15
+ Breakpoint 1 file ./gcd.rb, line 6
16
+ # break 10
17
+ Breakpoint 2 file ./gcd.rb, line 10
18
+ # break 11
19
+ *** Line 11 is not a stopping point in file "gcd.rb".
20
+ # continue
21
+ Breakpoint 1 at gcd.rb:6
22
+ gcd.rb:6
23
+ if a > b
24
+ # where
25
+ --> #0 Object.gcd(a#Fixnum, b#Fixnum) at line gcd.rb:6
26
+ #1 at line gcd.rb:18
27
+ # break Object.gcd
28
+ Breakpoint 3 at Object::gcd
29
+ # info break
30
+ Num Enb What
31
+ 1 y at gcd.rb:6
32
+ breakpoint already hit 1 time
33
+ 2 y at gcd.rb:10
34
+ 3 y at Object:gcd
35
+ # continue
36
+ Breakpoint 2 at gcd.rb:10
37
+ gcd.rb:10
38
+ return nil if a <= 0
39
+ # where
40
+ --> #0 Object.gcd(a#Fixnum, b#Fixnum) at line gcd.rb:10
41
+ #1 at line gcd.rb:18
42
+ # info program
43
+ Program stopped. It stopped at a breakpoint.
44
+ # c 10
45
+ Breakpoint 3 at Object:gcd
46
+ gcd.rb:4
47
+ def gcd(a, b)
48
+ # info break
49
+ Num Enb What
50
+ 1 y at gcd.rb:6
51
+ breakpoint already hit 1 time
52
+ 2 y at gcd.rb:10
53
+ breakpoint already hit 1 time
54
+ 3 y at Object:gcd
55
+ breakpoint already hit 1 time
56
+ # break foo
57
+ *** Invalid breakpoint location: foo.
58
+ # info break
59
+ Num Enb What
60
+ 1 y at gcd.rb:6
61
+ breakpoint already hit 1 time
62
+ 2 y at gcd.rb:10
63
+ breakpoint already hit 1 time
64
+ 3 y at Object:gcd
65
+ breakpoint already hit 1 time
66
+ # disable 1
67
+ # info break
68
+ Num Enb What
69
+ 1 n at gcd.rb:6
70
+ breakpoint already hit 1 time
71
+ 2 y at gcd.rb:10
72
+ breakpoint already hit 1 time
73
+ 3 y at Object:gcd
74
+ breakpoint already hit 1 time
75
+ # delete 1
76
+ # # We should see breakpoint 2 but not 1
77
+ # info break
78
+ Num Enb What
79
+ 2 y at gcd.rb:10
80
+ breakpoint already hit 1 time
81
+ 3 y at Object:gcd
82
+ breakpoint already hit 1 time
83
+ # # We should still be able to access 2
84
+ # disable 2
85
+ # disable bar
86
+ Disable breakpoints argument 'bar' needs to be a number.
87
+ # disable
88
+ *** "disable" must be followed "display", "breakpoints" or breakpoint numbers.
89
+ # # We should be able to delete 2
90
+ # delete 2 3
91
+ # info break
92
+ No breakpoints.
93
+ # # Should get a message about having no breakpoints.
94
+ # disable 1
95
+ *** No breakpoints have been set.
96
+ # enable 1
97
+ *** No breakpoints have been set.
98
+ # quit
@@ -0,0 +1,28 @@
1
+ # ********************************************************
2
+ # This tests primarily the condition command.
3
+ # In order to do this we need to run break, and disable
4
+ # ********************************************************
5
+ set debuggertesting on
6
+ set callstyle last
7
+ set autoeval off
8
+ break 6 if a > b
9
+ info break
10
+ condition 1
11
+ info break
12
+ break 12
13
+ condition 2 1 == a
14
+ # FIXME: should be able to catch error on:
15
+ # condition 2 if 1 == a
16
+ disable 1
17
+ continue
18
+ info break
19
+ p a
20
+ # Now test trying to enable an invalid breakpoint
21
+ break 6 if a >
22
+ info break
23
+ enable 3
24
+ info break
25
+ condition 3 a > 5
26
+ enable 3
27
+ info break
28
+ quit
@@ -0,0 +1,65 @@
1
+ gcd.rb:4
2
+ def gcd(a, b)
3
+ # # ********************************************************
4
+ # # This tests primarily the condition command.
5
+ # # In order to do this we need to run break, and disable
6
+ # # ********************************************************
7
+ # set debuggertesting on
8
+ Currently testing the debugger is on.
9
+ # set callstyle last
10
+ Frame call-display style is last.
11
+ # set autoeval off
12
+ autoeval is off.
13
+ # break 6 if a > b
14
+ Breakpoint 1 file ./gcd.rb, line 6
15
+ # info break
16
+ Num Enb What
17
+ 1 y at gcd.rb:6 if a > b
18
+ # condition 1
19
+ # info break
20
+ Num Enb What
21
+ 1 y at gcd.rb:6
22
+ # break 12
23
+ Breakpoint 2 file ./gcd.rb, line 12
24
+ # condition 2 1 == a
25
+ # # FIXME: should be able to catch error on:
26
+ # # condition 2 if 1 == a
27
+ # disable 1
28
+ # continue
29
+ Breakpoint 2 at gcd.rb:12
30
+ gcd.rb:12
31
+ if a == 1 or b-a == 0
32
+ # info break
33
+ Num Enb What
34
+ 1 n at gcd.rb:6
35
+ 2 y at gcd.rb:12 if 1 == a
36
+ breakpoint already hit 1 time
37
+ # p a
38
+ 1
39
+ # # Now test trying to enable an invalid breakpoint
40
+ # break 6 if a >
41
+ Breakpoint 3 file ./gcd.rb, line 6
42
+ *** Expression "a > " syntactically incorrect; breakpoint disabled.
43
+ # info break
44
+ Num Enb What
45
+ 1 n at gcd.rb:6
46
+ 2 y at gcd.rb:12 if 1 == a
47
+ breakpoint already hit 1 time
48
+ 3 n at gcd.rb:6 if a >
49
+ # enable 3
50
+ *** Expression "a > " syntactically incorrect; breakpoint remains disabled.
51
+ # info break
52
+ Num Enb What
53
+ 1 n at gcd.rb:6
54
+ 2 y at gcd.rb:12 if 1 == a
55
+ breakpoint already hit 1 time
56
+ 3 n at gcd.rb:6 if a >
57
+ # condition 3 a > 5
58
+ # enable 3
59
+ # info break
60
+ Num Enb What
61
+ 1 n at gcd.rb:6
62
+ 2 y at gcd.rb:12 if 1 == a
63
+ breakpoint already hit 1 time
64
+ 3 y at gcd.rb:6 if a > 5
65
+ # quit
@@ -0,0 +1,23 @@
1
+ set debuggertesting on
2
+ set width 80
3
+ help
4
+ help info
5
+ info args
6
+ info breakpoints
7
+ info display
8
+ info program
9
+ info global_variables
10
+ info line
11
+ info locals
12
+ info stack
13
+ info threads
14
+ info variables
15
+ eval 1+2
16
+ help show
17
+ set trace off
18
+ show trace
19
+ set trace on
20
+ set annotate 0
21
+ show annotate
22
+
23
+
@@ -0,0 +1,69 @@
1
+ Currently testing the debugger is on.
2
+ width is 80.
3
+ Type 'help <command-name>' for help on a specific command
4
+
5
+ Available commands:
6
+ break delete eval help interrupt pp putl reload save show thread
7
+ catch edit exit info p ps quit restart set source
8
+
9
+ Generic command for showing things about the program being debugged.
10
+ --
11
+ List of info subcommands:
12
+ --
13
+ info args -- Argument variables of current stack frame
14
+ info breakpoints -- Status of user-settable breakpoints
15
+ info catch -- Exceptions that can be caught in the current stack frame
16
+ info display -- Expressions to display when program stops
17
+ info file -- Info about a particular file read in
18
+ info files -- File names and timestamps of files read in
19
+ info global_variables -- Global variables
20
+ info instance_variables -- Instance variables of the current stack frame
21
+ info line -- Line number and file name of current position in source file
22
+ info locals -- Local variables of the current stack frame
23
+ info program -- Execution status of the program
24
+ info stack -- Backtrace of the stack
25
+ info thread -- List info about thread NUM
26
+ info threads -- information of currently-known threads
27
+ info variables -- Local and instance variables of the current stack frame
28
+ No frame selected.
29
+ info breakpoints not available here.
30
+ info display not available here.
31
+ The program being debugged is not being run.
32
+ info global_variables not available here.
33
+ info line not available here.
34
+ info line not available here.
35
+ info stack not available here.
36
+ info threads not available here.
37
+ info variables not available here.
38
+ 3
39
+ Generic command for showing things about the debugger.
40
+
41
+ --
42
+ List of show subcommands:
43
+ --
44
+ show annotate -- Show annotation level
45
+ show args -- Show argument list to give program being debugged when it is started
46
+ show autoeval -- Show if unrecognized command are evaluated
47
+ show autolist -- Show if 'list' commands is run on breakpoints
48
+ show autoirb -- Show if IRB is invoked on debugger stops
49
+ show autoreload -- Show if source code is reloaded when changed
50
+ show basename -- Show if basename used in reporting files
51
+ show callstyle -- Show paramater style used showing call frames
52
+ show commands -- Show the history of commands you typed
53
+ show forcestep -- Show if sure 'next/step' forces move to a new line
54
+ show fullpath -- Show if full file names are displayed in frames
55
+ show history -- Generic command for showing command history parameters
56
+ show keep-frame-bindings -- Save frame binding on each call
57
+ show linetrace -- Show line execution tracing
58
+ show linetrace+ -- Show if consecutive lines should be different are shown in tracing
59
+ show listsize -- Show number of source lines to list by default
60
+ show port -- Show server port
61
+ show post-mortem -- Show whether we go into post-mortem debugging on an uncaught exception
62
+ show trace -- Show if a stack trace is displayed when 'eval' raises exception
63
+ show version -- Show what version of the debugger this is
64
+ show width -- Show the number of characters the debugger thinks are in a line
65
+ Displaying stack trace is off.
66
+ Displaying stack trace is off.
67
+ Displaying stack trace is on.
68
+ Annotation level is 0
69
+ Annotation level is 0
@@ -4,6 +4,8 @@
4
4
  set debuggertesting on
5
5
  b 6
6
6
  c
7
+ # Should be no display expression yet.
8
+ info display
7
9
  display a
8
10
  display b
9
11
  disable display b
@@ -13,6 +15,10 @@ enable display b
13
15
  enable display 1
14
16
  undisplay a
15
17
  undisplay 2
16
- c
18
+ # Should have only one display expression.
19
+ info display
20
+ undisplay 1
21
+ # Now we have no more display expressions.
22
+ info display
17
23
  q
18
24
 
@@ -6,11 +6,14 @@ def gcd(a, b)
6
6
  # set debuggertesting on
7
7
  Currently testing the debugger is on.
8
8
  # b 6
9
- Breakpoint 1 file gcd.rb, line 6
9
+ Breakpoint 1 file ./gcd.rb, line 6
10
10
  # c
11
11
  Breakpoint 1 at gcd.rb:6
12
12
  gcd.rb:6
13
13
  if a > b
14
+ # # Should be no display expression yet.
15
+ # info display
16
+ There are no auto-display expressions now.
14
17
  # display a
15
18
  1: a = 3
16
19
  # display b
@@ -29,9 +32,13 @@ Enable display argument 'b' needs to be a number.
29
32
  # undisplay a
30
33
  Undisplay argument 'a' needs to be a number.
31
34
  # undisplay 2
32
- # c
33
- Breakpoint 1 at gcd.rb:6
34
- 1: a = 1
35
- gcd.rb:6
36
- if a > b
35
+ # # Should have only one display expression.
36
+ # info display
37
+ Auto-display expressions now in effect:
38
+ Num Enb Expression
39
+ 1: y a
40
+ # undisplay 1
41
+ # # Now we have no more display expressions.
42
+ # info display
43
+ There are no auto-display expressions now.
37
44
  # q
@@ -0,0 +1,2 @@
1
+ ./dollar-0.rb
2
+ ./dollar-0.rb
@@ -0,0 +1,2 @@
1
+ ./dollar-0.rb
2
+ ./dollar-0.rb
@@ -0,0 +1,2 @@
1
+ ../test/dollar-0.rb
2
+ ../test/dollar-0.rb
@@ -0,0 +1,12 @@
1
+ # ********************************************************
2
+ # This tests the edit command
3
+ # ********************************************************
4
+ set debuggertesting on
5
+ # Edit using current line position.
6
+ edit
7
+ edit gcd.rb:5
8
+ # File should not exist
9
+ edit foo
10
+ # Add space to the end of 'edit'
11
+ edit
12
+ quit
@@ -0,0 +1,19 @@
1
+ gcd.rb:4
2
+ def gcd(a, b)
3
+ # # ********************************************************
4
+ # # This tests the edit command
5
+ # # ********************************************************
6
+ # set debuggertesting on
7
+ Currently testing the debugger is on.
8
+ # # Edit using current line position.
9
+ # edit
10
+ FAKE-EDITOR +4 ./gcd.rb
11
+ # edit gcd.rb:5
12
+ FAKE-EDITOR +5 gcd.rb
13
+ # # File should not exist
14
+ # edit foo
15
+ *** Invalid file/line number specification: foo
16
+ # # Add space to the end of 'edit'
17
+ # edit
18
+ FAKE-EDITOR +4 ./gcd.rb
19
+ # quit