Module: Debugger

Defined in:
lib/debugger/xml/version.rb,
lib/debugger/xml/ide/interface.rb,
lib/debugger/xml/ide/processor.rb,
lib/debugger/xml/vim/interface.rb,
lib/debugger/xml/vim/processor.rb,
lib/debugger/xml/vim/notification.rb,
lib/debugger/xml/extensions/processor.rb,
lib/debugger/xml/extensions/ide_server.rb,
lib/debugger/xml/extensions/vim_server.rb,
lib/debugger/xml/extensions/commands/irb.rb,
lib/debugger/xml/extensions/commands/edit.rb,
lib/debugger/xml/extensions/commands/help.rb,
lib/debugger/xml/extensions/commands/info.rb,
lib/debugger/xml/extensions/commands/kill.rb,
lib/debugger/xml/extensions/commands/frame.rb,
lib/debugger/xml/extensions/commands/tmate.rb,
lib/debugger/xml/extensions/commands/trace.rb,
lib/debugger/xml/extensions/commands/inspect.rb,
lib/debugger/xml/extensions/commands/variables.rb,
lib/debugger/xml/ide/control_command_processor.rb,
lib/debugger/xml/vim/control_command_processor.rb

Defined Under Namespace

Modules: FrameFunctions, Xml Classes: CommandProcessor, Edit, HelpCommand, IRBCommand, InfoCommand, InspectCommand, KillCommand, TextMateCommand, TraceCommand, VarInstanceCommand

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.wait_for_startObject

Returns the value of attribute wait_for_start.



3
4
5
# File 'lib/debugger/xml/extensions/ide_server.rb', line 3

def wait_for_start
  @wait_for_start
end

Class Method Details

.proceedObject



22
23
24
25
# File 'lib/debugger/xml/extensions/ide_server.rb', line 22

def proceed
  return unless @mutex
  @mutex.synchronize { @proceed.signal }
end

.start_for_vim(options) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/debugger/xml/extensions/vim_server.rb', line 6

def start_for_vim(options)
  return if @control_thread
  daemonize!
  $stdout.reopen(options.output_file, 'w')
  $stdout.sync
  $stderr.reopen($stdout)
  @mutex = Mutex.new
  @proceed = ConditionVariable.new
  start
  File.unlink(options.socket) if File.exist?(options.socket)
  server = UNIXServer.new(options.socket)
  Xml::Vim::Notification.new("establish_connection", options).send
  @control_thread = DebugThread.new do
    begin
      while (session = server.accept)
        interface = Xml::Vim::Interface.new(session, options)
        processor = Xml::Vim::ControlCommandProcessor.new(interface)
        self.handler = Xml::Vim::Processor.new(interface)
        processor.process_commands
      end
    rescue Exception => e
      puts "INTERNAL ERROR!!! #{$!}" rescue nil
      puts $!.backtrace.map{|l| "\t#{l}"}.join("\n") rescue nil
      raise e
    ensure
      server.close
    end
  end
  @mutex.synchronize { @proceed.wait(@mutex) } if wait_for_start
end

.start_remote_ide(host, port) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/debugger/xml/extensions/ide_server.rb', line 5

def start_remote_ide(host, port)
  return if @control_thread
  @mutex = Mutex.new
  @proceed = ConditionVariable.new
  start
  @control_thread = DebugThread.new do
    server = TCPServer.new(host, port)
    while (session = server.accept)
      interface = Xml::Ide::Interface.new(session)
      processor = Xml::Ide::ControlCommandProcessor.new(interface)
      self.handler = Xml::Ide::Processor.new(interface)
      processor.process_commands
    end
  end
  @mutex.synchronize { @proceed.wait(@mutex) } if wait_for_start
end