Sha256: 82de49117c467ecc6c6aa682a66917736800de3d7089b34452ec15429e1f4bad
Contents?: true
Size: 1.69 KB
Versions: 2
Compression:
Stored size: 1.69 KB
Contents
module Debugger module MultiProcess class << self def pre_child(options = nil) require 'socket' require 'ostruct' host = ENV['DEBUGGER_HOST'] options ||= OpenStruct.new( 'frame_bind' => false, 'host' => host, 'load_mode' => false, 'port' => find_free_port(host), 'stop' => false, 'tracing' => false, 'int_handler' => true, 'cli_debug' => (ENV['DEBUGGER_CLI_DEBUG'] == 'true'), 'notify_dispatcher' => true, 'evaluation_timeout' => 10 ) if(options.ignore_port) options.port = find_free_port(options.host) options.notify_dispatcher = true end start_debugger(options) end def start_debugger(options) if Debugger.started? # we're in forked child, only need to restart control thread Debugger.breakpoints.clear Debugger.control_thread = nil Debugger.start_control(options.host, options.port, options.notify_dispatcher) end if options.int_handler # install interruption handler trap('INT') { Debugger.interrupt_last } end # set options Debugger.keep_frame_binding = options.frame_bind Debugger.tracing = options.tracing Debugger.evaluation_timeout = options.evaluation_timeout Debugger.cli_debug = options.cli_debug Debugger.prepare_debugger(options) end def find_free_port(host) server = TCPServer.open(host, 0) port = server.addr[1] server.close port end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ruby-debug-ide-0.6.1.beta9 | lib/ruby-debug-ide/multiprocess/pre_child.rb |
ruby-debug-ide-0.6.1.beta8 | lib/ruby-debug-ide/multiprocess/pre_child.rb |