Class: RubyDebug
Instance Attribute Summary collapse
Attributes inherited from ArcadiaExt
#arcadia, #name
Instance Method Summary
collapse
Methods inherited from ArcadiaExt
#add_to_conf_property, #array_conf, #conf, #conf_array, #conf_default, #del_from_conf_property, #exec, #float_frame, #frame, #frame_def_visible?, #frame_domain, #frame_domain_default, #frame_visible?, #hide_frame, #initialize, #maximize, #maximized?, #resize, #restore_default_conf
Constructor Details
This class inherits a constructor from ArcadiaExt
Instance Attribute Details
#rdc ⇒ Object
Returns the value of attribute rdc.
1407
1408
1409
|
# File 'ext/ae-ruby-debug/ae-ruby-debug.rb', line 1407
def rdc
@rdc
end
|
#rdebug_file ⇒ Object
Returns the value of attribute rdebug_file.
1408
1409
1410
|
# File 'ext/ae-ruby-debug/ae-ruby-debug.rb', line 1408
def rdebug_file
@rdebug_file
end
|
#rds ⇒ Object
Returns the value of attribute rds.
1406
1407
1408
|
# File 'ext/ae-ruby-debug/ae-ruby-debug.rb', line 1406
def rds
@rds
end
|
Instance Method Details
#break_name(_file, _line) ⇒ Object
1523
1524
1525
|
# File 'ext/ae-ruby-debug/ae-ruby-debug.rb', line 1523
def break_name(_file,_line)
"#{_file}:#{_line}"
end
|
#breakpoint_add(_file, _line) ⇒ Object
1546
1547
1548
1549
|
# File 'ext/ae-ruby-debug/ae-ruby-debug.rb', line 1546
def breakpoint_add(_file,_line)
breakpoint_add_live(_file,_line)
@static_breakpoints << {:file=>_file,:line=>_line}
end
|
#breakpoint_add_live(_file, _line) ⇒ Object
1527
1528
1529
1530
1531
1532
|
# File 'ext/ae-ruby-debug/ae-ruby-debug.rb', line 1527
def breakpoint_add_live(_file,_line)
if @rdc && @rdc.is_alive?
@breakpoints[breakpoint_suf(_file,_line)] = @rdc.set_breakpoint(_file, _line.to_i)
end
end
|
#breakpoint_del(_file, _line) ⇒ Object
1561
1562
1563
1564
|
# File 'ext/ae-ruby-debug/ae-ruby-debug.rb', line 1561
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
1534
1535
1536
1537
1538
1539
|
# File 'ext/ae-ruby-debug/ae-ruby-debug.rb', line 1534
def breakpoint_del_live(_file,_line)
if @rdc && @rdc.is_alive?
@rdc.unset_breakpoint(@breakpoints.delete(breakpoint_suf(_file,_line)))
end
end
|
#breakpoint_free_live ⇒ Object
1541
1542
1543
1544
|
# File 'ext/ae-ruby-debug/ae-ruby-debug.rb', line 1541
def breakpoint_free_live
@breakpoints.clear if @breakpoints
end
|
#debug_begin ⇒ Object
1597
1598
1599
1600
|
# File 'ext/ae-ruby-debug/ae-ruby-debug.rb', line 1597
def debug_begin
breakpoint_free_live
end
|
#debug_free ⇒ Object
1645
1646
1647
1648
1649
1650
|
# File 'ext/ae-ruby-debug/ae-ruby-debug.rb', line 1645
def debug_free
self.frame.free
self.frame(1).free
@rdc = nil
@rdv = nil
end
|
#debug_quit ⇒ Object
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
|
# File 'ext/ae-ruby-debug/ae-ruby-debug.rb', line 1652
def debug_quit
if @rdc
if @rdc.is_alive?
Thread.new{
Arcadia.dialog(self,
'type'=>'ok',
'title' => Arcadia.text("ext.ruby_debug.d.quit_if_debug.title"),
'msg'=>Arcadia.text("ext.ruby_debug.d.quit_if_debug.msg"),
'level'=>'info')
}
else
begin
debug_free
rescue Exception => e
Arcadia.console(self, 'msg'=>"debug_quit:---> "+e.to_s+ ' ' + e.backtrace[0], 'level'=>'debug')
end
end
end
end
|
#debugging? ⇒ Boolean
debug(@raised_file) if @raised_file!=nil
1593
1594
1595
|
# File 'ext/ae-ruby-debug/ae-ruby-debug.rb', line 1593
def debugging?
!@rdc.nil? && @rdc.is_alive?
end
|
#do_debug(_event) ⇒ Object
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
|
# File 'ext/ae-ruby-debug/ae-ruby-debug.rb', line 1602
def do_debug(_event)
_filename = _event.file
if _filename && !debugging?
begin
self.debug_begin
@arcadia['pers']['run.file.last']=_filename if _event.persistent
@rds = RubyDebugServer.new(self,@arcadia) if @rds.nil?
@rds.start_session(_event, conf('server.host'), conf('server.port'))
@rdc = RubyDebugClient.new(self, conf('server.host'), conf('server.port'), conf('server.timeout')) if @rdc.nil?
@rdv = RubyDebugView.new(self) if @rdv.nil?
self.frame.show
@rdv.start_process(_filename)
if @rdc.start_session
@static_breakpoints.each{|_b|
if !_event.persistent && _b[:file]==_event.id
_b[:file]=_filename
end
breakpoint_add_live(_b[:file], _b[:line])
}
if static_breakpoints_of_file(_filename).length > 0 && conf("auto_resume_break_on_first_line")!='no'
@rdv.debug_send(:resume)
end
end
rescue Exception => e
Arcadia.console(self, Arcadia.text('ext.ruby_debug.e.do_debug', [e.to_s, e.backtrace[0]]), 'level'=>'debug')
end
end
end
|
#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
1502
1503
1504
1505
1506
1507
|
# File 'ext/ae-ruby-debug/ae-ruby-debug.rb', line 1502
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
#on_buffer(_event) ⇒ Object
1439
1440
1441
1442
1443
1444
1445
1446
|
# File 'ext/ae-ruby-debug/ae-ruby-debug.rb', line 1439
def on_buffer(_event)
case _event
when BufferRaisedEvent
@raised_file=_event.file
debugcurr = Arcadia.toolbar_item('debugcurr')
debugcurr.enable=_event.lang=='ruby' if debugcurr
end
end
|
#on_build(_event) ⇒ Object
1435
1436
1437
|
# File 'ext/ae-ruby-debug/ae-ruby-debug.rb', line 1435
def on_build(_event)
end
|
#on_debug(_event) ⇒ Object
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
|
# File 'ext/ae-ruby-debug/ae-ruby-debug.rb', line 1448
def on_debug(_event)
case _event
when StartDebugEvent
return if _event.file.nil?
_filename = _event.file
_filename = @arcadia['pers']['run.file.last'] if _filename == "*LAST"
if _filename && File.exist?(_filename)
do_debug(_event)
else
Arcadia.dialog(self,
'type'=>'ok',
'title'=>Arcadia.text('ext.ruby_debug.d.file_not_exist.title'),
'msg'=>Arcadia.text('ext.ruby_debug.d.file_not_exist.msg', [_filename]))
end
when StepDebugEvent
if (_event.command == :quit_yes)
@rds.quit_confirm_request = true
end
@rdc.send(_event.command) if @rdc.is_alive?
when SetBreakpointEvent
if _event.file
self.breakpoint_add(File.expand_path(_event.file), _event.row)
elsif _event.id
self.breakpoint_add(_event.id, _event.row)
end
when UnsetBreakpointEvent
return if _event.file.nil?
self.breakpoint_del(File.expand_path(_event.file), _event.row)
when EvalExpressionEvent
eval_expression(_event.expression)
when StopDebugEvent
self.debug_quit
end
end
|
#on_exit_query(_event) ⇒ Object
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
|
# File 'ext/ae-ruby-debug/ae-ruby-debug.rb', line 1568
def on_exit_query(_event)
if @rdc && @rdc.is_alive?
query = (Arcadia.dialog(self, 'icon' => 'question', 'type' => 'yes_no',
'title' => Arcadia.text("ext.ruby_debug.d.exit_query.title"),
'message' => Arcadia.text("ext.ruby_debug.d.exit_query.msg"))=='yes')
if query
debug_quit
_event.can_exit=true
else
_event.can_exit=false
end
else
_event.can_exit=true
end
end
|
#rdebug_server_update(_state) ⇒ Object
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
|
# File 'ext/ae-ruby-debug/ae-ruby-debug.rb', line 1634
def rdebug_server_update(_state)
case _state
when RubyDebugServer::RDS_QUIET
@rdc.kill if @rdc
end
end
|
#static_breakpoints_of_file(_filename) ⇒ Object
1551
1552
1553
1554
1555
1556
1557
1558
1559
|
# File 'ext/ae-ruby-debug/ae-ruby-debug.rb', line 1551
def static_breakpoints_of_file(_filename)
ret = Array.new
@static_breakpoints.each{|b|
if b[:file]==_filename
ret << b
end
}
ret
end
|