public
Description: Rubinius, the Ruby VM
Homepage: http://rubini.us
Clone URL: git://github.com/evanphx/rubinius.git
Add basic Debugger::Server class for remote debugging

First pass at implementing remote debugging support. Includes
a debug server, a very basic remote client, and support for
running shotgun in remote debug mode (via -remote-debug
switch).
agardiner (author)
Mon Apr 14 21:04:04 -0700 2008
commit  0ffd16ca967f788607b5ea2b14fdca618374d620
tree    66fbdc509512df108dcac53c6817e69cde192fbf
parent  19dc390520a5064f731eda0bc378fd1338198546
...
98
99
100
 
101
102
103
...
149
150
151
 
 
 
 
 
 
 
 
 
152
153
154
...
98
99
100
101
102
103
104
...
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
0
@@ -98,6 +98,7 @@ Options:
0
   -dc Display debugging information for the compiler.
0
   -dl Display debugging information for the loader.
0
   -debug Launch the debugger.
0
+ -remote-debug Run the program under the control of a remote debugger.
0
   -e 'code' Directly compile and execute code (no file provided).
0
   -Idir1[:dir2] Add directories to $LOAD_PATH.
0
   -p Run the profiler.
0
@@ -149,6 +150,15 @@ begin
0
     when '-debug'
0
       require 'debugger/debugger'
0
       $DEBUGGER = true
0
+ when '-remote-debug'
0
+ require 'debugger/debug_server'
0
+ $DEBUGGER = true
0
+ if port = (ARGV.first =~ /^\d+$/ and ARGV.shift)
0
+ $DEBUG_SERVER = Debugger::Server.new(port.to_i)
0
+ else
0
+ $DEBUG_SERVER = Debugger::Server.new
0
+ end
0
+ $DEBUG_SERVER.listen
0
     when '-p'
0
       require 'profile'
0
     when '-ps'
...
38
39
40
41
42
43
44
...
162
163
164
 
 
 
 
 
165
166
167
...
170
171
172
 
 
173
174
175
...
179
180
181
182
183
 
184
185
186
...
38
39
40
 
41
42
43
...
161
162
163
164
165
166
167
168
169
170
171
...
174
175
176
177
178
179
180
181
...
185
186
187
 
 
188
189
190
191
0
@@ -38,7 +38,6 @@ class Debugger
0
     @breakpoint_tracker = BreakpointTracker.new do |thread, ctxt, bp|
0
       activate_debugger thread, ctxt, bp
0
     end
0
- @interface = CmdLineInterface.new
0
 
0
     # Register this debugger as the default debug channel listener
0
     Rubinius::VM.debug_channel = @breakpoint_tracker.debug_channel
0
@@ -162,6 +161,11 @@ class Debugger
0
     @commands
0
   end
0
 
0
+ # Sets the interface to be used for the debugger
0
+ def interface=(interface)
0
+ @interface = interface
0
+ end
0
+
0
   # Activates the debugger after a breakpoint has been hit, and responds to
0
   # debgging commands until a continue command is recevied.
0
   def activate_debugger(thread, ctxt, bp_list)
0
@@ -170,6 +174,8 @@ class Debugger
0
 
0
     # Load debugger commands if we haven't already
0
     load_commands unless @commands
0
+ # Default to command-line interface if none configured
0
+ self.interface = CmdLineInterface.new unless @interface
0
 
0
     @interface.process_commands(self, thread, ctxt, bp_list)
0
 
0
@@ -179,8 +185,7 @@ class Debugger
0
     @eval_context = nil
0
   end
0
 
0
- attr_reader :interface
0
- attr_reader :commands
0
+ # The current thread and context being debugged
0
   attr_reader :debug_thread, :debug_context
0
   # The current eval context, i.e. the context in which most commands will be
0
   # executed. By default, this is the same as the debug context, but it can be

Comments

    No one has commented yet.