debugger-xml 0.0.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 (73) hide show
  1. data/.gitignore +20 -0
  2. data/Gemfile +4 -0
  3. data/LICENSE.txt +22 -0
  4. data/README.md +24 -0
  5. data/Rakefile +10 -0
  6. data/bin/rdebug-ide +90 -0
  7. data/debugger-xml.gemspec +25 -0
  8. data/lib/debugger/printers/texts/xml.yml +121 -0
  9. data/lib/debugger/printers/xml.rb +195 -0
  10. data/lib/debugger/xml.rb +3 -0
  11. data/lib/debugger/xml/extensions/commands/edit.rb +13 -0
  12. data/lib/debugger/xml/extensions/commands/frame.rb +14 -0
  13. data/lib/debugger/xml/extensions/commands/help.rb +13 -0
  14. data/lib/debugger/xml/extensions/commands/info.rb +13 -0
  15. data/lib/debugger/xml/extensions/commands/irb.rb +13 -0
  16. data/lib/debugger/xml/extensions/commands/kill.rb +13 -0
  17. data/lib/debugger/xml/extensions/commands/tmate.rb +13 -0
  18. data/lib/debugger/xml/extensions/commands/trace.rb +13 -0
  19. data/lib/debugger/xml/extensions/commands/variables.rb +16 -0
  20. data/lib/debugger/xml/extensions/debugger.rb +28 -0
  21. data/lib/debugger/xml/extensions/processor.rb +9 -0
  22. data/lib/debugger/xml/ide_processor.rb +149 -0
  23. data/lib/debugger/xml/interface.rb +65 -0
  24. data/lib/debugger/xml/version.rb +5 -0
  25. data/test/breakpoints_test.rb +190 -0
  26. data/test/conditions_test.rb +32 -0
  27. data/test/continue_test.rb +12 -0
  28. data/test/display_test.rb +25 -0
  29. data/test/edit_test.rb +12 -0
  30. data/test/eval_test.rb +20 -0
  31. data/test/examples/breakpoint1.rb +15 -0
  32. data/test/examples/breakpoint2.rb +7 -0
  33. data/test/examples/conditions.rb +4 -0
  34. data/test/examples/continue.rb +4 -0
  35. data/test/examples/display.rb +5 -0
  36. data/test/examples/edit.rb +3 -0
  37. data/test/examples/eval.rb +4 -0
  38. data/test/examples/frame.rb +31 -0
  39. data/test/examples/help.rb +2 -0
  40. data/test/examples/info.rb +48 -0
  41. data/test/examples/irb.rb +6 -0
  42. data/test/examples/jump.rb +14 -0
  43. data/test/examples/kill.rb +2 -0
  44. data/test/examples/method.rb +15 -0
  45. data/test/examples/reload.rb +6 -0
  46. data/test/examples/restart.rb +6 -0
  47. data/test/examples/set.rb +3 -0
  48. data/test/examples/stepping.rb +21 -0
  49. data/test/examples/thread.rb +32 -0
  50. data/test/examples/tmate.rb +10 -0
  51. data/test/examples/trace.rb +7 -0
  52. data/test/examples/variables.rb +26 -0
  53. data/test/examples/variables_xml.rb +31 -0
  54. data/test/frame_test.rb +29 -0
  55. data/test/help_test.rb +13 -0
  56. data/test/ide_control_command_processor_test.rb +62 -0
  57. data/test/ide_processor_test.rb +118 -0
  58. data/test/info_test.rb +12 -0
  59. data/test/irb_test.rb +12 -0
  60. data/test/jump_test.rb +22 -0
  61. data/test/kill_test.rb +13 -0
  62. data/test/method_test.rb +36 -0
  63. data/test/printers/xml_test.rb +193 -0
  64. data/test/reload_test.rb +14 -0
  65. data/test/restart_test.rb +50 -0
  66. data/test/set_test.rb +12 -0
  67. data/test/stepping_test.rb +15 -0
  68. data/test/test_helper.rb +6 -0
  69. data/test/thread_test.rb +20 -0
  70. data/test/tmate_test.rb +15 -0
  71. data/test/trace_test.rb +12 -0
  72. data/test/variables_test.rb +84 -0
  73. metadata +253 -0
@@ -0,0 +1,14 @@
1
+ require_relative 'test_helper'
2
+
3
+ describe "Reload Command" do
4
+ include TestDsl
5
+ temporary_change_hash_value(Debugger::Command.settings, :reload_source_on_change, false)
6
+ temporary_change_method_value(Debugger, :printer, Printers::Xml.new)
7
+
8
+ it "must notify that automatic reloading is off" do
9
+ enter 'reload'
10
+ debug_file 'reload'
11
+ check_output_includes "<message>Source code is reloaded. Automatic reloading is off</message>"
12
+ end
13
+
14
+ end
@@ -0,0 +1,50 @@
1
+ require_relative 'test_helper'
2
+
3
+ describe "Restart Command" do
4
+ include TestDsl
5
+ temporary_change_method_value(Debugger, :printer, Printers::Xml.new)
6
+ let(:initial_dir) { Pathname.new(__FILE__ + "/../..").realpath.to_s }
7
+ let(:prog_script) do
8
+ Pathname.new(fullpath('restart')).relative_path_from(Pathname.new(Debugger::INITIAL_DIR)).cleanpath.to_s
9
+ end
10
+ let(:rdebug_script) { 'rdebug-script' }
11
+
12
+ describe "messaging" do
13
+ before do
14
+ enter 'restart'
15
+ force_set_const(Debugger, "INITIAL_DIR", initial_dir)
16
+ force_set_const(Debugger, "PROG_SCRIPT", prog_script)
17
+ force_set_const(Debugger, "RDEBUG_SCRIPT", rdebug_script)
18
+ Debugger::Command.settings[:argv] = ['argv']
19
+ Debugger::RestartCommand.any_instance.stubs(:exec).with("#{rdebug_script} argv")
20
+ end
21
+
22
+ describe "reexecing" do
23
+ it "must show a message about reexecing" do
24
+ debug_file('restart')
25
+ check_output_includes "<restart command=\"#{rdebug_script} argv\"/>"
26
+ end
27
+ end
28
+
29
+ describe "no script is specified and don't use $0" do
30
+ before do
31
+ Debugger.send(:remove_const, "PROG_SCRIPT")
32
+ force_set_const(Debugger, "DEFAULT_START_SETTINGS", init: false, post_mortem: false, tracing: nil)
33
+ end
34
+
35
+ it "must show an error message" do
36
+ debug_file('restart')
37
+ check_output_includes "<error>Don't know name of debugged program</error>", interface.error_queue
38
+ end
39
+ end
40
+
41
+ describe "no script at the specified path" do
42
+ before { force_set_const(Debugger, "PROG_SCRIPT", 'blabla') }
43
+
44
+ it "must show an error message" do
45
+ debug_file('restart')
46
+ check_output_includes "<error>Ruby program blabla doesn't exist</error>", interface.error_queue
47
+ end
48
+ end
49
+ end
50
+ end
data/test/set_test.rb ADDED
@@ -0,0 +1,12 @@
1
+ require_relative 'test_helper'
2
+
3
+ describe "Set Command" do
4
+ include TestDsl
5
+ temporary_change_method_value(Debugger, :printer, Printers::Xml.new)
6
+
7
+ it "must show a message after setting" do
8
+ enter 'set autolist on'
9
+ debug_file 'set'
10
+ check_output_includes "<message>autolist is on</message>"
11
+ end
12
+ end
@@ -0,0 +1,15 @@
1
+ require_relative 'test_helper'
2
+
3
+ describe "Stepping Commands" do
4
+ include TestDsl
5
+ temporary_change_method_value(Debugger, :printer, Printers::Xml.new)
6
+
7
+ describe "Next Command" do
8
+ it "must show the suspended line in xml" do
9
+ enter 'break 10', 'cont', 'next+'
10
+ debug_file('stepping')
11
+ check_output_includes /<suspended file=".*stepping.rb" line="11" threadId="\d+" frames="\d+"\/>/
12
+ end
13
+ end
14
+
15
+ end
@@ -0,0 +1,6 @@
1
+ require 'minitest/autorun'
2
+
3
+ require 'debugger/xml'
4
+ require 'debugger/test'
5
+
6
+ $debugger_test_dir = File.expand_path("..", __FILE__)
@@ -0,0 +1,20 @@
1
+ require_relative 'test_helper'
2
+
3
+ describe "Thread Command" do
4
+ include TestDsl
5
+ temporary_change_method_value(Debugger, :printer, Printers::Xml.new)
6
+ let(:release) { 'eval Thread.main[:should_break] = true' }
7
+
8
+ it "must show current thread by 'plus' sign" do
9
+ thnum = nil
10
+ enter 'break 8', 'cont', 'thread list', release
11
+ debug_file('thread') { thnum = Debugger.contexts.first.thnum }
12
+ check_output_includes %{<threads><thread id="#{thnum}" status="run" current="yes"/></threads>}
13
+ end
14
+
15
+ it "must show 3 available threads" do
16
+ enter 'break 21', 'cont', 'thread list', release
17
+ debug_file 'thread'
18
+ check_output_includes /<threads>.*<thread .*<thread .*><thread .*><\/threads>/
19
+ end
20
+ end
@@ -0,0 +1,15 @@
1
+ if RUBY_PLATFORM =~ /darwin/
2
+ require_relative 'test_helper'
3
+
4
+ describe "Tmate Command" do
5
+ include TestDsl
6
+ temporary_change_method_value(Debugger, :printer, Printers::Xml.new)
7
+
8
+ it "must be unsupported for XML printer" do
9
+ enter 'tmate'
10
+ debug_file 'tmate'
11
+ check_output_includes "<error>Unsupported command 'tmate'</error>", interface.error_queue
12
+ end
13
+
14
+ end
15
+ end
@@ -0,0 +1,12 @@
1
+ require_relative 'test_helper'
2
+
3
+ describe "Trace Command" do
4
+ include TestDsl
5
+ temporary_change_method_value(Debugger, :printer, Printers::Xml.new)
6
+
7
+ it "must be unsupported for XML printer" do
8
+ enter 'trace on'
9
+ debug_file 'trace'
10
+ check_output_includes "<error>Unsupported command 'trace'</error>", interface.error_queue
11
+ end
12
+ end
@@ -0,0 +1,84 @@
1
+ require_relative 'test_helper'
2
+
3
+ describe "Variables Command" do
4
+ include TestDsl
5
+ temporary_change_method_value(Debugger, :printer, Printers::Xml.new)
6
+
7
+ describe "constants" do
8
+ it "must show constants" do
9
+ enter 'break 25', 'cont', 'var const VariablesExample'
10
+ debug_file 'variables'
11
+ check_output_includes(Regexp.new(
12
+ '<variables>' +
13
+ %{<variable name="SOMECONST" kind="constant" value="foo" type="String" hasChildren="false" objectId=".*"/>} +
14
+ '</variables>'
15
+ ))
16
+ end
17
+ end
18
+
19
+ describe "globals" do
20
+ it "must show global variables" do
21
+ enter 'break 25', 'cont', 'var global'
22
+ debug_file 'variables'
23
+ check_output_includes(Regexp.new(
24
+ "<variables>.*" +
25
+ %{<variable name="\\$glob" kind="instance" value="100" type="String" hasChildren="false" objectId="[^"]+"/>} +
26
+ ".*</variables>"
27
+ ))
28
+ end
29
+ end
30
+
31
+ describe "instance variables" do
32
+ it "must show instance variables of the given object" do
33
+ enter 'break 22', 'cont', 'var instance a'
34
+ debug_file 'variables_xml'
35
+ [
36
+ %{<variable name="@inst_a" kind="instance" value="Array \\(3 element\\(s\\)\\)" type="Array" hasChildren="true" objectId=".*"/>},
37
+ %{<variable name="@inst_b" kind="instance" value="2" type="Fixnum" hasChildren="false" objectId="\\+0x5"/>},
38
+ %{<variable name="@inst_c" kind="instance" value="123" type="String" hasChildren="false" objectId=".*"/>},
39
+ %{<variable name="@inst_d" kind="instance" value="&lt;raised exception.*" type="Undefined" hasChildren="false" objectId=""/>},
40
+ %{<variable name="@@class_c" kind="class" value="3" type="Fixnum" hasChildren="false" objectId="\\+0x7"/>}
41
+ ].each do |regexp_string|
42
+ check_output_includes(Regexp.new(regexp_string))
43
+ end
44
+ end
45
+
46
+ it "must show array" do
47
+ enter 'break 23', 'cont', ->{"var instance #{eval('"%#+x" % b.object_id', binding)}"}
48
+ debug_file 'variables_xml'
49
+ check_output_includes(
50
+ "<variables>" +
51
+ %{<variable name="[0]" kind="instance" value="1" type="Fixnum" hasChildren="false" objectId="+0x3"/>} +
52
+ %{<variable name="[1]" kind="instance" value="2" type="Fixnum" hasChildren="false" objectId="+0x5"/>} +
53
+ %{<variable name="[2]" kind="instance" value="3" type="Fixnum" hasChildren="false" objectId="+0x7"/>} +
54
+ "</variables>"
55
+ )
56
+ end
57
+
58
+ it "must show hash" do
59
+ enter 'break 24', 'cont', ->{"var instance #{eval('"%#+x" % c.object_id', binding)}"}
60
+ debug_file 'variables_xml'
61
+ check_output_includes(Regexp.new(
62
+ "<variables>" +
63
+ %{<variable name="a" kind="instance" value="b" type="String" hasChildren="false" objectId=".*"/>} +
64
+ %{<variable name="'c'" kind="instance" value="d" type="String" hasChildren="false" objectId=".*"/>} +
65
+ "</variables>"
66
+ ))
67
+ end
68
+ end
69
+
70
+ describe "local variables" do
71
+ it "must show local variables" do
72
+ enter 'break 17', 'cont', 'var local'
73
+ debug_file 'variables'
74
+ check_output_includes(Regexp.new(
75
+ "<variables>" +
76
+ %{<variable name="self" kind="instance" value="#&lt;VariablesExample:[^"]+&gt;" type="VariablesExample" hasChildren="true" objectId="[^"]+"/>} +
77
+ %{<variable name="a" kind="instance" value="4" type="Fixnum" hasChildren="false" objectId="[^"]+"/>} +
78
+ %{<variable name="b" kind="instance" value="nil" type="NilClass" hasChildren="false" objectId="[^"]+"/>} +
79
+ %{<variable name="i" kind="instance" value="1" type="Fixnum" hasChildren="false" objectId="[^"]+"/>} +
80
+ "</variables>"
81
+ ))
82
+ end
83
+ end
84
+ end
metadata ADDED
@@ -0,0 +1,253 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: debugger-xml
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.0.1
6
+ platform: ruby
7
+ authors:
8
+ - Anton Astashov
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-03-14 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ version_requirements: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ! '>='
18
+ - !ruby/object:Gem::Version
19
+ version: 1.5.0
20
+ none: false
21
+ prerelease: false
22
+ name: debugger
23
+ requirement: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ! '>='
26
+ - !ruby/object:Gem::Version
27
+ version: 1.5.0
28
+ none: false
29
+ type: :runtime
30
+ - !ruby/object:Gem::Dependency
31
+ version_requirements: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ! '>='
34
+ - !ruby/object:Gem::Version
35
+ version: 2.0.0
36
+ none: false
37
+ prerelease: false
38
+ name: builder
39
+ requirement: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: 2.0.0
44
+ none: false
45
+ type: :runtime
46
+ - !ruby/object:Gem::Dependency
47
+ version_requirements: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ~>
50
+ - !ruby/object:Gem::Version
51
+ version: 0.9.2.2
52
+ none: false
53
+ prerelease: false
54
+ name: rake
55
+ requirement: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ~>
58
+ - !ruby/object:Gem::Version
59
+ version: 0.9.2.2
60
+ none: false
61
+ type: :development
62
+ - !ruby/object:Gem::Dependency
63
+ version_requirements: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ~>
66
+ - !ruby/object:Gem::Version
67
+ version: 2.12.1
68
+ none: false
69
+ prerelease: false
70
+ name: minitest
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: 2.12.1
76
+ none: false
77
+ type: :development
78
+ - !ruby/object:Gem::Dependency
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ~>
82
+ - !ruby/object:Gem::Version
83
+ version: 0.13.0
84
+ none: false
85
+ prerelease: false
86
+ name: mocha
87
+ requirement: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ~>
90
+ - !ruby/object:Gem::Version
91
+ version: 0.13.0
92
+ none: false
93
+ type: :development
94
+ description: XML interface for debugger
95
+ email:
96
+ - anton.astashov@gmail.com
97
+ executables:
98
+ - rdebug-ide
99
+ extensions: []
100
+ extra_rdoc_files: []
101
+ files:
102
+ - .gitignore
103
+ - Gemfile
104
+ - LICENSE.txt
105
+ - README.md
106
+ - Rakefile
107
+ - bin/rdebug-ide
108
+ - debugger-xml.gemspec
109
+ - lib/debugger/printers/texts/xml.yml
110
+ - lib/debugger/printers/xml.rb
111
+ - lib/debugger/xml.rb
112
+ - lib/debugger/xml/extensions/commands/edit.rb
113
+ - lib/debugger/xml/extensions/commands/frame.rb
114
+ - lib/debugger/xml/extensions/commands/help.rb
115
+ - lib/debugger/xml/extensions/commands/info.rb
116
+ - lib/debugger/xml/extensions/commands/irb.rb
117
+ - lib/debugger/xml/extensions/commands/kill.rb
118
+ - lib/debugger/xml/extensions/commands/tmate.rb
119
+ - lib/debugger/xml/extensions/commands/trace.rb
120
+ - lib/debugger/xml/extensions/commands/variables.rb
121
+ - lib/debugger/xml/extensions/debugger.rb
122
+ - lib/debugger/xml/extensions/processor.rb
123
+ - lib/debugger/xml/ide_processor.rb
124
+ - lib/debugger/xml/interface.rb
125
+ - lib/debugger/xml/version.rb
126
+ - test/breakpoints_test.rb
127
+ - test/conditions_test.rb
128
+ - test/continue_test.rb
129
+ - test/display_test.rb
130
+ - test/edit_test.rb
131
+ - test/eval_test.rb
132
+ - test/examples/breakpoint1.rb
133
+ - test/examples/breakpoint2.rb
134
+ - test/examples/conditions.rb
135
+ - test/examples/continue.rb
136
+ - test/examples/display.rb
137
+ - test/examples/edit.rb
138
+ - test/examples/eval.rb
139
+ - test/examples/frame.rb
140
+ - test/examples/help.rb
141
+ - test/examples/info.rb
142
+ - test/examples/irb.rb
143
+ - test/examples/jump.rb
144
+ - test/examples/kill.rb
145
+ - test/examples/method.rb
146
+ - test/examples/reload.rb
147
+ - test/examples/restart.rb
148
+ - test/examples/set.rb
149
+ - test/examples/stepping.rb
150
+ - test/examples/thread.rb
151
+ - test/examples/tmate.rb
152
+ - test/examples/trace.rb
153
+ - test/examples/variables.rb
154
+ - test/examples/variables_xml.rb
155
+ - test/frame_test.rb
156
+ - test/help_test.rb
157
+ - test/ide_control_command_processor_test.rb
158
+ - test/ide_processor_test.rb
159
+ - test/info_test.rb
160
+ - test/irb_test.rb
161
+ - test/jump_test.rb
162
+ - test/kill_test.rb
163
+ - test/method_test.rb
164
+ - test/printers/xml_test.rb
165
+ - test/reload_test.rb
166
+ - test/restart_test.rb
167
+ - test/set_test.rb
168
+ - test/stepping_test.rb
169
+ - test/test_helper.rb
170
+ - test/thread_test.rb
171
+ - test/tmate_test.rb
172
+ - test/trace_test.rb
173
+ - test/variables_test.rb
174
+ homepage: ''
175
+ licenses: []
176
+ post_install_message:
177
+ rdoc_options: []
178
+ require_paths:
179
+ - lib
180
+ required_ruby_version: !ruby/object:Gem::Requirement
181
+ requirements:
182
+ - - ! '>='
183
+ - !ruby/object:Gem::Version
184
+ version: '0'
185
+ segments:
186
+ - 0
187
+ hash: -1058881278925269366
188
+ none: false
189
+ required_rubygems_version: !ruby/object:Gem::Requirement
190
+ requirements:
191
+ - - ! '>='
192
+ - !ruby/object:Gem::Version
193
+ version: '0'
194
+ segments:
195
+ - 0
196
+ hash: -1058881278925269366
197
+ none: false
198
+ requirements: []
199
+ rubyforge_project:
200
+ rubygems_version: 1.8.25
201
+ signing_key:
202
+ specification_version: 3
203
+ summary: Implements XML interface for the 'debugger' gem, compatible with ruby-debug-ide
204
+ gem
205
+ test_files:
206
+ - test/breakpoints_test.rb
207
+ - test/conditions_test.rb
208
+ - test/continue_test.rb
209
+ - test/display_test.rb
210
+ - test/edit_test.rb
211
+ - test/eval_test.rb
212
+ - test/examples/breakpoint1.rb
213
+ - test/examples/breakpoint2.rb
214
+ - test/examples/conditions.rb
215
+ - test/examples/continue.rb
216
+ - test/examples/display.rb
217
+ - test/examples/edit.rb
218
+ - test/examples/eval.rb
219
+ - test/examples/frame.rb
220
+ - test/examples/help.rb
221
+ - test/examples/info.rb
222
+ - test/examples/irb.rb
223
+ - test/examples/jump.rb
224
+ - test/examples/kill.rb
225
+ - test/examples/method.rb
226
+ - test/examples/reload.rb
227
+ - test/examples/restart.rb
228
+ - test/examples/set.rb
229
+ - test/examples/stepping.rb
230
+ - test/examples/thread.rb
231
+ - test/examples/tmate.rb
232
+ - test/examples/trace.rb
233
+ - test/examples/variables.rb
234
+ - test/examples/variables_xml.rb
235
+ - test/frame_test.rb
236
+ - test/help_test.rb
237
+ - test/ide_control_command_processor_test.rb
238
+ - test/ide_processor_test.rb
239
+ - test/info_test.rb
240
+ - test/irb_test.rb
241
+ - test/jump_test.rb
242
+ - test/kill_test.rb
243
+ - test/method_test.rb
244
+ - test/printers/xml_test.rb
245
+ - test/reload_test.rb
246
+ - test/restart_test.rb
247
+ - test/set_test.rb
248
+ - test/stepping_test.rb
249
+ - test/test_helper.rb
250
+ - test/thread_test.rb
251
+ - test/tmate_test.rb
252
+ - test/trace_test.rb
253
+ - test/variables_test.rb