debugger 1.4.0 → 1.5.0

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 (75) hide show
  1. data/CHANGELOG.md +4 -0
  2. data/README.md +9 -3
  3. data/debugger.gemspec +1 -1
  4. data/ext/ruby_debug/192/ruby_debug.c +21 -9
  5. data/ext/ruby_debug/193/ruby_debug.c +15 -5
  6. data/lib/debugger/test.rb +6 -0
  7. data/{test/support → lib/debugger/test}/breakpoint.rb +0 -0
  8. data/{test/support → lib/debugger/test}/context.rb +0 -0
  9. data/{test/support → lib/debugger/test}/matchers.rb +0 -0
  10. data/{test/support → lib/debugger/test}/mocha_extensions.rb +1 -1
  11. data/lib/debugger/test/printer_helpers.rb +8 -0
  12. data/{test/support → lib/debugger/test}/processor.rb +0 -0
  13. data/{test/support → lib/debugger/test}/test_dsl.rb +22 -2
  14. data/{test/support → lib/debugger/test}/test_interface.rb +4 -0
  15. data/lib/debugger/version.rb +1 -1
  16. data/lib/ruby-debug.rb +4 -1
  17. data/lib/ruby-debug/command.rb +18 -6
  18. data/lib/ruby-debug/commands/breakpoints.rb +27 -29
  19. data/lib/ruby-debug/commands/condition.rb +7 -2
  20. data/lib/ruby-debug/commands/continue.rb +1 -2
  21. data/lib/ruby-debug/commands/control.rb +8 -9
  22. data/lib/ruby-debug/commands/display.rb +7 -15
  23. data/lib/ruby-debug/commands/edit.rb +6 -6
  24. data/lib/ruby-debug/commands/enable.rb +6 -7
  25. data/lib/ruby-debug/commands/eval.rb +1 -3
  26. data/lib/ruby-debug/commands/frame.rb +72 -101
  27. data/lib/ruby-debug/commands/info.rb +8 -14
  28. data/lib/ruby-debug/commands/irb.rb +1 -1
  29. data/lib/ruby-debug/commands/jump.rb +6 -6
  30. data/lib/ruby-debug/commands/kill.rb +0 -1
  31. data/lib/ruby-debug/commands/list.rb +4 -4
  32. data/lib/ruby-debug/commands/method.rb +8 -11
  33. data/lib/ruby-debug/commands/quit.rb +1 -1
  34. data/lib/ruby-debug/commands/reload.rb +1 -1
  35. data/lib/ruby-debug/commands/save.rb +1 -1
  36. data/lib/ruby-debug/commands/set.rb +10 -15
  37. data/lib/ruby-debug/commands/show.rb +28 -42
  38. data/lib/ruby-debug/commands/skip.rb +1 -1
  39. data/lib/ruby-debug/commands/source.rb +1 -1
  40. data/lib/ruby-debug/commands/start.rb +26 -0
  41. data/lib/ruby-debug/commands/threads.rb +29 -18
  42. data/lib/ruby-debug/commands/tmate.rb +1 -1
  43. data/lib/ruby-debug/commands/trace.rb +6 -7
  44. data/lib/ruby-debug/commands/variables.rb +36 -19
  45. data/lib/ruby-debug/helper.rb +5 -5
  46. data/lib/ruby-debug/interface.rb +15 -3
  47. data/lib/ruby-debug/printers/base.rb +58 -0
  48. data/lib/ruby-debug/printers/plain.rb +41 -0
  49. data/lib/ruby-debug/printers/texts/base.yml +146 -0
  50. data/lib/ruby-debug/printers/texts/plain.yml +60 -0
  51. data/lib/ruby-debug/processor.rb +56 -47
  52. data/test/breakpoints_test.rb +43 -54
  53. data/test/conditions_test.rb +18 -6
  54. data/test/continue_test.rb +1 -1
  55. data/test/display_test.rb +11 -11
  56. data/test/edit_test.rb +1 -2
  57. data/test/eval_test.rb +5 -6
  58. data/test/finish_test.rb +1 -1
  59. data/test/frame_test.rb +29 -27
  60. data/test/help_test.rb +0 -1
  61. data/test/info_test.rb +10 -14
  62. data/test/irb_test.rb +0 -1
  63. data/test/jump_test.rb +21 -2
  64. data/test/method_test.rb +3 -3
  65. data/test/new/printers/plain_test.rb +84 -0
  66. data/test/reload_test.rb +2 -2
  67. data/test/restart_test.rb +1 -2
  68. data/test/set_test.rb +8 -7
  69. data/test/show_test.rb +22 -22
  70. data/test/source_test.rb +1 -1
  71. data/test/test_helper.rb +2 -1
  72. data/test/thread_test.rb +11 -13
  73. data/test/trace_test.rb +7 -7
  74. data/test/variables_test.rb +33 -15
  75. metadata +20 -12
data/test/trace_test.rb CHANGED
@@ -25,13 +25,13 @@ describe "Trace Command" do
25
25
  it "must show a message it is on" do
26
26
  enter 'trace on'
27
27
  debug_file 'trace'
28
- check_output_includes "Tracing on on current thread."
28
+ check_output_includes "Tracing on on current thread"
29
29
  end
30
30
 
31
31
  it "must be able to use a shortcut" do
32
32
  enter 'tr on'
33
33
  debug_file 'trace'
34
- check_output_includes "Tracing on on current thread."
34
+ check_output_includes "Tracing on on current thread"
35
35
  end
36
36
  end
37
37
 
@@ -53,7 +53,7 @@ describe "Trace Command" do
53
53
  it "must show a message it is off" do
54
54
  enter 'trace off'
55
55
  debug_file 'trace'
56
- check_output_includes "Tracing off on current thread."
56
+ check_output_includes "Tracing off on current thread"
57
57
  end
58
58
  end
59
59
  end
@@ -77,7 +77,7 @@ describe "Trace Command" do
77
77
  it "must show a message it is on" do
78
78
  enter 'trace on all'
79
79
  debug_file 'trace'
80
- check_output_includes "Tracing on all threads."
80
+ check_output_includes "Tracing on all threads"
81
81
  end
82
82
  end
83
83
 
@@ -96,7 +96,7 @@ describe "Trace Command" do
96
96
  it "must show a message it is off" do
97
97
  enter 'trace off'
98
98
  debug_file 'trace'
99
- check_output_includes "Tracing off on current thread."
99
+ check_output_includes "Tracing off on current thread"
100
100
  end
101
101
  end
102
102
  end
@@ -132,7 +132,7 @@ describe "Trace Command" do
132
132
  it "must show an error message if there is no such global variable" do
133
133
  enter 'trace variable $foo'
134
134
  debug_file 'trace'
135
- check_output_includes "$foo is not a global variable.", interface.error_queue
135
+ check_output_includes "$foo is not a global variable", interface.error_queue
136
136
  end
137
137
 
138
138
  it "must show an error message if subcommand is invalid" do
@@ -147,7 +147,7 @@ describe "Trace Command" do
147
147
  it "must work in post-mortem mode" do
148
148
  enter 'cont', 'trace on'
149
149
  debug_file 'post_mortem'
150
- check_output_includes "Tracing on on current thread."
150
+ check_output_includes "Tracing on on current thread"
151
151
  end
152
152
  end
153
153
 
@@ -8,13 +8,13 @@ describe "Variables Command" do
8
8
  it "must show variables" do
9
9
  enter 'break 19', 'cont', 'var class'
10
10
  debug_file 'variables'
11
- check_output_includes "@@class_c = 3"
11
+ check_output_includes '@@class_c = 3'
12
12
  end
13
13
 
14
14
  it "must be able to use shortcut" do
15
15
  enter 'break 19', 'cont', 'v cl'
16
16
  debug_file 'variables'
17
- check_output_includes "@@class_c = 3"
17
+ check_output_includes '@@class_c = 3'
18
18
  end
19
19
  end
20
20
 
@@ -22,19 +22,19 @@ describe "Variables Command" do
22
22
  it "must show constants" do
23
23
  enter 'break 25', 'cont', 'var const VariablesExample'
24
24
  debug_file 'variables'
25
- check_output_includes 'SOMECONST => "foo"'
25
+ check_output_includes 'SOMECONST = foo'
26
26
  end
27
27
 
28
28
  it "must be able to use shortcut" do
29
29
  enter 'break 25', 'cont', 'v co VariablesExample'
30
30
  debug_file 'variables'
31
- check_output_includes 'SOMECONST => "foo"'
31
+ check_output_includes 'SOMECONST = foo'
32
32
  end
33
33
 
34
34
  it "must show an error message if the given object is not a Class or Module" do
35
35
  enter 'break 25', 'cont', 'var const v'
36
36
  debug_file 'variables'
37
- check_output_includes "Should be Class/Module: v"
37
+ check_output_includes "Should be Class/Module: v", interface.error_queue
38
38
  end
39
39
  end
40
40
 
@@ -42,13 +42,13 @@ describe "Variables Command" do
42
42
  it "must show global variables" do
43
43
  enter 'break 25', 'cont', 'var global'
44
44
  debug_file 'variables'
45
- check_output_includes '$glob = 100'
45
+ check_output_includes /\$glob = 100/
46
46
  end
47
47
 
48
48
  it "must be able to use shortcut" do
49
49
  enter 'break 25', 'cont', 'v g'
50
50
  debug_file 'variables'
51
- check_output_includes '$glob = 100'
51
+ check_output_includes /\$glob = 100/
52
52
  end
53
53
  end
54
54
 
@@ -56,39 +56,45 @@ describe "Variables Command" do
56
56
  it "must show instance variables of the given object" do
57
57
  enter 'break 25', 'cont', 'var instance v'
58
58
  debug_file 'variables'
59
- check_output_includes "@inst_a = 1", "@inst_b = 2"
59
+ check_output_includes /@inst_a = 1\n@inst_b = 2/
60
+ end
61
+
62
+ it "must show instance variables by object id" do
63
+ enter 'break 25', 'cont', ->{"var instance #{eval('"%#+x" % v.object_id', binding)}"}
64
+ debug_file 'variables'
65
+ check_output_includes /@inst_a = 1/
60
66
  end
61
67
 
62
68
  it "must show instance variables of self" do
63
69
  enter 'break 11', 'cont', 'var instance'
64
70
  debug_file 'variables'
65
- check_output_includes "@inst_a = 1", "@inst_b = 2"
71
+ check_output_includes /@inst_a = 1\n@inst_b = 2/
66
72
  end
67
73
 
68
74
  it "must show instance variables" do
69
75
  enter 'break 25', 'cont', 'var instance v'
70
76
  debug_file 'variables'
71
- check_output_includes "@inst_a = 1", "@inst_b = 2"
77
+ check_output_includes /@inst_a = 1\n@inst_b = 2/
72
78
  end
73
79
 
74
80
  it "must be able to use shortcut" do
75
81
  enter 'break 25', 'cont', 'v ins v'
76
82
  debug_file 'variables'
77
- check_output_includes "@inst_a = 1", "@inst_b = 2"
83
+ check_output_includes /@inst_a = 1\n@inst_b = 2/
78
84
  end
79
85
 
80
86
  it "must cut long variable values according to :width setting" do
81
87
  temporary_change_hash_value(Debugger::Command.settings, :width, 20) do
82
88
  enter 'break 25', 'cont', 'var instance v'
83
89
  debug_file 'variables'
84
- check_output_includes '@inst_c = "1111111111111111...'
90
+ check_output_includes /@inst_c = "1111111111111111\.\.\.\n/
85
91
  end
86
92
  end
87
93
 
88
94
  it "must show fallback message if value doesn't have #to_s or #inspect methods" do
89
95
  enter 'break 25', 'cont', 'var instance v'
90
96
  debug_file 'variables'
91
- check_output_includes '@inst_d = *Error in evaluation*'
97
+ check_output_includes /@inst_d = \*Error in evaluation\*/
92
98
  end
93
99
  end
94
100
 
@@ -96,7 +102,19 @@ describe "Variables Command" do
96
102
  it "must show local variables" do
97
103
  enter 'break 17', 'cont', 'var local'
98
104
  debug_file 'variables'
99
- check_output_includes "a => 4", "b => nil", "i => 1"
105
+ check_output_includes /a = 4\nb = nil\ni = 1/
106
+ end
107
+
108
+ it "must not show self in variables if the self is 'main'" do
109
+ enter 'break 24', 'cont', 'var local'
110
+ debug_file 'variables'
111
+ check_output_doesnt_include /self =/
112
+ end
113
+
114
+ it "must show self in variables if the self is not 'main'" do
115
+ enter 'break 17', 'cont', 'var local'
116
+ debug_file 'variables'
117
+ check_output_includes /self = #<VariablesExample:[^>]+>/
100
118
  end
101
119
  end
102
120
 
@@ -107,7 +125,7 @@ describe "Variables Command" do
107
125
  it "must work in post-mortem mode" do
108
126
  enter 'cont', 'var local'
109
127
  debug_file 'post_mortem'
110
- check_output_includes "x => nil", "z => 4"
128
+ check_output_includes "self = blabla\nx = nil\nz = 4"
111
129
  end
112
130
  end
113
131
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: debugger
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.5.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2013-03-06 00:00:00.000000000 Z
14
+ date: 2013-03-14 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: columnize
@@ -52,7 +52,7 @@ dependencies:
52
52
  requirements:
53
53
  - - ~>
54
54
  - !ruby/object:Gem::Version
55
- version: 1.1.1
55
+ version: 1.2.0
56
56
  type: :runtime
57
57
  prerelease: false
58
58
  version_requirements: !ruby/object:Gem::Requirement
@@ -60,7 +60,7 @@ dependencies:
60
60
  requirements:
61
61
  - - ~>
62
62
  - !ruby/object:Gem::Version
63
- version: 1.1.1
63
+ version: 1.2.0
64
64
  - !ruby/object:Gem::Dependency
65
65
  name: rake
66
66
  requirement: !ruby/object:Gem::Requirement
@@ -211,6 +211,15 @@ files:
211
211
  - ext/ruby_debug/200/ruby_debug.h
212
212
  - ext/ruby_debug/extconf.rb
213
213
  - lib/debugger.rb
214
+ - lib/debugger/test.rb
215
+ - lib/debugger/test/breakpoint.rb
216
+ - lib/debugger/test/context.rb
217
+ - lib/debugger/test/matchers.rb
218
+ - lib/debugger/test/mocha_extensions.rb
219
+ - lib/debugger/test/printer_helpers.rb
220
+ - lib/debugger/test/processor.rb
221
+ - lib/debugger/test/test_dsl.rb
222
+ - lib/debugger/test/test_interface.rb
214
223
  - lib/debugger/version.rb
215
224
  - lib/ruby-debug-base.rb
216
225
  - lib/ruby-debug.rb
@@ -240,6 +249,7 @@ files:
240
249
  - lib/ruby-debug/commands/show.rb
241
250
  - lib/ruby-debug/commands/skip.rb
242
251
  - lib/ruby-debug/commands/source.rb
252
+ - lib/ruby-debug/commands/start.rb
243
253
  - lib/ruby-debug/commands/stepping.rb
244
254
  - lib/ruby-debug/commands/threads.rb
245
255
  - lib/ruby-debug/commands/tmate.rb
@@ -248,6 +258,10 @@ files:
248
258
  - lib/ruby-debug/debugger.rb
249
259
  - lib/ruby-debug/helper.rb
250
260
  - lib/ruby-debug/interface.rb
261
+ - lib/ruby-debug/printers/base.rb
262
+ - lib/ruby-debug/printers/plain.rb
263
+ - lib/ruby-debug/printers/texts/base.yml
264
+ - lib/ruby-debug/printers/texts/plain.yml
251
265
  - lib/ruby-debug/processor.rb
252
266
  - man/rdebug.1
253
267
  - old_scripts/Makefile.am
@@ -307,6 +321,7 @@ files:
307
321
  - test/kill_test.rb
308
322
  - test/list_test.rb
309
323
  - test/method_test.rb
324
+ - test/new/printers/plain_test.rb
310
325
  - test/post_mortem_test.rb
311
326
  - test/quit_test.rb
312
327
  - test/reload_test.rb
@@ -316,13 +331,6 @@ files:
316
331
  - test/show_test.rb
317
332
  - test/source_test.rb
318
333
  - test/stepping_test.rb
319
- - test/support/breakpoint.rb
320
- - test/support/context.rb
321
- - test/support/matchers.rb
322
- - test/support/mocha_extensions.rb
323
- - test/support/processor.rb
324
- - test/support/test_dsl.rb
325
- - test/support/test_interface.rb
326
334
  - test/test_helper.rb
327
335
  - test/thread_test.rb
328
336
  - test/tmate_test.rb
@@ -349,7 +357,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
349
357
  version: 1.3.6
350
358
  requirements: []
351
359
  rubyforge_project:
352
- rubygems_version: 1.8.23
360
+ rubygems_version: 1.8.24
353
361
  signing_key:
354
362
  specification_version: 3
355
363
  summary: Fast Ruby debugger - base + cli