rudebug 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/COPYING CHANGED
@@ -1,56 +1,56 @@
1
- rudebug is copyrighted free software by Florian Gross <flgr@ccan.de>.
2
- You can redistribute it and/or modify it under either the terms of the GPL
3
- (see http://www.gnu.org/licenses/gpl.html), or the conditions below:
4
-
5
- 1. You may make and give away verbatim copies of the source form of the
6
- software without restriction, provided that you duplicate all of the
7
- original copyright notices and associated disclaimers.
8
-
9
- 2. You may modify your copy of the software in any way, provided that
10
- you do at least ONE of the following:
11
-
12
- a) place your modifications in the Public Domain or otherwise
13
- make them Freely Available, such as by posting said
14
- modifications to Usenet or an equivalent medium, or by allowing
15
- the author to include your modifications in the software.
16
-
17
- b) use the modified software only within your corporation or
18
- organization.
19
-
20
- c) give non-standard binaries non-standard names, with
21
- instructions on where to get the original software distribution.
22
-
23
- d) make other distribution arrangements with the author.
24
-
25
- 3. You may distribute the software in object code or binary form,
26
- provided that you do at least ONE of the following:
27
-
28
- a) distribute the binaries and library files of the software,
29
- together with instructions (in the manual page or equivalent)
30
- on where to get the original distribution.
31
-
32
- b) accompany the distribution with the machine-readable source of
33
- the software.
34
-
35
- c) give non-standard binaries non-standard names, with
36
- instructions on where to get the original software distribution.
37
-
38
- d) make other distribution arrangements with the author.
39
-
40
- 4. You may modify and include the part of the software into any other
41
- software (possibly commercial). But some files in the distribution
42
- are not written by the author, so that they are not under these terms.
43
-
44
- For the list of those files and their copying conditions, see the
45
- file LEGAL.
46
-
47
- 5. The scripts and library files supplied as input to or produced as
48
- output from the software do not automatically fall under the
49
- copyright of the software, but belong to whomever generated them,
50
- and may be sold commercially, and may be aggregated with this
51
- software.
52
-
53
- 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
54
- IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
55
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
56
- PURPOSE.
1
+ rudebug is copyrighted free software by Florian Gross <flgr@ccan.de>.
2
+ You can redistribute it and/or modify it under either the terms of the GPL
3
+ (see http://www.gnu.org/licenses/gpl.html), or the conditions below:
4
+
5
+ 1. You may make and give away verbatim copies of the source form of the
6
+ software without restriction, provided that you duplicate all of the
7
+ original copyright notices and associated disclaimers.
8
+
9
+ 2. You may modify your copy of the software in any way, provided that
10
+ you do at least ONE of the following:
11
+
12
+ a) place your modifications in the Public Domain or otherwise
13
+ make them Freely Available, such as by posting said
14
+ modifications to Usenet or an equivalent medium, or by allowing
15
+ the author to include your modifications in the software.
16
+
17
+ b) use the modified software only within your corporation or
18
+ organization.
19
+
20
+ c) give non-standard binaries non-standard names, with
21
+ instructions on where to get the original software distribution.
22
+
23
+ d) make other distribution arrangements with the author.
24
+
25
+ 3. You may distribute the software in object code or binary form,
26
+ provided that you do at least ONE of the following:
27
+
28
+ a) distribute the binaries and library files of the software,
29
+ together with instructions (in the manual page or equivalent)
30
+ on where to get the original distribution.
31
+
32
+ b) accompany the distribution with the machine-readable source of
33
+ the software.
34
+
35
+ c) give non-standard binaries non-standard names, with
36
+ instructions on where to get the original software distribution.
37
+
38
+ d) make other distribution arrangements with the author.
39
+
40
+ 4. You may modify and include the part of the software into any other
41
+ software (possibly commercial). But some files in the distribution
42
+ are not written by the author, so that they are not under these terms.
43
+
44
+ For the list of those files and their copying conditions, see the
45
+ file LEGAL.
46
+
47
+ 5. The scripts and library files supplied as input to or produced as
48
+ output from the software do not automatically fall under the
49
+ copyright of the software, but belong to whomever generated them,
50
+ and may be sold commercially, and may be aggregated with this
51
+ software.
52
+
53
+ 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
54
+ IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
55
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
56
+ PURPOSE.
data/NEWS CHANGED
@@ -1,6 +1,10 @@
1
- = NEWS
2
-
3
- This file sums up important changes that happened between releases.
4
-
5
- == rudebug 0.3.0
6
- * Initial release
1
+ = NEWS
2
+
3
+ This file sums up important changes that happened between releases.
4
+
5
+ == rudebug 0.3.1
6
+ * Fixed a bug where rudebug wouldn't work with ruby-gtk2-0.14.1-1 because of a
7
+ fix from gtk-patch.rb
8
+
9
+ == rudebug 0.3.0
10
+ * Initial release
data/README CHANGED
@@ -1,31 +1,31 @@
1
- = README for rudebug -- A graphical debugger for Ruby
2
-
3
- rudebug is written using Ruby-GNOME2 and Glade. It has support for local and remote debugging with ruby-debug and ruby-breakpoint. It should work fine on Windows and Linux.
4
-
5
- It has stepping stepping, a source code display, a powerful object browser and an interactive shell as well as additional integration and polish to make those components work together well.
6
-
7
- It is in an early stage and will likely remain so until I have a way of using it on Mac OS X. I don't want this to molder on my hard disk however without ever having seen a public release.
8
-
9
- With ~900 lines of actual code (excluding the glade file) it is fairly light-weight. Code quality fluctuates. Some of the code needs to be unusual because it is executed on the server and can't touch its environment, other bits could probably need some refactoring.
10
-
11
- It was developed as part of a Summer of Code 2006 project for RubyCentral Inc.
12
-
13
-
14
- * Dependencies: Ruby-GNOME2, rsyntax*, ruby-debug* (* = automatically installed by RubyGems)
15
- * Dual-licensed under GPL and Ruby's license.
16
- * Homepage: http://code.google.com/p/rudebug/
17
- * Author: Florian Gross <flgr@ccan.de>
18
-
19
- See the NEWS file for the changes that were done in this release.
20
-
21
-
22
- == Installation
23
-
24
- De-compress archive and enter its top directory. Then type:
25
-
26
- ($ su)
27
- # ruby setup.rb
28
-
29
- This simple step installs this program under the default location of Ruby
30
- libraries. You can also install files into your favorite directory by supplying
31
- setup.rb with some options. Try "ruby setup.rb --help".
1
+ = README for rudebug -- A graphical debugger for Ruby
2
+
3
+ rudebug is written using Ruby-GNOME2 and Glade. It has support for local and remote debugging with ruby-debug and ruby-breakpoint. It should work fine on Windows and Linux.
4
+
5
+ It has stepping stepping, a source code display, a powerful object browser and an interactive shell as well as additional integration and polish to make those components work together well.
6
+
7
+ It is in an early stage and will likely remain so until I have a way of using it on Mac OS X. I don't want this to molder on my hard disk however without ever having seen a public release.
8
+
9
+ With ~900 lines of actual code (excluding the glade file) it is fairly light-weight. Code quality fluctuates. Some of the code needs to be unusual because it is executed on the server and can't touch its environment, other bits could probably need some refactoring.
10
+
11
+ It was developed as part of a Summer of Code 2006 project for RubyCentral Inc.
12
+
13
+
14
+ * Dependencies: Ruby-GNOME2, rsyntax*, ruby-debug* (* = automatically installed by RubyGems)
15
+ * Dual-licensed under GPL and Ruby's license.
16
+ * Homepage: http://code.google.com/p/rudebug/
17
+ * Author: Florian Gross <flgr@ccan.de>
18
+
19
+ See the NEWS file for the changes that were done in this release.
20
+
21
+
22
+ == Installation
23
+
24
+ De-compress archive and enter its top directory. Then type:
25
+
26
+ ($ su)
27
+ # ruby setup.rb
28
+
29
+ This simple step installs this program under the default location of Ruby
30
+ libraries. You can also install files into your favorite directory by supplying
31
+ setup.rb with some options. Try "ruby setup.rb --help".
data/bin/rudebug CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env ruby
2
-
3
- $LOAD_PATH.unshift("../lib")
4
- require 'rudebug'
1
+ #!/usr/bin/env ruby
2
+
3
+ $LOAD_PATH.unshift("../lib")
4
+ require 'rudebug'
@@ -1,203 +1,203 @@
1
- require 'rudebug/connection'
2
-
3
- class RuDebug
4
- attr_reader :pages
5
-
6
- def initialize_connect()
7
- @connect_dlg = @glade["connect-dialog"]
8
- @connectdlg_entry = @glade["connectdlg-server-entry"]
9
- @connectdlg_type = @glade["connectdlg-type-combobox"]
10
- @connectdlg_btn = @glade["connectdlg-button"]
11
-
12
- load_connect_servers()
13
-
14
- @connect_btn = @glade["connect-button"]
15
- @disconnect_btn = @glade["disconnect-button"]
16
- @continue_btn = @glade["continue-button"]
17
- @step_into_btn = @glade["step-into-button"]
18
- @step_over_btn = @glade["step-over-button"]
19
-
20
- @connect_menuitem = @glade["connect-menuitem"]
21
- @disconnect_menuitem = @glade["disconnect-menuitem"]
22
-
23
- @connection_status = @glade["status-label"]
24
- @connect_dlg.transient_for = @window
25
-
26
- @connect_page = @notebook.get_nth_page(0)
27
- @not_connected = @connection_status.text
28
- @connection = nil
29
- end
30
-
31
- def load_connect_servers()
32
- default_servers = [
33
- "localhost:8989",
34
- "druby://localhost:42531"
35
- ]
36
-
37
- conf_servers = @config[:servers].to_ary rescue []
38
- servers = (conf_servers + default_servers).uniq
39
-
40
- servers.each do |server|
41
- @connectdlg_entry.append_text(server)
42
- end
43
-
44
- @connectdlg_entry.active = 0
45
- end
46
-
47
- def save_connect_servers()
48
- servers = []
49
- @connectdlg_entry.model.each do |model, path, iter|
50
- servers << iter[0]
51
- end
52
-
53
- @config[:servers] = servers
54
- end
55
-
56
- def on_connect_button_clicked()
57
- @connect_dlg.show
58
- @connectdlg_btn.grab_focus
59
- end
60
- alias :on_connect_activate :on_connect_button_clicked
61
-
62
- def on_disconnect_button_clicked()
63
- disconnect()
64
- end
65
- alias :on_disconnect_activate :on_disconnect_button_clicked
66
-
67
- def on_connect_dialog_delete_event(dialog, event)
68
- dialog.hide_on_delete
69
- end
70
-
71
- def on_connectdlg_server_entry_changed()
72
- text = @connectdlg_entry.active_text
73
- @connectdlg_type.active = text[/druby/i] ? 0 : 1
74
- @connectdlg_btn.sensitive = text.size > 0
75
- end
76
-
77
- def on_connectdlg_server_entry_key_press_event(server_entry, event)
78
- case event.keyval
79
- when Gdk::Keyval::GDK_Return then
80
- on_connectdlg_button_clicked()
81
- else
82
- return false
83
- end
84
-
85
- return true
86
- end
87
-
88
- def on_connectdlg_button_clicked()
89
- text = @connectdlg_entry.active_text
90
- @connect_dlg.hide
91
-
92
- type_text = @connectdlg_type.active_text
93
-
94
- con_type = case type_text
95
- when "ruby-breakpoint" then Connection::Breakpoint
96
- when "ruby-debug" then Connection::RubyDebug
97
- end
98
-
99
- unless text[/:\d/]
100
- text += ":%d" % case type_text
101
- when "ruby-breakpoint" then "wtf".to_i(36) # >:)
102
- when "ruby-debug" then 8989
103
- end
104
- end
105
-
106
- connect_to(text, con_type)
107
- end
108
-
109
- def connect_to(server, con_type)
110
- @connection_status.text = @connect_text = "Connecting to %s..." % server
111
-
112
- @connect_thread = Thread.new do
113
- begin
114
- @connection = con_type.new
115
- @connection.on_session = method(:on_session)
116
- @connection.on_disconnect = method(:on_disconnect)
117
- @connection.connect(server)
118
- rescue Exception => error
119
- on_failure(error)
120
- sleep 2
121
- retry
122
- end
123
- end
124
-
125
- update_connect_buttons()
126
- end
127
-
128
- def update_connect_buttons()
129
- @connect_btn.sensitive = @connect_menuitem.sensitive = !@connection
130
- @disconnect_btn.sensitive = @disconnect_menuitem.sensitive = @connection
131
- end
132
-
133
- def update_session_buttons()
134
- has_page = current_page()
135
- @continue_btn.sensitive = has_page
136
-
137
- stepping = @connection.stepping_support?() if @connection
138
- @step_into_btn.sensitive = @step_over_btn.sensitive = stepping && has_page
139
- end
140
-
141
- def disconnect()
142
- connection = @connection
143
- on_disconnect()
144
-
145
- Thread.new do
146
- connection.disconnect unless connection.nil?
147
-
148
- unless @connect_thread.nil?
149
- @connect_thread.kill
150
- @connect_thread = nil
151
- end
152
- end
153
- end
154
-
155
- def current_page()
156
- active_page = @notebook.get_nth_page(@notebook.page)
157
- title = @notebook.get_tab_label_text(active_page)
158
- @pages[title]
159
- end
160
-
161
- def on_session(session)
162
- @notebook.remove_page(0) # Remove connect page
163
- @notebook.show_tabs = true
164
- @pages[session.title] = Page.new(self, session)
165
- update_session_buttons()
166
- end
167
-
168
- def on_disconnect()
169
- @connection = nil
170
- update_connect_buttons()
171
- update_session_buttons()
172
-
173
- @notebook.show_tabs = false
174
- # Remove pages (session and connection)
175
- # TODO: Only remove connection
176
- @notebook.remove_page(0) until @notebook.n_pages == 0
177
-
178
- @connection_status.text = @not_connected
179
- @notebook.append_page(@connect_page)
180
- end
181
-
182
- def on_failure(error)
183
- puts error, error.backtrace
184
-
185
- @connection_status.text = [
186
- @connect_text,
187
- "Failed: %s" % error,
188
- "Will reconnect..."
189
- ].join("\n\n")
190
- end
191
-
192
- def on_continue_button_clicked(btn)
193
- btn.sensitive = false if current_page().continue().nil?
194
- end
195
-
196
- def on_step_into_button_clicked(btn)
197
- btn.sensitive = false if current_page().step_into().nil?
198
- end
199
-
200
- def on_step_over_button_clicked(btn)
201
- btn.sensitive = false if current_page().step_over().nil?
202
- end
203
- end
1
+ require 'rudebug/connection'
2
+
3
+ class RuDebug
4
+ attr_reader :pages
5
+
6
+ def initialize_connect()
7
+ @connect_dlg = @glade["connect-dialog"]
8
+ @connectdlg_entry = @glade["connectdlg-server-entry"]
9
+ @connectdlg_type = @glade["connectdlg-type-combobox"]
10
+ @connectdlg_btn = @glade["connectdlg-button"]
11
+
12
+ load_connect_servers()
13
+
14
+ @connect_btn = @glade["connect-button"]
15
+ @disconnect_btn = @glade["disconnect-button"]
16
+ @continue_btn = @glade["continue-button"]
17
+ @step_into_btn = @glade["step-into-button"]
18
+ @step_over_btn = @glade["step-over-button"]
19
+
20
+ @connect_menuitem = @glade["connect-menuitem"]
21
+ @disconnect_menuitem = @glade["disconnect-menuitem"]
22
+
23
+ @connection_status = @glade["status-label"]
24
+ @connect_dlg.transient_for = @window
25
+
26
+ @connect_page = @notebook.get_nth_page(0)
27
+ @not_connected = @connection_status.text
28
+ @connection = nil
29
+ end
30
+
31
+ def load_connect_servers()
32
+ default_servers = [
33
+ "localhost:8989",
34
+ "druby://localhost:42531"
35
+ ]
36
+
37
+ conf_servers = @config[:servers].to_ary rescue []
38
+ servers = (conf_servers + default_servers).uniq
39
+
40
+ servers.each do |server|
41
+ @connectdlg_entry.append_text(server)
42
+ end
43
+
44
+ @connectdlg_entry.active = 0
45
+ end
46
+
47
+ def save_connect_servers()
48
+ servers = []
49
+ @connectdlg_entry.model.each do |model, path, iter|
50
+ servers << iter[0]
51
+ end
52
+
53
+ @config[:servers] = servers
54
+ end
55
+
56
+ def on_connect_button_clicked()
57
+ @connect_dlg.show
58
+ @connectdlg_btn.grab_focus
59
+ end
60
+ alias :on_connect_activate :on_connect_button_clicked
61
+
62
+ def on_disconnect_button_clicked()
63
+ disconnect()
64
+ end
65
+ alias :on_disconnect_activate :on_disconnect_button_clicked
66
+
67
+ def on_connect_dialog_delete_event(dialog, event)
68
+ dialog.hide_on_delete
69
+ end
70
+
71
+ def on_connectdlg_server_entry_changed()
72
+ text = @connectdlg_entry.active_text
73
+ @connectdlg_type.active = text[/druby/i] ? 0 : 1
74
+ @connectdlg_btn.sensitive = text.size > 0
75
+ end
76
+
77
+ def on_connectdlg_server_entry_key_press_event(server_entry, event)
78
+ case event.keyval
79
+ when Gdk::Keyval::GDK_Return then
80
+ on_connectdlg_button_clicked()
81
+ else
82
+ return false
83
+ end
84
+
85
+ return true
86
+ end
87
+
88
+ def on_connectdlg_button_clicked()
89
+ text = @connectdlg_entry.active_text
90
+ @connect_dlg.hide
91
+
92
+ type_text = @connectdlg_type.active_text
93
+
94
+ con_type = case type_text
95
+ when "ruby-breakpoint" then Connection::Breakpoint
96
+ when "ruby-debug" then Connection::RubyDebug
97
+ end
98
+
99
+ unless text[/:\d/]
100
+ text += ":%d" % case type_text
101
+ when "ruby-breakpoint" then "wtf".to_i(36) # >:)
102
+ when "ruby-debug" then 8989
103
+ end
104
+ end
105
+
106
+ connect_to(text, con_type)
107
+ end
108
+
109
+ def connect_to(server, con_type)
110
+ @connection_status.text = @connect_text = "Connecting to %s..." % server
111
+
112
+ @connect_thread = Thread.new do
113
+ begin
114
+ @connection = con_type.new
115
+ @connection.on_session = method(:on_session)
116
+ @connection.on_disconnect = method(:on_disconnect)
117
+ @connection.connect(server)
118
+ rescue Exception => error
119
+ on_failure(error)
120
+ sleep 2
121
+ retry
122
+ end
123
+ end
124
+
125
+ update_connect_buttons()
126
+ end
127
+
128
+ def update_connect_buttons()
129
+ @connect_btn.sensitive = @connect_menuitem.sensitive = !@connection
130
+ @disconnect_btn.sensitive = @disconnect_menuitem.sensitive = @connection
131
+ end
132
+
133
+ def update_session_buttons()
134
+ has_page = current_page()
135
+ @continue_btn.sensitive = has_page
136
+
137
+ stepping = @connection.stepping_support?() if @connection
138
+ @step_into_btn.sensitive = @step_over_btn.sensitive = stepping && has_page
139
+ end
140
+
141
+ def disconnect()
142
+ connection = @connection
143
+ on_disconnect()
144
+
145
+ Thread.new do
146
+ connection.disconnect unless connection.nil?
147
+
148
+ unless @connect_thread.nil?
149
+ @connect_thread.kill
150
+ @connect_thread = nil
151
+ end
152
+ end
153
+ end
154
+
155
+ def current_page()
156
+ active_page = @notebook.get_nth_page(@notebook.page)
157
+ title = @notebook.get_tab_label_text(active_page)
158
+ @pages[title]
159
+ end
160
+
161
+ def on_session(session)
162
+ @notebook.remove_page(0) # Remove connect page
163
+ @notebook.show_tabs = true
164
+ @pages[session.title] = Page.new(self, session)
165
+ update_session_buttons()
166
+ end
167
+
168
+ def on_disconnect()
169
+ @connection = nil
170
+ update_connect_buttons()
171
+ update_session_buttons()
172
+
173
+ @notebook.show_tabs = false
174
+ # Remove pages (session and connection)
175
+ # TODO: Only remove connection
176
+ @notebook.remove_page(0) until @notebook.n_pages == 0
177
+
178
+ @connection_status.text = @not_connected
179
+ @notebook.append_page(@connect_page)
180
+ end
181
+
182
+ def on_failure(error)
183
+ puts error, error.backtrace
184
+
185
+ @connection_status.text = [
186
+ @connect_text,
187
+ "Failed: %s" % error,
188
+ "Will reconnect..."
189
+ ].join("\n\n")
190
+ end
191
+
192
+ def on_continue_button_clicked(btn)
193
+ btn.sensitive = false if current_page().continue().nil?
194
+ end
195
+
196
+ def on_step_into_button_clicked(btn)
197
+ btn.sensitive = false if current_page().step_into().nil?
198
+ end
199
+
200
+ def on_step_over_button_clicked(btn)
201
+ btn.sensitive = false if current_page().step_over().nil?
202
+ end
203
+ end