DebugClients/Ruby/DebugClientBaseModule.rb

changeset 2438
61bfcff921d8
parent 2302
f29e9405c851
child 3160
209a07d7e401
equal deleted inserted replaced
2436:f75dbdd22959 2438:61bfcff921d8
4 # 4 #
5 5
6 =begin edoc 6 =begin edoc
7 File implementing a debug client base module. 7 File implementing a debug client base module.
8 =end 8 =end
9
10 if RUBY_VERSION < "1.9"
11 $KCODE = 'UTF8'
12 require 'jcode'
13 end
14 9
15 require 'socket' 10 require 'socket'
16 11
17 require 'DebugQuit' 12 require 'DebugQuit'
18 require 'DebugProtocol' 13 require 'DebugProtocol'
197 @param line the received line 192 @param line the received line
198 =end 193 =end
199 194
200 # Remove any newline 195 # Remove any newline
201 if line[-1] == "\n" 196 if line[-1] == "\n"
202 line = line[1...-1] 197 line = line[0...-1]
203 end 198 end
204 199
205 ## STDOUT << line << "\n" ## debug 200 ## STDOUT << line << "\n" ## debug
206 201
207 eoc = line.index("<") 202 eoc = line.index("<")
208 203
209 if eoc and eoc >= 0 and line[0,1] == ">" 204 if eoc and eoc >= 0 and line[0,1] == ">"
210 # Get the command part and any argument 205 # Get the command part and any argument
211 cmd = line[0..eoc] 206 cmd = line[0..eoc]
212 arg = line[eoc+1...-1] 207 arg = line[eoc+1..-1]
213 208
214 case cmd 209 case cmd
215 when RequestOK 210 when RequestOK
216 write(@pendingResponse + "\n") 211 write(@pendingResponse + "\n")
217 @pendingResponse = ResponseOK 212 @pendingResponse = ResponseOK
302 else 297 else
303 Dir.chdir(wd) 298 Dir.chdir(wd)
304 end 299 end
305 @running = fn 300 @running = fn
306 command = "$0 = '%s'; require '%s'" % [fn, fn] 301 command = "$0 = '%s'; require '%s'" % [fn, fn]
302 RubyVM::InstructionSequence.compile_option = {
303 trace_instruction: true
304 }
307 set_trace_func proc { |event, file, line, id, binding_, klass, *rest| 305 set_trace_func proc { |event, file, line, id, binding_, klass, *rest|
308 DEBUGGER__.context.trace_func(event, file, line, id, binding_, klass) 306 DEBUGGER__.context.trace_func(event, file, line, id, binding_, klass)
309 } 307 }
310 begin 308 begin
311 eval(command, @debugBinding) 309 eval(command, @debugBinding)

eric ide

mercurial