Class: RubyDebug
- Inherits:
-
ArcadiaExt
- Object
- ArcadiaExt
- RubyDebug
- Includes:
- Autils
- Defined in:
- ext/ae-ruby-debug/ae-ruby-debug.rb
Instance Attribute Summary collapse
-
#rdc ⇒ Object
readonly
Returns the value of attribute rdc.
-
#rds ⇒ Object
readonly
Returns the value of attribute rds.
Instance Method Summary collapse
- #break_name(_file, _line) ⇒ Object
- #breakpoint_add(_file, _line) ⇒ Object
- #breakpoint_add_live(_file, _line) ⇒ Object
-
#breakpoint_del(_file, _line) ⇒ Object
private :breakpoint_add.
- #breakpoint_del_live(_file, _line) ⇒ Object
- #breakpoint_free_live ⇒ Object
- #can_exit_query ⇒ Object
- #debug(_filename = nil) ⇒ Object
- #debug_begin ⇒ Object
- #debug_current ⇒ Object
- #debug_free ⇒ Object
- #debug_last ⇒ Object
- #debug_quit ⇒ Object
-
#debugging? ⇒ Boolean
debug(@raised_file) if @raised_file!=nil.
-
#eval_expression(_exp) ⇒ Object
def do_editor_event(_event) case _event.signature when EditorContract::BREAKPOINT_AFTER_CREATE self.breakpoint_add(File.expand_path(_event.context.file), _event.context.line) when EditorContract::BREAKPOINT_AFTER_DELETE self.breakpoint_del(File.expand_path(_event.context.file), _event.context.line) when EditorContract::BUFFER_AFTER_RAISE @raised_file=_event.context.file when EditorContract::EVAL_EXPRESSION eval_expression(_event.context.text) end end.
- #on_before_build(_event) ⇒ Object
- #on_buffer(_event) ⇒ Object
- #on_build(_event) ⇒ Object
- #on_debug(_event) ⇒ Object
- #rdebug_server_update(_state) ⇒ Object
Instance Attribute Details
#rdc ⇒ Object (readonly)
Returns the value of attribute rdc.
1254 1255 1256 |
# File 'ext/ae-ruby-debug/ae-ruby-debug.rb', line 1254 def rdc @rdc end |
#rds ⇒ Object (readonly)
Returns the value of attribute rds.
1253 1254 1255 |
# File 'ext/ae-ruby-debug/ae-ruby-debug.rb', line 1253 def rds @rds end |
Instance Method Details
#break_name(_file, _line) ⇒ Object
1334 1335 1336 |
# File 'ext/ae-ruby-debug/ae-ruby-debug.rb', line 1334 def break_name(_file,_line) "#{_file}:#{_line}" end |
#breakpoint_add(_file, _line) ⇒ Object
1357 1358 1359 1360 |
# File 'ext/ae-ruby-debug/ae-ruby-debug.rb', line 1357 def breakpoint_add(_file,_line) breakpoint_add_live(_file,_line) @static_breakpoints << {:file=>_file,:line=>_line} end |
#breakpoint_add_live(_file, _line) ⇒ Object
1338 1339 1340 1341 1342 1343 |
# File 'ext/ae-ruby-debug/ae-ruby-debug.rb', line 1338 def breakpoint_add_live(_file,_line) if @rdc && @rdc.is_alive? @breakpoints[breakpoint_suf(_file,_line)] = @rdc.set_breakpoint(_file, _line.to_i) @rdv.break_list_add(_file,_line) if @rdv end end |
#breakpoint_del(_file, _line) ⇒ Object
private :breakpoint_add
1363 1364 1365 1366 |
# File 'ext/ae-ruby-debug/ae-ruby-debug.rb', line 1363 def breakpoint_del(_file,_line) breakpoint_del_live(_file,_line) @static_breakpoints.delete_if{|b| (b[:file]==_file && b[:line]==_line)} end |
#breakpoint_del_live(_file, _line) ⇒ Object
1345 1346 1347 1348 1349 1350 |
# File 'ext/ae-ruby-debug/ae-ruby-debug.rb', line 1345 def breakpoint_del_live(_file,_line) if @rdc && @rdc.is_alive? @rdc.unset_breakpoint(@breakpoints.delete(breakpoint_suf(_file,_line))) @rdv.break_list_del(_file,_line) if @rdv end end |
#breakpoint_free_live ⇒ Object
1352 1353 1354 1355 |
# File 'ext/ae-ruby-debug/ae-ruby-debug.rb', line 1352 def breakpoint_free_live @breakpoints.clear @rdv.break_list_free if @rdv end |
#can_exit_query ⇒ Object
1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 |
# File 'ext/ae-ruby-debug/ae-ruby-debug.rb', line 1370 def can_exit_query if @rdc query = (Tk.('icon' => 'question', 'type' => 'yesno', 'title' => '(Arcadia) Debug', 'message' => "Debug in course, do you want to exit?")=='yes') if query debug_quit return true else return false end else return true end end |
#debug(_filename = nil) ⇒ Object
1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 |
# File 'ext/ae-ruby-debug/ae-ruby-debug.rb', line 1404 def debug(_filename=nil) if _filename && !debugging? begin self.debug_begin @arcadia['pers']['run.file.last']=_filename @rds = RubyDebugServer.new(self,@arcadia) if @rds.nil? @rds.start_session(_filename, conf('server.host'), conf('server.port')) #Arcadia.new_msg(self,@rds.to_s) @rdc = RubyDebugClient.new(conf('server.host'), conf('server.port'), conf('server.timeout')) if @rdc.nil? @rdv = RubyDebugView.new(self.frame, self) if @rdv.nil? @rdv.start_process(_filename) if @rdc.start_session @static_breakpoints.each{|_b| #Arcadia.new_msg(self," breakpoint_add #{_b[:file]}:#{_b[:line]}") breakpoint_add_live(_b[:file], _b[:line]) } end #Arcadia.new_msg(self,"\n<begin debug>") rescue Exception => e Arcadia.new_debug_msg(self,"---> "+e.to_s) end end end |
#debug_begin ⇒ Object
1399 1400 1401 1402 |
# File 'ext/ae-ruby-debug/ae-ruby-debug.rb', line 1399 def debug_begin breakpoint_free_live #DebugContract.instance.debug_begin(self) end |
#debug_current ⇒ Object
1391 1392 1393 1394 |
# File 'ext/ae-ruby-debug/ae-ruby-debug.rb', line 1391 def debug_current Arcadia.process_event(StartDebugEvent.new(self, 'file'=>@raised_file)) if @raised_file!=nil #debug(@raised_file) if @raised_file!=nil end |
#debug_free ⇒ Object
1437 1438 1439 1440 1441 |
# File 'ext/ae-ruby-debug/ae-ruby-debug.rb', line 1437 def debug_free self.frame_free @rdc = nil @rdv = nil end |
#debug_last ⇒ Object
1386 1387 1388 1389 |
# File 'ext/ae-ruby-debug/ae-ruby-debug.rb', line 1386 def debug_last Arcadia.process_event(StartDebugEvent.new(self, 'file'=>$arcadia['pers']['run.file.last'])) #debug($arcadia['pers']['run.file.last']) end |
#debug_quit ⇒ Object
1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 |
# File 'ext/ae-ruby-debug/ae-ruby-debug.rb', line 1443 def debug_quit if @rdc if @rdc.is_alive? Thread.new{ Tk.('icon' => 'info', 'type' => 'ok', 'title' => '(Arcadia) Debug', 'message' => "Debug in course, stop it before exit") } else begin debug_free rescue Exception => e Arcadia.new_debug_msg(self, "debug_quit:---> "+e.to_s) #@arcadia['shell'].outln("debug_quit:---> "+e.to_s ) end end end end |
#debugging? ⇒ Boolean
debug(@raised_file) if @raised_file!=nil
1395 1396 1397 |
# File 'ext/ae-ruby-debug/ae-ruby-debug.rb', line 1395 def debugging? !@rdc.nil? && @rdc.is_alive? end |
#eval_expression(_exp) ⇒ Object
def do_editor_event(_event)
case _event.signature
when EditorContract::BREAKPOINT_AFTER_CREATE
self.breakpoint_add(File.(_event.context.file), _event.context.line)
when EditorContract::BREAKPOINT_AFTER_DELETE
self.breakpoint_del(File.(_event.context.file), _event.context.line)
when EditorContract::BUFFER_AFTER_RAISE
@raised_file=_event.context.file
when EditorContract::EVAL_EXPRESSION
eval_expression(_event.context.text)
end
end
1313 1314 1315 1316 1317 1318 |
# File 'ext/ae-ruby-debug/ae-ruby-debug.rb', line 1313 def eval_expression(_exp) res = @rdc.debug_eval(_exp) if @rdc && @rdc.is_debugging_ready? hash = Hash.new hash[_exp]=res @rdv.show_expression(_exp, hash) if res end |
#on_before_build(_event) ⇒ Object
1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 |
# File 'ext/ae-ruby-debug/ae-ruby-debug.rb', line 1255 def on_before_build(_event) if !full_in_path_command('rdebug').nil? #ArcadiaContractListener.new(self, EditorContract, :do_editor_event) Arcadia.add_listener(self, BufferEvent) @breakpoints = Hash.new @static_breakpoints = Array.new else Arcadia.new_error_msg(self, "Warning: Extension ae-ruby-debug depend upon rdebug command (install it or update system path!)") end end |
#on_buffer(_event) ⇒ Object
1270 1271 1272 1273 1274 1275 |
# File 'ext/ae-ruby-debug/ae-ruby-debug.rb', line 1270 def on_buffer(_event) case _event when BufferRaisedEvent @raised_file=_event.file end end |
#on_build(_event) ⇒ Object
1266 1267 1268 |
# File 'ext/ae-ruby-debug/ae-ruby-debug.rb', line 1266 def on_build(_event) Arcadia.add_listener(self, DebugEvent) end |
#on_debug(_event) ⇒ Object
1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 |
# File 'ext/ae-ruby-debug/ae-ruby-debug.rb', line 1277 def on_debug(_event) case _event when StartDebugEvent _filename = _event.file _filename = @arcadia['pers']['run.file.last'] if _filename == "*LAST" debug(_filename) when StepDebugEvent if (_event.command == :quit_yes) @rds.quit_confirm_request = true end @rdc.send(_event.command) if @rdc.is_alive? when SetBreakpointEvent self.breakpoint_add(File.(_event.file), _event.row) when UnsetBreakpointEvent self.breakpoint_del(File.(_event.file), _event.row) when EvalExpressionEvent eval_expression(_event.expression) when StopDebugEvent self.debug_quit end end |
#rdebug_server_update(_state) ⇒ Object
1429 1430 1431 1432 1433 1434 1435 |
# File 'ext/ae-ruby-debug/ae-ruby-debug.rb', line 1429 def rdebug_server_update(_state) case _state when RubyDebugServer::RDS_QUIET #debug_free end #p _state end |