arcadia 0.1.3 → 0.2.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.
- data/README +69 -77
- data/arcadia.rb +1097 -770
- data/base/a-commons.rb +480 -0
- data/base/a-contracts.rb +207 -322
- data/base/{a-utils.rb → a-tkcommons.rb} +933 -993
- data/conf/arcadia.conf +130 -203
- data/conf/arcadia.res.rb +1332 -1325
- data/ext/ae-action-dispatcher/ae-action-dispatcher.conf +6 -0
- data/ext/ae-action-dispatcher/ae-action-dispatcher.rb +22 -0
- data/ext/ae-complete-code/ae-complete-code.conf +2 -2
- data/ext/ae-complete-code/ae-complete-code.rb +82 -80
- data/ext/ae-doc-code/ae-doc-code.conf +2 -2
- data/ext/ae-doc-code/ae-doc-code.rb +114 -111
- data/ext/ae-editor/ae-editor.conf +110 -105
- data/ext/ae-editor/ae-editor.rb +2501 -2287
- data/ext/ae-editor/langs/conf.lang +15 -0
- data/ext/ae-editor/langs/lang.lang.bind +1 -0
- data/ext/ae-editor/langs/rb.lang +67 -0
- data/ext/ae-editor/langs/rbw.lang.bind +1 -0
- data/ext/ae-event-log/ae-event-log.rb +45 -52
- data/ext/ae-file-history/ae-file-history.conf +4 -4
- data/ext/ae-file-history/ae-file-history.rb +298 -286
- data/ext/ae-flag/ae-flag.conf +6 -6
- data/ext/ae-flag/ae-flag.rb +12 -12
- data/ext/ae-inspector/ae-inspector.conf +3 -3
- data/ext/ae-inspector/ae-inspector.rb +2 -2
- data/ext/ae-output-event/ae-output-event.conf +15 -15
- data/ext/ae-output/ae-output.conf +5 -3
- data/ext/ae-output/ae-output.rb +62 -33
- data/ext/ae-palette/ae-palette.conf +3 -3
- data/ext/ae-palette/ae-palette.rb +265 -306
- data/ext/ae-rad/ae-rad-inspector.rb +1534 -0
- data/{base/a-libs.rb → ext/ae-rad/ae-rad-libs.rb} +1118 -846
- data/ext/ae-rad/ae-rad-palette.rb +273 -0
- data/ext/ae-rad/ae-rad.conf +71 -0
- data/ext/ae-rad/ae-rad.rb +56 -0
- data/{lib → ext/ae-rad/lib}/tk/al-tk.rb +21 -110
- data/{lib → ext/ae-rad/lib}/tk/al-tk.res.rb +0 -0
- data/{lib → ext/ae-rad/lib}/tk/al-tkarcadia.rb +26 -26
- data/{lib → ext/ae-rad/lib}/tk/al-tkcustom.rb +70 -70
- data/{lib → ext/ae-rad/lib}/tkext/al-bwidget.rb +194 -194
- data/{lib → ext/ae-rad/lib}/tkext/al-iwidgets.rb +25 -25
- data/{lib → ext/ae-rad/lib}/tkext/al-tile.rb +173 -173
- data/{lib → ext/ae-rad/lib}/tkext/al-tktable.rb +0 -0
- data/ext/ae-ruby-debug/ae-ruby-debug.conf +7 -4
- data/ext/ae-ruby-debug/ae-ruby-debug.rb +278 -142
- data/ext/ae-search-in-files/ae-search-in-files.conf +15 -0
- data/ext/ae-search-in-files/ae-search-in-files.rb +284 -0
- data/ext/ae-shell/ae-shell.rb +88 -8
- data/ext/ae-shell/sh.rb +7 -0
- metadata +93 -79
- data/base/a-contracts-work.rb +0 -219
- data/base/a-ext.rb +0 -280
- data/ext/ae-debug/ae-debug.conf +0 -7
- data/ext/ae-debug/ae-debug.rb +0 -601
- data/ext/ae-debug/debug1.57.rb +0 -998
@@ -1,25 +1,25 @@
|
|
1
|
-
#
|
2
|
-
# al-iwidgets.rb - Arcadia Ruby ide
|
3
|
-
# by Antonio Galeone <antonio-galeone@rubyforge.org>
|
4
|
-
#
|
5
|
-
|
6
|
-
require 'lib/tk/arcadia-tk'
|
7
|
-
require 'tkextlib/iwidgets'
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
class AGTkIWidgets < AGTkBase
|
12
|
-
def newobject
|
13
|
-
@obj = Tk::Iwidgets::Calendar.new(@ag_parent.obj)
|
14
|
-
end
|
15
|
-
def properties
|
16
|
-
super()
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
|
21
|
-
class ArcadiaLibTkBWidget < ArcadiaLib
|
22
|
-
def register_classes
|
23
|
-
self.add_class(AGTkIWidgets)
|
24
|
-
end
|
25
|
-
end
|
1
|
+
#
|
2
|
+
# al-iwidgets.rb - Arcadia Ruby ide
|
3
|
+
# by Antonio Galeone <antonio-galeone@rubyforge.org>
|
4
|
+
#
|
5
|
+
|
6
|
+
require 'ext/ae-rad/lib/tk/arcadia-tk'
|
7
|
+
require 'tkextlib/iwidgets'
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
class AGTkIWidgets < AGTkBase
|
12
|
+
def newobject
|
13
|
+
@obj = Tk::Iwidgets::Calendar.new(@ag_parent.obj)
|
14
|
+
end
|
15
|
+
def properties
|
16
|
+
super()
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
|
21
|
+
class ArcadiaLibTkBWidget < ArcadiaLib
|
22
|
+
def register_classes
|
23
|
+
self.add_class(AGTkIWidgets)
|
24
|
+
end
|
25
|
+
end
|
@@ -1,173 +1,173 @@
|
|
1
|
-
#
|
2
|
-
# al-tile.rb - Arcadia Ruby ide
|
3
|
-
# by Antonio Galeone <antonio-galeone@rubyforge.org>
|
4
|
-
#
|
5
|
-
|
6
|
-
require 'lib/wrappers/tk/w-arcadia-tk'
|
7
|
-
require 'tkextlib/tile'
|
8
|
-
require "lib/arcadia/arcadia-ext"
|
9
|
-
|
10
|
-
class AGTkCommonTile < AGTkLayoutManaged
|
11
|
-
def properties
|
12
|
-
super
|
13
|
-
publish('property','name'=>'style',
|
14
|
-
'get'=> proc{@obj.cget('style')},
|
15
|
-
'set'=> proc{|j| @obj.configure('style'=>j)},
|
16
|
-
'def'=> ""
|
17
|
-
)
|
18
|
-
publish('property','name'=>'theme_use',
|
19
|
-
'get'=> proc{},
|
20
|
-
'set'=> proc{|j| Tk::Tile::Style.theme_use(j)},
|
21
|
-
'def'=> ""
|
22
|
-
)
|
23
|
-
|
24
|
-
end
|
25
|
-
|
26
|
-
end
|
27
|
-
|
28
|
-
class ATKTileLabel < AGTkCommonTile
|
29
|
-
def ATKTileLabel.class_wrapped
|
30
|
-
Tk::Tile::TLabel
|
31
|
-
end
|
32
|
-
def properties
|
33
|
-
super
|
34
|
-
publish('property','name'=>'text',
|
35
|
-
'default'=> @i_name,
|
36
|
-
'get'=> proc{@obj.cget('text')},
|
37
|
-
'set'=> proc{|t| @obj.configure('text'=>t)},
|
38
|
-
'def'=> ""
|
39
|
-
)
|
40
|
-
publish('property','name'=>'state',
|
41
|
-
'get'=> proc{@obj.cget('state')},
|
42
|
-
'set'=> proc{|j| @obj.configure('state'=>j)},
|
43
|
-
'def'=> "",
|
44
|
-
'type'=>TkType::TkagState
|
45
|
-
)
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
class ATKTileButton < AGTkCommonTile
|
52
|
-
def ATKTileButton.class_wrapped
|
53
|
-
Tk::Tile::TButton
|
54
|
-
end
|
55
|
-
def properties
|
56
|
-
super
|
57
|
-
publish('property','name'=>'text',
|
58
|
-
'default'=> @i_name,
|
59
|
-
'get'=> proc{@obj.cget('text')},
|
60
|
-
'set'=> proc{|t| @obj.configure('text'=>t)},
|
61
|
-
'def'=> ""
|
62
|
-
)
|
63
|
-
publish('property','name'=>'state',
|
64
|
-
'get'=> proc{@obj.cget('state')},
|
65
|
-
'set'=> proc{|j| @obj.configure('state'=>j)},
|
66
|
-
'def'=> "",
|
67
|
-
'type'=>TkType::TkagState
|
68
|
-
)
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
|
73
|
-
class ATKTileScrollbar < AGTkCommonTile
|
74
|
-
def ATKTileScrollbar.class_wrapped
|
75
|
-
Tk::Tile::TScrollbar
|
76
|
-
end
|
77
|
-
def properties
|
78
|
-
super
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
class ATKTileCombobox < AGTkCommonTile
|
83
|
-
def ATKTileCombobox.class_wrapped
|
84
|
-
Tk::Tile::TCombobox
|
85
|
-
end
|
86
|
-
def properties
|
87
|
-
super
|
88
|
-
publish('property','name'=>'values',
|
89
|
-
'get'=> proc{@obj.cget('values')},
|
90
|
-
'set'=> proc{|t| @obj.configure('values'=>t)},
|
91
|
-
'def'=> ""
|
92
|
-
)
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
class ATKTileSeparator < AGTkCommonTile
|
97
|
-
def ATKTileSeparator.class_wrapped
|
98
|
-
Tk::Tile::TSeparator
|
99
|
-
end
|
100
|
-
def properties
|
101
|
-
super
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
|
106
|
-
class ATKTileFrame < AGTkLayoutManagedContainer
|
107
|
-
include Tk::Tile
|
108
|
-
def ATKTileFrame.class_wrapped
|
109
|
-
TFrame
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
class ATKTileLabelframe < ATKTileFrame
|
114
|
-
def ATKTileLabelframe.class_wrapped
|
115
|
-
Tk::Tile::TLabelframe
|
116
|
-
end
|
117
|
-
def properties
|
118
|
-
super
|
119
|
-
publish('property','name'=>'text',
|
120
|
-
'default'=> @i_name,
|
121
|
-
'get'=> proc{@obj.cget('text')},
|
122
|
-
'set'=> proc{|t| @obj.configure('text'=>t)},
|
123
|
-
'def'=> ""
|
124
|
-
)
|
125
|
-
end
|
126
|
-
end
|
127
|
-
|
128
|
-
|
129
|
-
class ATkTileStyle < AGINTk
|
130
|
-
class TkTileStyle
|
131
|
-
include Tk::Tile::Style
|
132
|
-
def style
|
133
|
-
Tk::Tile::Style
|
134
|
-
end
|
135
|
-
end
|
136
|
-
def ATkTileStyle.class_wrapped
|
137
|
-
TkTileStyle
|
138
|
-
end
|
139
|
-
def properties
|
140
|
-
super
|
141
|
-
publish('property','name'=>'theme',
|
142
|
-
'get'=> proc{},
|
143
|
-
'set'=> proc{|j| @obj.style.theme_use(j)},
|
144
|
-
'def'=> "",
|
145
|
-
'type'=> EnumType.new(@obj.style.theme_names)
|
146
|
-
)
|
147
|
-
|
148
|
-
publish('property','name'=>'foreground',
|
149
|
-
'get'=> proc{},
|
150
|
-
'set'=> proc{|foreground| @obj.style.configure('foreground'=>foreground)},
|
151
|
-
'def'=> '',
|
152
|
-
'type'=> TkType::TkagColor
|
153
|
-
)
|
154
|
-
|
155
|
-
|
156
|
-
end
|
157
|
-
end
|
158
|
-
|
159
|
-
class ArcadiaLibTkTile < ArcadiaLib
|
160
|
-
def register_classes
|
161
|
-
self.add_class(ATkTileStyle)
|
162
|
-
self.add_class(ATKTileLabel)
|
163
|
-
self.add_class(ATKTileLabelframe)
|
164
|
-
self.add_class(ATKTileButton)
|
165
|
-
self.add_class(ATKTileFrame)
|
166
|
-
self.add_class(ATKTileScrollbar)
|
167
|
-
self.add_class(ATKTileCombobox)
|
168
|
-
self.add_class(ATKTileSeparator)
|
169
|
-
end
|
170
|
-
end
|
171
|
-
|
172
|
-
|
173
|
-
|
1
|
+
#
|
2
|
+
# al-tile.rb - Arcadia Ruby ide
|
3
|
+
# by Antonio Galeone <antonio-galeone@rubyforge.org>
|
4
|
+
#
|
5
|
+
|
6
|
+
require 'lib/wrappers/tk/w-arcadia-tk'
|
7
|
+
require 'tkextlib/tile'
|
8
|
+
require "lib/arcadia/arcadia-ext"
|
9
|
+
|
10
|
+
class AGTkCommonTile < AGTkLayoutManaged
|
11
|
+
def properties
|
12
|
+
super
|
13
|
+
publish('property','name'=>'style',
|
14
|
+
'get'=> proc{@obj.cget('style')},
|
15
|
+
'set'=> proc{|j| @obj.configure('style'=>j)},
|
16
|
+
'def'=> ""
|
17
|
+
)
|
18
|
+
publish('property','name'=>'theme_use',
|
19
|
+
'get'=> proc{},
|
20
|
+
'set'=> proc{|j| Tk::Tile::Style.theme_use(j)},
|
21
|
+
'def'=> ""
|
22
|
+
)
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
class ATKTileLabel < AGTkCommonTile
|
29
|
+
def ATKTileLabel.class_wrapped
|
30
|
+
Tk::Tile::TLabel
|
31
|
+
end
|
32
|
+
def properties
|
33
|
+
super
|
34
|
+
publish('property','name'=>'text',
|
35
|
+
'default'=> @i_name,
|
36
|
+
'get'=> proc{@obj.cget('text')},
|
37
|
+
'set'=> proc{|t| @obj.configure('text'=>t)},
|
38
|
+
'def'=> ""
|
39
|
+
)
|
40
|
+
publish('property','name'=>'state',
|
41
|
+
'get'=> proc{@obj.cget('state')},
|
42
|
+
'set'=> proc{|j| @obj.configure('state'=>j)},
|
43
|
+
'def'=> "",
|
44
|
+
'type'=>TkType::TkagState
|
45
|
+
)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
class ATKTileButton < AGTkCommonTile
|
52
|
+
def ATKTileButton.class_wrapped
|
53
|
+
Tk::Tile::TButton
|
54
|
+
end
|
55
|
+
def properties
|
56
|
+
super
|
57
|
+
publish('property','name'=>'text',
|
58
|
+
'default'=> @i_name,
|
59
|
+
'get'=> proc{@obj.cget('text')},
|
60
|
+
'set'=> proc{|t| @obj.configure('text'=>t)},
|
61
|
+
'def'=> ""
|
62
|
+
)
|
63
|
+
publish('property','name'=>'state',
|
64
|
+
'get'=> proc{@obj.cget('state')},
|
65
|
+
'set'=> proc{|j| @obj.configure('state'=>j)},
|
66
|
+
'def'=> "",
|
67
|
+
'type'=>TkType::TkagState
|
68
|
+
)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
|
73
|
+
class ATKTileScrollbar < AGTkCommonTile
|
74
|
+
def ATKTileScrollbar.class_wrapped
|
75
|
+
Tk::Tile::TScrollbar
|
76
|
+
end
|
77
|
+
def properties
|
78
|
+
super
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
class ATKTileCombobox < AGTkCommonTile
|
83
|
+
def ATKTileCombobox.class_wrapped
|
84
|
+
Tk::Tile::TCombobox
|
85
|
+
end
|
86
|
+
def properties
|
87
|
+
super
|
88
|
+
publish('property','name'=>'values',
|
89
|
+
'get'=> proc{@obj.cget('values')},
|
90
|
+
'set'=> proc{|t| @obj.configure('values'=>t)},
|
91
|
+
'def'=> ""
|
92
|
+
)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
class ATKTileSeparator < AGTkCommonTile
|
97
|
+
def ATKTileSeparator.class_wrapped
|
98
|
+
Tk::Tile::TSeparator
|
99
|
+
end
|
100
|
+
def properties
|
101
|
+
super
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
|
106
|
+
class ATKTileFrame < AGTkLayoutManagedContainer
|
107
|
+
include Tk::Tile
|
108
|
+
def ATKTileFrame.class_wrapped
|
109
|
+
TFrame
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
class ATKTileLabelframe < ATKTileFrame
|
114
|
+
def ATKTileLabelframe.class_wrapped
|
115
|
+
Tk::Tile::TLabelframe
|
116
|
+
end
|
117
|
+
def properties
|
118
|
+
super
|
119
|
+
publish('property','name'=>'text',
|
120
|
+
'default'=> @i_name,
|
121
|
+
'get'=> proc{@obj.cget('text')},
|
122
|
+
'set'=> proc{|t| @obj.configure('text'=>t)},
|
123
|
+
'def'=> ""
|
124
|
+
)
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
|
129
|
+
class ATkTileStyle < AGINTk
|
130
|
+
class TkTileStyle
|
131
|
+
include Tk::Tile::Style
|
132
|
+
def style
|
133
|
+
Tk::Tile::Style
|
134
|
+
end
|
135
|
+
end
|
136
|
+
def ATkTileStyle.class_wrapped
|
137
|
+
TkTileStyle
|
138
|
+
end
|
139
|
+
def properties
|
140
|
+
super
|
141
|
+
publish('property','name'=>'theme',
|
142
|
+
'get'=> proc{},
|
143
|
+
'set'=> proc{|j| @obj.style.theme_use(j)},
|
144
|
+
'def'=> "",
|
145
|
+
'type'=> EnumType.new(@obj.style.theme_names)
|
146
|
+
)
|
147
|
+
|
148
|
+
publish('property','name'=>'foreground',
|
149
|
+
'get'=> proc{},
|
150
|
+
'set'=> proc{|foreground| @obj.style.configure('foreground'=>foreground)},
|
151
|
+
'def'=> '',
|
152
|
+
'type'=> TkType::TkagColor
|
153
|
+
)
|
154
|
+
|
155
|
+
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
class ArcadiaLibTkTile < ArcadiaLib
|
160
|
+
def register_classes
|
161
|
+
self.add_class(ATkTileStyle)
|
162
|
+
self.add_class(ATKTileLabel)
|
163
|
+
self.add_class(ATKTileLabelframe)
|
164
|
+
self.add_class(ATKTileButton)
|
165
|
+
self.add_class(ATKTileFrame)
|
166
|
+
self.add_class(ATKTileScrollbar)
|
167
|
+
self.add_class(ATKTileCombobox)
|
168
|
+
self.add_class(ATKTileSeparator)
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
|
173
|
+
|
File without changes
|
@@ -1,11 +1,13 @@
|
|
1
|
-
|
1
|
+
#========================================
|
2
|
+
#========================================
|
2
3
|
name=ruby-debug
|
3
|
-
|
4
|
-
|
4
|
+
labels=Ruby Debug
|
5
|
+
frames=0.0
|
5
6
|
active=yes
|
6
7
|
require=ext/ae-ruby-debug/ae-ruby-debug
|
7
8
|
class=RubyDebug
|
8
|
-
|
9
|
+
#========================================
|
10
|
+
#========================================
|
9
11
|
server.host=localhost
|
10
12
|
server.port=8989
|
11
13
|
server.timeout=10
|
@@ -17,4 +19,5 @@ freebsd::font=courier 10
|
|
17
19
|
freebsd::font.bold=courier 10 bold
|
18
20
|
win::font={Courier New} 8
|
19
21
|
win::font.bold={Courier New} 8 bold
|
22
|
+
#========================================
|
20
23
|
|
@@ -3,7 +3,12 @@
|
|
3
3
|
# by Antonio Galeone <antonio-galeone@rubyforge.org>
|
4
4
|
#
|
5
5
|
|
6
|
+
|
6
7
|
class RubyDebugView
|
8
|
+
include TkUtil
|
9
|
+
B_STATE_ON = '+'
|
10
|
+
B_STATE_OFF = '-'
|
11
|
+
B_STATE_FREEZE = '='
|
7
12
|
def initialize(_frame, _controller)
|
8
13
|
@frame = _frame
|
9
14
|
@controller = _controller
|
@@ -136,7 +141,8 @@ class RubyDebugView
|
|
136
141
|
_text = @tree_process.itemcget(_selected, 'text')
|
137
142
|
pos = match_position_from_stack(_text)
|
138
143
|
if pos.length >0
|
139
|
-
|
144
|
+
Arcadia.process_event(OpenBufferEvent.new(self,'file'=>pos[0], 'row'=>pos[1]))
|
145
|
+
#EditorContract.instance.open_file(self, 'file'=>pos[0], 'line'=>pos[1])
|
140
146
|
end
|
141
147
|
end
|
142
148
|
})
|
@@ -159,6 +165,7 @@ class RubyDebugView
|
|
159
165
|
@tree_var.delete(@tree_var.nodes('local_var'))
|
160
166
|
@tree_var.delete(@tree_var.nodes('instance_var'))
|
161
167
|
@tree_var.delete(@tree_var.nodes('global_var'))
|
168
|
+
#@tree_var.delete(@tree_var.nodes('class_var'))
|
162
169
|
@tree_var.delete(@tree_var.nodes('eval')) if @tree_var.exist?('eval')
|
163
170
|
end
|
164
171
|
|
@@ -166,6 +173,15 @@ class RubyDebugView
|
|
166
173
|
@tree_process.delete(@tree_process.nodes('root'))
|
167
174
|
end
|
168
175
|
|
176
|
+
def bnext_state(_state)
|
177
|
+
if _state == B_STATE_ON
|
178
|
+
return B_STATE_FREEZE
|
179
|
+
elsif _state == B_STATE_FREEZE
|
180
|
+
return B_STATE_OFF
|
181
|
+
elsif _state == B_STATE_OFF
|
182
|
+
return B_STATE_ON
|
183
|
+
end
|
184
|
+
end
|
169
185
|
|
170
186
|
def build_var_panel(_frame)
|
171
187
|
_open_proc = proc do |_arg|
|
@@ -189,12 +205,14 @@ class RubyDebugView
|
|
189
205
|
}.pack('side'=>'right', 'fill'=>'y')
|
190
206
|
@tree_var.yscrollcommand proc{|first,last| _scrollbar.set(first,last)}
|
191
207
|
|
192
|
-
@
|
193
|
-
@
|
194
|
-
|
208
|
+
@local_state = B_STATE_ON
|
209
|
+
@instance_state = B_STATE_ON
|
210
|
+
#@class_state = B_STATE_ON
|
211
|
+
@global_state = B_STATE_OFF
|
195
212
|
|
196
213
|
_i_on = TkPhotoImage.new('dat' => ON_GIF)
|
197
214
|
_i_off = TkPhotoImage.new('dat' => OFF_GIF)
|
215
|
+
_i_freeze = TkPhotoImage.new('dat' => FREEZE_GIF)
|
198
216
|
|
199
217
|
_b_relief = 'groove'
|
200
218
|
@b_local_onoff = TkButton.new(@tree_var){
|
@@ -203,15 +221,17 @@ class RubyDebugView
|
|
203
221
|
state 'disabled'
|
204
222
|
anchor 'nw'
|
205
223
|
}.bind("1",proc{
|
206
|
-
@
|
207
|
-
if @
|
224
|
+
@local_state = bnext_state(@local_state)
|
225
|
+
if @local_state == B_STATE_ON
|
208
226
|
@b_local_onoff.image(_i_on)
|
209
227
|
command_enabled(false)
|
210
228
|
Thread.new{
|
211
229
|
update_variables('local_var', @controller.rdc.variables('local_variables')) #if @tree_var.open?('local_var')
|
212
230
|
command_enabled(true)
|
213
231
|
}
|
214
|
-
|
232
|
+
elsif @local_state == B_STATE_FREEZE
|
233
|
+
@b_local_onoff.image(_i_freeze)
|
234
|
+
elsif @local_state == B_STATE_OFF
|
215
235
|
@b_local_onoff.image(_i_off)
|
216
236
|
@tree_var.delete(@tree_var.nodes('local_var'))
|
217
237
|
end
|
@@ -234,22 +254,22 @@ class RubyDebugView
|
|
234
254
|
state 'disabled'
|
235
255
|
anchor 'nw'
|
236
256
|
}.bind("1",proc{
|
237
|
-
@
|
238
|
-
if @
|
257
|
+
@instance_state = bnext_state(@instance_state)
|
258
|
+
if @instance_state == B_STATE_ON
|
239
259
|
@b_instance_onoff.image(_i_on)
|
240
260
|
command_enabled(false)
|
241
261
|
Thread.new{
|
242
262
|
update_variables('instance_var', @controller.rdc.variables('instance_variables')) #if @tree_var.open?('local_var')
|
243
263
|
command_enabled(true)
|
244
264
|
}
|
245
|
-
|
265
|
+
elsif @instance_state == B_STATE_FREEZE
|
266
|
+
@b_instance_onoff.image(_i_freeze)
|
267
|
+
elsif @instance_state == B_STATE_OFF
|
246
268
|
@b_instance_onoff.image(_i_off)
|
247
269
|
@tree_var.delete(@tree_var.nodes('instance_var'))
|
248
270
|
end
|
249
271
|
})
|
250
272
|
@tree_var.insert('end', 'root' ,'instance_var', {
|
251
|
-
# 'deltax' => 0,
|
252
|
-
# 'padx'=>2,
|
253
273
|
'fill'=>'#892541',
|
254
274
|
'open'=>true,
|
255
275
|
'anchor'=>'w',
|
@@ -258,21 +278,52 @@ class RubyDebugView
|
|
258
278
|
'window' => @b_instance_onoff
|
259
279
|
})
|
260
280
|
|
281
|
+
# @b_class_onoff = TkButton.new(@tree_var){
|
282
|
+
# image _i_on
|
283
|
+
# relief _b_relief
|
284
|
+
# state 'disabled'
|
285
|
+
# anchor 'nw'
|
286
|
+
# }.bind("1",proc{
|
287
|
+
# @class_on = !@class_on
|
288
|
+
# if @class_on
|
289
|
+
# @b_class_onoff.image(_i_on)
|
290
|
+
# command_enabled(false)
|
291
|
+
# Thread.new{
|
292
|
+
# update_variables('class_var', @controller.rdc.variables('class_variables')) #if @tree_var.open?('local_var')
|
293
|
+
# command_enabled(true)
|
294
|
+
# }
|
295
|
+
# else
|
296
|
+
# @b_class_onoff.image(_i_off)
|
297
|
+
# @tree_var.delete(@tree_var.nodes('class_var'))
|
298
|
+
# end
|
299
|
+
# })
|
300
|
+
# @tree_var.insert('end', 'root' ,'class_var', {
|
301
|
+
# 'fill'=>'#230bd7',
|
302
|
+
# 'open'=>true,
|
303
|
+
# 'anchor'=>'w',
|
304
|
+
# 'font' => @controller.conf('font.bold'),
|
305
|
+
# 'text' => "Class variables",
|
306
|
+
# 'window' => @b_class_onoff
|
307
|
+
# })
|
308
|
+
|
309
|
+
|
261
310
|
@b_global_onoff = TkButton.new(@tree_var){
|
262
311
|
image _i_off
|
263
312
|
relief _b_relief
|
264
313
|
state 'disabled'
|
265
314
|
anchor 'nw'
|
266
315
|
}.bind("1",proc{
|
267
|
-
@
|
268
|
-
if @
|
316
|
+
@global_state = bnext_state(@global_state)
|
317
|
+
if @global_state == B_STATE_ON
|
269
318
|
@b_global_onoff.image(_i_on)
|
270
319
|
command_enabled(false)
|
271
320
|
Thread.new{
|
272
321
|
update_variables('global_var', @controller.rdc.variables('global_variables')) #if @tree_var.open?('local_var')
|
273
322
|
command_enabled(true)
|
274
323
|
}
|
275
|
-
|
324
|
+
elsif @global_state == B_STATE_FREEZE
|
325
|
+
@b_global_onoff.image(_i_freeze)
|
326
|
+
elsif @global_state == B_STATE_OFF
|
276
327
|
@b_global_onoff.image(_i_off)
|
277
328
|
@tree_var.delete(@tree_var.nodes('global_var'))
|
278
329
|
end
|
@@ -368,8 +419,8 @@ class RubyDebugView
|
|
368
419
|
|
369
420
|
|
370
421
|
def rdebug_client_update(_command, _result)
|
371
|
-
#
|
372
|
-
return if !@controller.rdc.is_debugging_ready?
|
422
|
+
#Arcadia.new_debug_msg(self,"on command #{_command}")
|
423
|
+
return if @controller.rdc.nil? || !@controller.rdc.is_debugging_ready?
|
373
424
|
begin
|
374
425
|
if _command == 'quit'
|
375
426
|
msg = "Really quit debug ? (y/n)"
|
@@ -388,16 +439,17 @@ class RubyDebugView
|
|
388
439
|
elsif _command != 'where' && _command != 'quit_yes'
|
389
440
|
begin
|
390
441
|
update_position
|
391
|
-
update_variables('local_var', @controller.rdc.variables('local_variables')) if @
|
392
|
-
update_variables('instance_var', @controller.rdc.variables('instance_variables')) if @
|
393
|
-
#
|
394
|
-
|
442
|
+
update_variables('local_var', @controller.rdc.variables('local_variables')) if @local_state == B_STATE_ON
|
443
|
+
update_variables('instance_var', @controller.rdc.variables('instance_variables')) if @instance_state == B_STATE_ON
|
444
|
+
#update_variables('class_var', @controller.rdc.variables('class_variables')) if @instance_on
|
445
|
+
#Arcadia.new_debug_msg(self,"on command #{_command}:global_variables")
|
446
|
+
update_variables('global_var', @controller.rdc.variables('global_variables')) if @global_state == B_STATE_ON
|
395
447
|
ensure
|
396
|
-
command_enabled(true) if @controller.rdc.is_debugging_ready? && (!_command.include?('quit') || _command.include?('quit_no'))
|
448
|
+
command_enabled(true) if !@controller.rdc.nil? && @controller.rdc.is_debugging_ready? && (!_command.include?('quit') || _command.include?('quit_no'))
|
397
449
|
end
|
398
450
|
end
|
399
451
|
rescue Exception => e
|
400
|
-
|
452
|
+
Arcadia.new_debug_msg(self,"on command #{_command}:#{e.inspect}")
|
401
453
|
end
|
402
454
|
end
|
403
455
|
|
@@ -416,25 +468,17 @@ class RubyDebugView
|
|
416
468
|
|
417
469
|
def update_position
|
418
470
|
stack = @controller.rdc.where
|
419
|
-
#
|
471
|
+
#Arcadia.new_debug_msg(self,stack)
|
420
472
|
if !stack.nil?
|
421
473
|
stack = stack.split(/\n/)
|
422
474
|
line_no = -1
|
423
475
|
if !stack[0].nil?
|
424
476
|
pos = match_position_from_stack(stack[0])
|
425
|
-
#matchline = stack[0].match(/-->.#[0-9]*.*:([0-9]*)/)
|
426
|
-
##matchline = stack[0].match(/.*:([0-9]*)/)
|
427
|
-
#line_no = matchline[1].to_i if !matchline.nil? && matchline.length==2
|
428
|
-
|
429
|
-
#matchfile = stack[0].match(/-->.#[0-9]*.(.*):[0-9]*/)
|
430
|
-
##matchfile = stack[0].match(/.(.*):[0-9]*/)
|
431
|
-
|
432
|
-
#filename = matchfile[1].to_s if !matchfile.nil? && matchfile.length==2
|
433
477
|
end
|
434
478
|
if pos.length > 0
|
435
|
-
#MsgContract.instance.out_debug(self,"'file'=> #{pos[0]}, 'line'=>#{pos[1]}")
|
436
479
|
_file = File.expand_path(pos[0])
|
437
|
-
|
480
|
+
Arcadia.broadcast_event(DebugStepInfoEvent.new(self,'file'=> _file, 'row'=>pos[1]))
|
481
|
+
#DebugContract.instance.debug_step(self, 'file'=> _file, 'line'=>pos[1])
|
438
482
|
break_list_select(_file, pos[1].to_s)
|
439
483
|
end
|
440
484
|
i = 0
|
@@ -454,13 +498,8 @@ class RubyDebugView
|
|
454
498
|
end
|
455
499
|
end
|
456
500
|
|
457
|
-
def is_simple_class?(
|
458
|
-
['Numeric','Fixnum','String','FalseClass','TrueClass','NilClass'].include?(
|
459
|
-
# _class == Numeric || _class.superclass == Numeric ||
|
460
|
-
# _class == String || _class.superclass == String ||
|
461
|
-
# _class == FalseClass || _class.superclass == FalseClass||
|
462
|
-
# _class == TrueClass || _class.superclass == TrueClass||
|
463
|
-
# _class == NilClass || _class.superclass == NilClass
|
501
|
+
def is_simple_class?(_var)
|
502
|
+
['Numeric','Fixnum','String','FalseClass','TrueClass','NilClass'].include?(_var.value_class) && !_var.value.to_s.strip.include?("\n")
|
464
503
|
end
|
465
504
|
|
466
505
|
def show_expression(_exp, _hash)
|
@@ -481,8 +520,11 @@ class RubyDebugView
|
|
481
520
|
begin
|
482
521
|
_var = var_name(_node)
|
483
522
|
_o = @controller.rdc.debug_dump(_var)
|
484
|
-
|
485
|
-
|
523
|
+
if _o.class == Hash
|
524
|
+
var_deep(_node, _o)
|
525
|
+
else
|
526
|
+
var_deep_string(_node, _o)
|
527
|
+
end
|
486
528
|
ensure
|
487
529
|
command_enabled(true)
|
488
530
|
end
|
@@ -494,14 +536,20 @@ class RubyDebugView
|
|
494
536
|
# @tree_var.itemconfigure(_var, 'text' => "#{_var_cla}:#{_var_len}")
|
495
537
|
return nil if _hash.nil?
|
496
538
|
return _hash.to_s if _hash.class != Hash
|
497
|
-
_hash
|
539
|
+
if _hash['__CLASS__']=='Array'
|
540
|
+
_sorted_keys = _hash.keys.collect!{|x| x.to_i}.sort.collect!{|x| x.to_s}
|
541
|
+
else
|
542
|
+
_sorted_keys = _hash.keys.sort
|
543
|
+
end
|
544
|
+
_sorted_keys.each{|k|
|
545
|
+
#_hash.keys.sort.each{|k|
|
498
546
|
v = _hash[k]
|
499
547
|
next if k=='__CLASS__'
|
500
548
|
_complex = v.class == Hash
|
501
549
|
if _complex
|
502
550
|
_text = var_format(k,v['__CLASS__'])
|
503
551
|
elsif (k=='__LENGTH__') && v=='0'
|
504
|
-
_text = '{
|
552
|
+
_text = '{}'
|
505
553
|
elsif (k=='__LENGTH__') && v!='0'
|
506
554
|
next
|
507
555
|
else
|
@@ -521,6 +569,23 @@ class RubyDebugView
|
|
521
569
|
var_deep(_node,v) if _complex
|
522
570
|
}
|
523
571
|
end
|
572
|
+
|
573
|
+
def var_deep_string(_var, _str)
|
574
|
+
@tree_var.delete(@tree_var.nodes(_var))
|
575
|
+
return nil if _str.nil?
|
576
|
+
_str = _str.to_s if !_str.kind_of?(String)
|
577
|
+
a_str = _str.split("\n")
|
578
|
+
a_str.each_with_index{|v,i|
|
579
|
+
_node = node_name(i.to_s, _var)
|
580
|
+
@tree_var.insert('end', _var ,_node, {
|
581
|
+
'font' => @controller.conf('font'),
|
582
|
+
'text' => v,
|
583
|
+
'fill' => '#79ca77',
|
584
|
+
'anchor'=>'w'
|
585
|
+
})
|
586
|
+
}
|
587
|
+
end
|
588
|
+
|
524
589
|
|
525
590
|
def var_format(_name, _class, _value=nil)
|
526
591
|
if !_value.nil? && !_class.nil?
|
@@ -530,7 +595,7 @@ class RubyDebugView
|
|
530
595
|
elsif !_value.nil? && _class.nil?
|
531
596
|
return "#{_name.to_s.strip} => #{_value.to_s.strip}"
|
532
597
|
elsif _value.nil? && _class.nil?
|
533
|
-
return "#{_name.to_s.strip} => {
|
598
|
+
return "#{_name.to_s.strip} => {}"
|
534
599
|
end
|
535
600
|
end
|
536
601
|
|
@@ -545,13 +610,13 @@ class RubyDebugView
|
|
545
610
|
end
|
546
611
|
|
547
612
|
def command_enabled(_value)
|
548
|
-
#
|
549
|
-
|
613
|
+
#Arcadia.new_debug_msg(self,"command_enabled= #{_value.to_s}")
|
550
614
|
@c_on = _value
|
551
615
|
_value ? _state = 'normal':_state = 'disabled'
|
552
616
|
@debug_button_box.configure(:state=>_state)
|
553
617
|
@b_local_onoff.configure(:state=>_state)
|
554
618
|
@b_instance_onoff.configure(:state=>_state)
|
619
|
+
#@b_class_onoff.configure(:state=>_state)
|
555
620
|
@b_global_onoff.configure(:state=>_state)
|
556
621
|
Tk.update
|
557
622
|
end
|
@@ -560,25 +625,32 @@ class RubyDebugView
|
|
560
625
|
if _var.keys.sort == @tree_var.nodes(_parent_node).collect! {|x| var_name(x).to_s}.sort
|
561
626
|
_var.each{|k,v|
|
562
627
|
_n = node_name(k, _parent_node)
|
563
|
-
if is_simple_class?(v
|
628
|
+
if is_simple_class?(v)
|
564
629
|
_text = var_format(k,v.value_class,v.value)
|
630
|
+
_drawcross = 'auto'
|
565
631
|
else
|
566
632
|
_text = var_format(k,v.value_class)
|
633
|
+
_drawcross = 'always'
|
634
|
+
@nodes_to_open << _n if !@nodes_to_open.include?(_n)
|
635
|
+
inspect_node(_n) if bool(@tree_var.itemcget(@tree_var.tagid(_n), 'open'))
|
567
636
|
end
|
568
|
-
_node = @tree_var.itemconfigure(_n,
|
637
|
+
_node = @tree_var.itemconfigure(_n,
|
638
|
+
'text' => _text,
|
639
|
+
'helptext' => v.value,
|
640
|
+
'drawcross' => _drawcross
|
641
|
+
)
|
569
642
|
}
|
570
643
|
else
|
571
644
|
@nodes_to_open.clear
|
572
645
|
@tree_var.delete(@tree_var.nodes(_parent_node))
|
573
646
|
#@nodes[_parent_node].clear
|
574
|
-
_var.each{|k
|
647
|
+
_var.keys.sort.each{|k|
|
648
|
+
v = _var[k]
|
575
649
|
_n = node_name(k, _parent_node)
|
576
|
-
if is_simple_class?(v
|
577
|
-
#MsgContract.instance.out_simple(self,"#{k} : simple")
|
650
|
+
if is_simple_class?(v)
|
578
651
|
_text = var_format(k,v.value_class,v.value)
|
579
652
|
_drawcross = 'auto'
|
580
653
|
else
|
581
|
-
#MsgContract.instance.out_simple(self,"#{k} : complex")
|
582
654
|
_text = var_format(k,v.value_class)
|
583
655
|
_drawcross = 'always'
|
584
656
|
@nodes_to_open << _n
|
@@ -589,9 +661,7 @@ class RubyDebugView
|
|
589
661
|
'helptext' => v.value,
|
590
662
|
'drawcross' => _drawcross,
|
591
663
|
'anchor'=>'w'
|
592
|
-
# 'deltax' => 1
|
593
664
|
})
|
594
|
-
#@nodes[_parent_node] << k
|
595
665
|
}
|
596
666
|
end
|
597
667
|
Tk.update
|
@@ -602,10 +672,13 @@ class RubyDebugView
|
|
602
672
|
begin
|
603
673
|
command_enabled(false)
|
604
674
|
#@debug_button_box.configure(:state=>'disabled')
|
605
|
-
Thread.new
|
675
|
+
Thread.new do
|
676
|
+
Arcadia.process_event(StepDebugEvent.new(self, 'command'=>_command))
|
677
|
+
#@controller.rdc.send(_command)
|
678
|
+
end
|
606
679
|
#@controller.rdc.send(_command)
|
607
680
|
rescue Exception => e
|
608
|
-
|
681
|
+
Arcadia.new_debug_msg(self,"---> "+e.to_s)
|
609
682
|
end
|
610
683
|
end
|
611
684
|
end
|
@@ -616,11 +689,23 @@ end
|
|
616
689
|
|
617
690
|
class RubyDebugServer
|
618
691
|
include Observable
|
692
|
+
attr_accessor :quit_confirm_request
|
619
693
|
RDS_QUIET = 'RDS_QUIET'
|
620
|
-
def initialize(_caller)
|
694
|
+
def initialize(_caller, _arcadia=nil)
|
621
695
|
if _caller.respond_to? :rdebug_server_update
|
622
696
|
ObserverCallback.new(self,_caller,:rdebug_server_update)
|
623
697
|
end
|
698
|
+
@arcadia = _arcadia
|
699
|
+
@quit_confirm_request = false
|
700
|
+
end
|
701
|
+
|
702
|
+
def start_session_new(_filename, _host='localhost', _remote_port='8989')
|
703
|
+
if is_windows?
|
704
|
+
commandLine = "rdebug.cmd --host #{_host} --port #{_remote_port} -sw #{_filename}"
|
705
|
+
else
|
706
|
+
commandLine = "rdebug --host #{_host} --port #{_remote_port} -sw #{_filename}"
|
707
|
+
end
|
708
|
+
Arcadia.process_event(SystemExecEvent.new(self, 'command'=>commandLine))
|
624
709
|
end
|
625
710
|
|
626
711
|
def start_session(_filename, _host='localhost', _remote_port='8989')
|
@@ -629,23 +714,35 @@ class RubyDebugServer
|
|
629
714
|
else
|
630
715
|
commandLine = "rdebug --host #{_host} --port #{_remote_port} -sw #{_filename}"
|
631
716
|
end
|
632
|
-
#MsgContract.instance.out_debug(self,commandLine)
|
633
717
|
begin
|
634
718
|
if is_windows?
|
635
719
|
@tid = Thread.new {
|
636
|
-
Kernel.system(commandLine)
|
637
|
-
|
720
|
+
if Kernel.system(commandLine)
|
721
|
+
Kernel.system('y')
|
722
|
+
else
|
723
|
+
if @quit_confirm_request
|
724
|
+
Arcadia.new_msg(self,"#{$?.inspect}")
|
725
|
+
else
|
726
|
+
_event = Arcadia.process_event(RunRubyFileEvent.new(self, 'file'=>_filename))
|
727
|
+
Arcadia.new_debug_msg(self,"#{_event.results[0].output}")
|
728
|
+
end
|
729
|
+
end
|
638
730
|
notify(RDS_QUIET)
|
639
731
|
}
|
640
732
|
else
|
641
733
|
@pid = Process.fork {
|
642
|
-
Kernel.system(commandLine)
|
643
|
-
|
734
|
+
if Kernel.system(commandLine)
|
735
|
+
Kernel.system('y')
|
736
|
+
else
|
737
|
+
Kernel.exit!
|
738
|
+
Arcadia.new_debug_msg(self,"#{$?.inspect}")
|
739
|
+
end
|
740
|
+
Process.wait
|
644
741
|
notify(RDS_QUIET)
|
645
742
|
}
|
646
743
|
end
|
647
744
|
rescue Exception => e
|
648
|
-
|
745
|
+
Arcadia.new_debug_msg(self,"Error on start_server : #{e.class}:#{e.message}")
|
649
746
|
end
|
650
747
|
end
|
651
748
|
|
@@ -659,13 +756,12 @@ class RubyDebugServer
|
|
659
756
|
end
|
660
757
|
notify(RDS_QUIET)
|
661
758
|
rescue Exception => e
|
662
|
-
|
759
|
+
Arcadia.new_debug_msg(self,"Error on start_server : #{e.class}:#{e.message}")
|
663
760
|
end
|
664
761
|
end
|
665
762
|
|
666
763
|
def is_windows?
|
667
764
|
!(RUBY_PLATFORM =~ /(win|w)32$/).nil?
|
668
|
-
#RUBY_PLATFORM.include?('win')
|
669
765
|
end
|
670
766
|
|
671
767
|
def notify(_state)
|
@@ -772,7 +868,7 @@ class RubyDebugClient
|
|
772
868
|
end
|
773
869
|
|
774
870
|
def notify(_command, _result=nil)
|
775
|
-
#
|
871
|
+
#Arcadia.new_debug_msg(self,"notify=>#{_command}")
|
776
872
|
@busy = false
|
777
873
|
changed
|
778
874
|
notify_observers(_command, _result)
|
@@ -792,6 +888,7 @@ class RubyDebugClient
|
|
792
888
|
end
|
793
889
|
|
794
890
|
def socket_session
|
891
|
+
#Arcadia.new_debug_msg(self,"socket_session : passo")
|
795
892
|
if @session.nil?
|
796
893
|
begin
|
797
894
|
#sleep(2)
|
@@ -803,11 +900,11 @@ class RubyDebugClient
|
|
803
900
|
if @t > 0
|
804
901
|
socket_session
|
805
902
|
else
|
806
|
-
|
903
|
+
Arcadia.new_debug_msg(self,"socket_session : #{e.inspect}")
|
807
904
|
end
|
808
905
|
end
|
809
906
|
end
|
810
|
-
#
|
907
|
+
#Arcadia.new_debug_msg(self,"session : #{@session.inspect}")
|
811
908
|
return @session
|
812
909
|
end
|
813
910
|
|
@@ -816,7 +913,7 @@ class RubyDebugClient
|
|
816
913
|
@session.close if is_alive?
|
817
914
|
@session = nil
|
818
915
|
rescue Exception => e
|
819
|
-
|
916
|
+
Arcadia.new_debug_msg(self,"Error on close session : #{e.class}:#{e.message}")
|
820
917
|
end
|
821
918
|
end
|
822
919
|
|
@@ -824,13 +921,13 @@ class RubyDebugClient
|
|
824
921
|
begin
|
825
922
|
@t = @timeout
|
826
923
|
if socket_session
|
827
|
-
#
|
924
|
+
#Arcadia.new_debug_msg(self,"session : #{@session.inspect}")
|
828
925
|
notify('start', read)
|
829
926
|
read("eval require 'yaml'")
|
830
927
|
end
|
831
928
|
return @session
|
832
929
|
rescue Exception => e
|
833
|
-
|
930
|
+
Arcadia.new_debug_msg(self,"Error on start_session : #{e.class}:#{e.message}")
|
834
931
|
end
|
835
932
|
end
|
836
933
|
|
@@ -839,13 +936,13 @@ class RubyDebugClient
|
|
839
936
|
quit if is_debugging_ready?
|
840
937
|
@session.close if is_alive?
|
841
938
|
rescue Exception => e
|
842
|
-
|
939
|
+
Arcadia.new_debug_msg(self,"Error on stop_session : #{e.class}:#{e.inspect}")
|
843
940
|
end
|
844
941
|
end
|
845
942
|
|
846
943
|
# send a command to the debugger via socket
|
847
944
|
def command(_command)
|
848
|
-
#
|
945
|
+
#Arcadia.new_debug_msg(self,"command=>#{_command}")
|
849
946
|
begin
|
850
947
|
return false if @busy
|
851
948
|
if is_alive?
|
@@ -856,16 +953,15 @@ class RubyDebugClient
|
|
856
953
|
end
|
857
954
|
true
|
858
955
|
rescue Errno::ECONNABORTED => e
|
859
|
-
#kill
|
860
956
|
notify("quit_yes")
|
861
|
-
DebugContract.instance.debug_end(self)
|
862
|
-
|
957
|
+
#DebugContract.instance.debug_end(self)
|
958
|
+
Arcadia.new_debug_msg(self,"Debugger has finished executing:\n #{e.class}:#{e.inspect}")
|
863
959
|
@session = nil
|
864
960
|
@pend = true
|
865
961
|
false
|
866
962
|
#raise RubyDebugException.new("Debugged has finished executing")
|
867
963
|
rescue Exception => e
|
868
|
-
|
964
|
+
Arcadia.new_debug_msg(self,"Error on command #{_command}: #{e.class}:#{e.inspect}")
|
869
965
|
false
|
870
966
|
end
|
871
967
|
end
|
@@ -876,12 +972,11 @@ class RubyDebugClient
|
|
876
972
|
socket_session.flush
|
877
973
|
result = ""
|
878
974
|
while _command !='y' && is_alive? && line = socket_session.gets
|
879
|
-
#
|
975
|
+
#Arcadia.new_debug_msg(self, "read: letta riga => #{line}")
|
880
976
|
break if line =~ /^PROMPT (.*)$/ || line =~ /.(y\/n)./
|
881
977
|
result << line
|
882
978
|
#break if _command =~ /^eval./
|
883
979
|
end
|
884
|
-
#MsgContract.instance.out_simple(self, "read(#{_command}): result => #{result}")
|
885
980
|
@busy = false
|
886
981
|
result
|
887
982
|
|
@@ -921,7 +1016,7 @@ class RubyDebugClient
|
|
921
1016
|
|
922
1017
|
def quit_yes
|
923
1018
|
notify("quit_yes", read("y"))
|
924
|
-
DebugContract.instance.debug_end(self)
|
1019
|
+
#DebugContract.instance.debug_end(self)
|
925
1020
|
kill
|
926
1021
|
end
|
927
1022
|
|
@@ -936,11 +1031,9 @@ class RubyDebugClient
|
|
936
1031
|
|
937
1032
|
|
938
1033
|
def yaml_pseudo_load(_obj)
|
939
|
-
#MsgContract.instance.out_simple(self,"_obj="+_obj.inspect)
|
940
1034
|
just_present = @valuobjs.include?(_obj)
|
941
1035
|
@valuobjs << _obj
|
942
1036
|
if _obj.class == YAML::DomainType
|
943
|
-
#MsgContract.instance.out_simple(self,"_obj DomainType="+_obj.inspect)
|
944
1037
|
return _obj.type_id if just_present
|
945
1038
|
ret = Hash.new
|
946
1039
|
ret['__CLASS__']=_obj.type_id
|
@@ -953,7 +1046,7 @@ class RubyDebugClient
|
|
953
1046
|
end
|
954
1047
|
ret
|
955
1048
|
elsif _obj.class == Hash
|
956
|
-
#
|
1049
|
+
#Arcadia.new_msg(self,"_obj Hash="+_obj.inspect)
|
957
1050
|
return 'Hash' if just_present
|
958
1051
|
ret = Hash.new
|
959
1052
|
ret['__CLASS__']= 'Hash'
|
@@ -966,7 +1059,7 @@ class RubyDebugClient
|
|
966
1059
|
end
|
967
1060
|
ret
|
968
1061
|
elsif _obj.class == Array
|
969
|
-
#
|
1062
|
+
#Arcadia.new_msg(self,"_obj Array="+_obj.inspect)
|
970
1063
|
return 'Array' if just_present
|
971
1064
|
ret = Hash.new
|
972
1065
|
ret['__CLASS__']= 'Array'
|
@@ -979,7 +1072,7 @@ class RubyDebugClient
|
|
979
1072
|
end
|
980
1073
|
ret
|
981
1074
|
elsif _obj.class == Struct
|
982
|
-
#
|
1075
|
+
#Arcadia.new_msg(self,"_obj Array="+_obj.inspect)
|
983
1076
|
return 'Struct' if just_present
|
984
1077
|
ret = Hash.new
|
985
1078
|
ret['__CLASS__']= 'Struct'
|
@@ -993,7 +1086,7 @@ class RubyDebugClient
|
|
993
1086
|
end
|
994
1087
|
ret
|
995
1088
|
else
|
996
|
-
#
|
1089
|
+
#Arcadia.new_msg(self,"_obj ="+_obj.inspect)
|
997
1090
|
|
998
1091
|
_obj
|
999
1092
|
end
|
@@ -1009,14 +1102,20 @@ class RubyDebugClient
|
|
1009
1102
|
@valuobjs.clear
|
1010
1103
|
end
|
1011
1104
|
begin
|
1012
|
-
|
1013
|
-
|
1014
|
-
|
1015
|
-
|
1016
|
-
|
1017
|
-
|
1105
|
+
_to_eval = read("eval YAML::dump(#{_exp})")
|
1106
|
+
if _to_eval.include?('Exception:')
|
1107
|
+
_to_eval = read("eval require 'pp';eval #{_exp}.pretty_inspect")
|
1108
|
+
var = eval(_to_eval)
|
1109
|
+
#var = "?"
|
1110
|
+
else
|
1111
|
+
_str = eval(_to_eval)
|
1112
|
+
_str.gsub!('!ruby/object:', '!')
|
1113
|
+
_obj = YAML::load(_str)
|
1114
|
+
var = yaml_pseudo_load(_obj)
|
1115
|
+
end
|
1018
1116
|
rescue Exception => e
|
1019
|
-
|
1117
|
+
Arcadia.new_msg(self,"exception on eval #{_exp} :#{e.inspect}")
|
1118
|
+
#Arcadia.new_msg(self,"exception on eval #{_exp} :#{e.inspect}")
|
1020
1119
|
var = nil
|
1021
1120
|
end
|
1022
1121
|
return var
|
@@ -1039,11 +1138,11 @@ class RubyDebugClient
|
|
1039
1138
|
# command("eval require 'pp'; #{var}.pretty_inspect() + '|||' + #{var}.class.to_s")
|
1040
1139
|
command("eval YAML::dump(#{var})")
|
1041
1140
|
_str = eval read
|
1042
|
-
#
|
1141
|
+
#Arcadia.new_msg(self,"value passato 1 ="+_str)
|
1043
1142
|
|
1044
1143
|
_str.gsub!('!ruby/object:', '!')
|
1045
1144
|
|
1046
|
-
#
|
1145
|
+
#Arcadia.new_msg(self,"value passato 2 ="+_str)
|
1047
1146
|
|
1048
1147
|
_obj = YAML::load(_str)
|
1049
1148
|
|
@@ -1055,10 +1154,10 @@ class RubyDebugClient
|
|
1055
1154
|
end
|
1056
1155
|
#_vvv = eval(_value)
|
1057
1156
|
|
1058
|
-
#
|
1157
|
+
#Arcadia.new_msg(self,"vvv class="+_vvv.class.to_s)
|
1059
1158
|
|
1060
|
-
#
|
1061
|
-
#
|
1159
|
+
#Arcadia.new_msg(self,"value="+_xvalue.inspect)
|
1160
|
+
#Arcadia.new_msg(self,"class="+_xclass)
|
1062
1161
|
variable_values[var] = Var.new(_xvalue, _xclass)
|
1063
1162
|
end
|
1064
1163
|
return variable_values
|
@@ -1069,13 +1168,13 @@ class RubyDebugClient
|
|
1069
1168
|
begin
|
1070
1169
|
#variables = read[1..-2].split(', ').collect!{|x| x[1..-2]}
|
1071
1170
|
to_eval = read("eval #{_type}")
|
1072
|
-
#
|
1171
|
+
#Arcadia.new_msg(self,"to_eval="+to_eval.to_s)
|
1073
1172
|
variables = eval(to_eval)
|
1074
|
-
#
|
1173
|
+
#Arcadia.new_msg(self,"variables="+variables.to_s)
|
1075
1174
|
rescue Exception => e
|
1076
1175
|
variables = []
|
1077
1176
|
#p "on command eval #{_type}:#{e.inspect}"
|
1078
|
-
#
|
1177
|
+
#Arcadia.new_debug_msg(self,"on command eval #{_type}:#{e.inspect}")
|
1079
1178
|
end
|
1080
1179
|
variables = [] if variables.nil?
|
1081
1180
|
variable_values = Hash.new
|
@@ -1150,30 +1249,67 @@ class RubyDebugClient
|
|
1150
1249
|
end
|
1151
1250
|
|
1152
1251
|
class RubyDebug < ArcadiaExt
|
1252
|
+
include Autils
|
1153
1253
|
attr_reader :rds
|
1154
1254
|
attr_reader :rdc
|
1155
|
-
def
|
1156
|
-
|
1157
|
-
|
1158
|
-
|
1255
|
+
def on_before_build(_event)
|
1256
|
+
if !full_in_path_command('rdebug').nil?
|
1257
|
+
#ArcadiaContractListener.new(self, EditorContract, :do_editor_event)
|
1258
|
+
Arcadia.add_listener(self, BufferEvent)
|
1259
|
+
@breakpoints = Hash.new
|
1260
|
+
@static_breakpoints = Array.new
|
1261
|
+
else
|
1262
|
+
Arcadia.new_error_msg(self, "Warning: Extension ae-ruby-debug depend upon rdebug command (install it or update system path!)")
|
1263
|
+
end
|
1159
1264
|
end
|
1160
|
-
|
1161
|
-
def
|
1162
|
-
|
1163
|
-
|
1164
|
-
|
1165
|
-
|
1166
|
-
|
1167
|
-
|
1168
|
-
|
1169
|
-
self.breakpoint_del(File.expand_path(_event.context.file), _event.context.line)
|
1170
|
-
when EditorContract::BUFFER_AFTER_RAISE
|
1171
|
-
@raised_file=_event.context.file
|
1172
|
-
when EditorContract::EVAL_EXPRESSION
|
1173
|
-
eval_expression(_event.context.text)
|
1265
|
+
|
1266
|
+
def on_build(_event)
|
1267
|
+
Arcadia.add_listener(self, DebugEvent)
|
1268
|
+
end
|
1269
|
+
|
1270
|
+
def on_buffer(_event)
|
1271
|
+
case _event
|
1272
|
+
when BufferRaisedEvent
|
1273
|
+
@raised_file=_event.file
|
1174
1274
|
end
|
1175
1275
|
end
|
1176
1276
|
|
1277
|
+
def on_debug(_event)
|
1278
|
+
case _event
|
1279
|
+
when StartDebugEvent
|
1280
|
+
_filename = _event.file
|
1281
|
+
_filename = @arcadia['pers']['run.file.last'] if _filename == "*LAST"
|
1282
|
+
debug(_filename)
|
1283
|
+
when StepDebugEvent
|
1284
|
+
if (_event.command == :quit_yes)
|
1285
|
+
@rds.quit_confirm_request = true
|
1286
|
+
end
|
1287
|
+
@rdc.send(_event.command) if @rdc.is_alive?
|
1288
|
+
when SetBreakpointEvent
|
1289
|
+
self.breakpoint_add(File.expand_path(_event.file), _event.row)
|
1290
|
+
when UnsetBreakpointEvent
|
1291
|
+
self.breakpoint_del(File.expand_path(_event.file), _event.row)
|
1292
|
+
when EvalExpressionEvent
|
1293
|
+
eval_expression(_event.expression)
|
1294
|
+
when StopDebugEvent
|
1295
|
+
self.debug_quit
|
1296
|
+
end
|
1297
|
+
end
|
1298
|
+
|
1299
|
+
|
1300
|
+
# def do_editor_event(_event)
|
1301
|
+
# case _event.signature
|
1302
|
+
# when EditorContract::BREAKPOINT_AFTER_CREATE
|
1303
|
+
# self.breakpoint_add(File.expand_path(_event.context.file), _event.context.line)
|
1304
|
+
# when EditorContract::BREAKPOINT_AFTER_DELETE
|
1305
|
+
# self.breakpoint_del(File.expand_path(_event.context.file), _event.context.line)
|
1306
|
+
# when EditorContract::BUFFER_AFTER_RAISE
|
1307
|
+
# @raised_file=_event.context.file
|
1308
|
+
# when EditorContract::EVAL_EXPRESSION
|
1309
|
+
# eval_expression(_event.context.text)
|
1310
|
+
# end
|
1311
|
+
# end
|
1312
|
+
|
1177
1313
|
def eval_expression(_exp)
|
1178
1314
|
res = @rdc.debug_eval(_exp) if @rdc && @rdc.is_debugging_ready?
|
1179
1315
|
hash = Hash.new
|
@@ -1200,14 +1336,14 @@ class RubyDebug < ArcadiaExt
|
|
1200
1336
|
end
|
1201
1337
|
|
1202
1338
|
def breakpoint_add_live(_file,_line)
|
1203
|
-
if @rdc
|
1339
|
+
if @rdc && @rdc.is_alive?
|
1204
1340
|
@breakpoints[breakpoint_suf(_file,_line)] = @rdc.set_breakpoint(_file, _line.to_i)
|
1205
1341
|
@rdv.break_list_add(_file,_line) if @rdv
|
1206
1342
|
end
|
1207
1343
|
end
|
1208
1344
|
|
1209
1345
|
def breakpoint_del_live(_file,_line)
|
1210
|
-
if @rdc
|
1346
|
+
if @rdc && @rdc.is_alive?
|
1211
1347
|
@rdc.unset_breakpoint(@breakpoints.delete(breakpoint_suf(_file,_line)))
|
1212
1348
|
@rdv.break_list_del(_file,_line) if @rdv
|
1213
1349
|
end
|
@@ -1247,55 +1383,55 @@ class RubyDebug < ArcadiaExt
|
|
1247
1383
|
end
|
1248
1384
|
end
|
1249
1385
|
|
1250
|
-
|
1251
|
-
|
1252
|
-
def debug_begin
|
1253
|
-
breakpoint_free_live
|
1254
|
-
DebugContract.instance.debug_begin(self)
|
1255
|
-
end
|
1256
|
-
|
1257
1386
|
def debug_last
|
1258
|
-
|
1387
|
+
Arcadia.process_event(StartDebugEvent.new(self, 'file'=>$arcadia['pers']['run.file.last']))
|
1388
|
+
#debug($arcadia['pers']['run.file.last'])
|
1259
1389
|
end
|
1260
1390
|
|
1261
1391
|
def debug_current
|
1262
|
-
|
1392
|
+
Arcadia.process_event(StartDebugEvent.new(self, 'file'=>@raised_file)) if @raised_file!=nil
|
1393
|
+
#debug(@raised_file) if @raised_file!=nil
|
1263
1394
|
end
|
1264
1395
|
def debugging?
|
1265
1396
|
!@rdc.nil? && @rdc.is_alive?
|
1266
1397
|
end
|
1398
|
+
|
1399
|
+
def debug_begin
|
1400
|
+
breakpoint_free_live
|
1401
|
+
#DebugContract.instance.debug_begin(self)
|
1402
|
+
end
|
1403
|
+
|
1267
1404
|
def debug(_filename=nil)
|
1268
1405
|
if _filename && !debugging?
|
1269
1406
|
begin
|
1270
1407
|
self.debug_begin
|
1271
1408
|
@arcadia['pers']['run.file.last']=_filename
|
1272
|
-
@rds = RubyDebugServer.new(self) if @rds.nil?
|
1409
|
+
@rds = RubyDebugServer.new(self,@arcadia) if @rds.nil?
|
1273
1410
|
@rds.start_session(_filename, conf('server.host'), conf('server.port'))
|
1274
|
-
#
|
1411
|
+
#Arcadia.new_msg(self,@rds.to_s)
|
1275
1412
|
@rdc = RubyDebugClient.new(conf('server.host'), conf('server.port'), conf('server.timeout')) if @rdc.nil?
|
1276
1413
|
@rdv = RubyDebugView.new(self.frame, self) if @rdv.nil?
|
1277
1414
|
@rdv.start_process(_filename)
|
1278
1415
|
if @rdc.start_session
|
1279
1416
|
@static_breakpoints.each{|_b|
|
1280
|
-
#
|
1417
|
+
#Arcadia.new_msg(self," breakpoint_add #{_b[:file]}:#{_b[:line]}")
|
1281
1418
|
breakpoint_add_live(_b[:file], _b[:line])
|
1282
1419
|
}
|
1283
1420
|
end
|
1284
|
-
#
|
1421
|
+
#Arcadia.new_msg(self,"\n<begin debug>")
|
1285
1422
|
|
1286
1423
|
rescue Exception => e
|
1287
|
-
|
1424
|
+
Arcadia.new_debug_msg(self,"---> "+e.to_s)
|
1288
1425
|
end
|
1289
1426
|
end
|
1290
1427
|
end
|
1291
1428
|
|
1292
|
-
|
1293
1429
|
def rdebug_server_update(_state)
|
1294
1430
|
case _state
|
1295
|
-
when RubyDebugServer::
|
1296
|
-
|
1431
|
+
when RubyDebugServer::RDS_QUIET
|
1432
|
+
#debug_free
|
1297
1433
|
end
|
1298
|
-
p _state
|
1434
|
+
#p _state
|
1299
1435
|
end
|
1300
1436
|
|
1301
1437
|
def debug_free
|
@@ -1317,7 +1453,7 @@ class RubyDebug < ArcadiaExt
|
|
1317
1453
|
begin
|
1318
1454
|
debug_free
|
1319
1455
|
rescue Exception => e
|
1320
|
-
|
1456
|
+
Arcadia.new_debug_msg(self, "debug_quit:---> "+e.to_s)
|
1321
1457
|
#@arcadia['shell'].outln("debug_quit:---> "+e.to_s )
|
1322
1458
|
end
|
1323
1459
|
end
|