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.
- data/.gitignore +20 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +24 -0
- data/Rakefile +10 -0
- data/bin/rdebug-ide +90 -0
- data/debugger-xml.gemspec +25 -0
- data/lib/debugger/printers/texts/xml.yml +121 -0
- data/lib/debugger/printers/xml.rb +195 -0
- data/lib/debugger/xml.rb +3 -0
- data/lib/debugger/xml/extensions/commands/edit.rb +13 -0
- data/lib/debugger/xml/extensions/commands/frame.rb +14 -0
- data/lib/debugger/xml/extensions/commands/help.rb +13 -0
- data/lib/debugger/xml/extensions/commands/info.rb +13 -0
- data/lib/debugger/xml/extensions/commands/irb.rb +13 -0
- data/lib/debugger/xml/extensions/commands/kill.rb +13 -0
- data/lib/debugger/xml/extensions/commands/tmate.rb +13 -0
- data/lib/debugger/xml/extensions/commands/trace.rb +13 -0
- data/lib/debugger/xml/extensions/commands/variables.rb +16 -0
- data/lib/debugger/xml/extensions/debugger.rb +28 -0
- data/lib/debugger/xml/extensions/processor.rb +9 -0
- data/lib/debugger/xml/ide_processor.rb +149 -0
- data/lib/debugger/xml/interface.rb +65 -0
- data/lib/debugger/xml/version.rb +5 -0
- data/test/breakpoints_test.rb +190 -0
- data/test/conditions_test.rb +32 -0
- data/test/continue_test.rb +12 -0
- data/test/display_test.rb +25 -0
- data/test/edit_test.rb +12 -0
- data/test/eval_test.rb +20 -0
- data/test/examples/breakpoint1.rb +15 -0
- data/test/examples/breakpoint2.rb +7 -0
- data/test/examples/conditions.rb +4 -0
- data/test/examples/continue.rb +4 -0
- data/test/examples/display.rb +5 -0
- data/test/examples/edit.rb +3 -0
- data/test/examples/eval.rb +4 -0
- data/test/examples/frame.rb +31 -0
- data/test/examples/help.rb +2 -0
- data/test/examples/info.rb +48 -0
- data/test/examples/irb.rb +6 -0
- data/test/examples/jump.rb +14 -0
- data/test/examples/kill.rb +2 -0
- data/test/examples/method.rb +15 -0
- data/test/examples/reload.rb +6 -0
- data/test/examples/restart.rb +6 -0
- data/test/examples/set.rb +3 -0
- data/test/examples/stepping.rb +21 -0
- data/test/examples/thread.rb +32 -0
- data/test/examples/tmate.rb +10 -0
- data/test/examples/trace.rb +7 -0
- data/test/examples/variables.rb +26 -0
- data/test/examples/variables_xml.rb +31 -0
- data/test/frame_test.rb +29 -0
- data/test/help_test.rb +13 -0
- data/test/ide_control_command_processor_test.rb +62 -0
- data/test/ide_processor_test.rb +118 -0
- data/test/info_test.rb +12 -0
- data/test/irb_test.rb +12 -0
- data/test/jump_test.rb +22 -0
- data/test/kill_test.rb +13 -0
- data/test/method_test.rb +36 -0
- data/test/printers/xml_test.rb +193 -0
- data/test/reload_test.rb +14 -0
- data/test/restart_test.rb +50 -0
- data/test/set_test.rb +12 -0
- data/test/stepping_test.rb +15 -0
- data/test/test_helper.rb +6 -0
- data/test/thread_test.rb +20 -0
- data/test/tmate_test.rb +15 -0
- data/test/trace_test.rb +12 -0
- data/test/variables_test.rb +84 -0
- metadata +253 -0
@@ -0,0 +1,32 @@
|
|
1
|
+
require_relative 'test_helper'
|
2
|
+
|
3
|
+
describe "Conditions" do
|
4
|
+
include TestDsl
|
5
|
+
temporary_change_method_value(Debugger, :printer, Printers::Xml.new)
|
6
|
+
|
7
|
+
describe "setting condition" do
|
8
|
+
it "must show a successful message" do
|
9
|
+
enter 'break 3', ->{"cond #{breakpoint.id} b == 5"}, "cont"
|
10
|
+
id = nil
|
11
|
+
debug_file('conditions') { id = breakpoint.id }
|
12
|
+
check_output_includes "<conditionSet bp_id=\"#{id}\"/>"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
describe "removing conditions" do
|
17
|
+
it "must show a successful message" do
|
18
|
+
enter "break 3 if b == 3", "break 4", ->{"cond #{breakpoint.id}"}, "cont"
|
19
|
+
id = nil
|
20
|
+
debug_file('conditions') { id = breakpoint.id }
|
21
|
+
check_output_includes "<conditionSet bp_id=\"#{id}\"/>"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
describe "errors" do
|
26
|
+
it "must show error if there are no breakpoints" do
|
27
|
+
enter 'cond 1 true'
|
28
|
+
debug_file('conditions')
|
29
|
+
check_output_includes "<error>No breakpoints have been set</error>"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require_relative 'test_helper'
|
2
|
+
|
3
|
+
describe "Continue Command" do
|
4
|
+
include TestDsl
|
5
|
+
temporary_change_method_value(Debugger, :printer, Printers::Xml.new)
|
6
|
+
|
7
|
+
it "must show error if there is no specified line" do
|
8
|
+
enter 'cont 123'
|
9
|
+
debug_file('continue')
|
10
|
+
check_output_includes "<error>Line 123 is not a stopping point in file '#{fullpath('continue')}'</error>", interface.error_queue
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require_relative 'test_helper'
|
2
|
+
|
3
|
+
describe "Display Command" do
|
4
|
+
include TestDsl
|
5
|
+
temporary_change_method_value(Debugger, :printer, Printers::Xml.new)
|
6
|
+
|
7
|
+
it "displays all expressions available" do
|
8
|
+
enter 'break 3', 'cont', -> do
|
9
|
+
Debugger.handler.display.concat([[true, "abc"], [true, "d"]]); 'display'
|
10
|
+
end
|
11
|
+
debug_file('display')
|
12
|
+
check_output_includes '<displays><display key="abc" value=""/><display key="d" value="4"/></displays>'
|
13
|
+
end
|
14
|
+
|
15
|
+
describe "undisplay all" do
|
16
|
+
it "must ask about confirmation" do
|
17
|
+
enter 'break 3', 'cont', -> do
|
18
|
+
Debugger.handler.display.concat([[true, "abc"], [true, "d"]])
|
19
|
+
'undisplay'
|
20
|
+
end, 'y', 'display'
|
21
|
+
debug_file('display')
|
22
|
+
check_output_includes "<confirmation>Clear all expressions?</confirmation>", interface.confirm_queue
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/test/edit_test.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
require_relative 'test_helper'
|
2
|
+
|
3
|
+
describe "Edit 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 'edit'
|
9
|
+
debug_file 'edit'
|
10
|
+
check_output_includes "<error>Unsupported command 'edit'</error>", interface.error_queue
|
11
|
+
end
|
12
|
+
end
|
data/test/eval_test.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require_relative 'test_helper'
|
2
|
+
|
3
|
+
describe "Eval Command" do
|
4
|
+
include TestDsl
|
5
|
+
temporary_change_method_value(Debugger, :printer, Printers::Xml.new)
|
6
|
+
|
7
|
+
it "must evaluate an expression" do
|
8
|
+
enter 'eval 3 + 2'
|
9
|
+
debug_file 'eval'
|
10
|
+
check_output_includes '<eval expression="3 + 2" value="5"/>'
|
11
|
+
end
|
12
|
+
|
13
|
+
it "must evaluate with error" do
|
14
|
+
enter 'eval blabla'
|
15
|
+
debug_file 'eval'
|
16
|
+
check_output_includes(
|
17
|
+
%{<processingException type="NameError" message="undefined local variable or method `blabla' for main:Object"/>},
|
18
|
+
interface.error_queue)
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
debugger
|
2
|
+
|
3
|
+
@should_break = false
|
4
|
+
|
5
|
+
t = Thread.new do
|
6
|
+
while !@should_break
|
7
|
+
A.new.a
|
8
|
+
sleep 0.1
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
class A
|
13
|
+
def a
|
14
|
+
b
|
15
|
+
end
|
16
|
+
def b
|
17
|
+
c
|
18
|
+
2
|
19
|
+
end
|
20
|
+
def c
|
21
|
+
d('a')
|
22
|
+
3
|
23
|
+
end
|
24
|
+
def d(e)
|
25
|
+
5
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
A.new.a
|
30
|
+
@should_break = true
|
31
|
+
t.join
|
@@ -0,0 +1,48 @@
|
|
1
|
+
debugger
|
2
|
+
def bla(a, b)
|
3
|
+
a + b
|
4
|
+
end
|
5
|
+
2
|
6
|
+
3
|
7
|
+
4
|
8
|
+
5
|
9
|
+
6
|
10
|
+
bla("a" * 30, "b")
|
11
|
+
|
12
|
+
class A
|
13
|
+
def initialize
|
14
|
+
@foo = "bar"
|
15
|
+
@bla = "blabla"
|
16
|
+
end
|
17
|
+
|
18
|
+
def a
|
19
|
+
a = "1" * 30
|
20
|
+
b = 2
|
21
|
+
@foo
|
22
|
+
end
|
23
|
+
|
24
|
+
def c
|
25
|
+
a = BasicObject.new
|
26
|
+
a
|
27
|
+
end
|
28
|
+
|
29
|
+
def b
|
30
|
+
a
|
31
|
+
e = "%.2f"
|
32
|
+
e
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
@break = false
|
37
|
+
t1 = Thread.new do
|
38
|
+
while true
|
39
|
+
break if @break
|
40
|
+
sleep 0.02
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
A.new.b
|
45
|
+
A.new.a
|
46
|
+
A.new.c
|
47
|
+
@break = true
|
48
|
+
t1.join
|
@@ -0,0 +1,32 @@
|
|
1
|
+
debugger
|
2
|
+
class ThreadExample
|
3
|
+
def initialize
|
4
|
+
Thread.main[:should_break] = false
|
5
|
+
end
|
6
|
+
|
7
|
+
def launch
|
8
|
+
@t1 = Thread.new do
|
9
|
+
while true
|
10
|
+
break if Thread.main[:should_break]
|
11
|
+
sleep 0.02
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
@t2 = Thread.new do
|
16
|
+
while true
|
17
|
+
sleep 0.02
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
@t1.join
|
22
|
+
Thread.main[:should_break]
|
23
|
+
end
|
24
|
+
|
25
|
+
def kill
|
26
|
+
@t2.kill
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
t = ThreadExample.new
|
31
|
+
t.launch
|
32
|
+
t.kill
|
@@ -0,0 +1,26 @@
|
|
1
|
+
debugger
|
2
|
+
class VariablesExample
|
3
|
+
SOMECONST = 'foo' unless defined?(SOMECONST)
|
4
|
+
|
5
|
+
def initialize
|
6
|
+
$glob = 100
|
7
|
+
@inst_a = 1
|
8
|
+
@inst_b = 2
|
9
|
+
@inst_c = "1" * 40
|
10
|
+
@inst_d = BasicObject.new
|
11
|
+
@@class_c = 3
|
12
|
+
end
|
13
|
+
|
14
|
+
def run
|
15
|
+
a = 4
|
16
|
+
b = [1, 2, 3].map do |i|
|
17
|
+
a * i
|
18
|
+
end
|
19
|
+
b
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
v = VariablesExample.new
|
25
|
+
v.run
|
26
|
+
v
|
@@ -0,0 +1,31 @@
|
|
1
|
+
debugger
|
2
|
+
class VariablesXmlExample
|
3
|
+
SOMECONST = 'foo' unless defined?(SOMECONST)
|
4
|
+
|
5
|
+
def initialize
|
6
|
+
@a = "b"
|
7
|
+
end
|
8
|
+
|
9
|
+
class VariablesXmlNested
|
10
|
+
def initialize
|
11
|
+
$glob = 100
|
12
|
+
@inst_a = [1, 2, 3]
|
13
|
+
@inst_b = 2
|
14
|
+
@inst_c = "123"
|
15
|
+
@inst_d = BasicObject.new
|
16
|
+
@@class_c = 3
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def run
|
21
|
+
a = VariablesXmlNested.new
|
22
|
+
b = [1, 2, 3]
|
23
|
+
c = {:a => 'b', 'c' => 'd'}
|
24
|
+
c
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
v = VariablesXmlExample.new
|
30
|
+
v.run
|
31
|
+
v
|