Sha256: 79b249a7da54aa50bf53192c733e8f5bbd42b2f008499915b453865240fdb686

Contents?: true

Size: 841 Bytes

Versions: 1

Compression:

Stored size: 841 Bytes

Contents

#!/usr/bin/env ruby

require_relative '../lib/debug/config'
config = DEBUGGER__.parse_argv(ARGV)

case config[:mode]
when :start
  require 'rbconfig'

  libpath = File.join(File.expand_path(File.dirname(__dir__)), 'lib/debug')
  start_mode = config[:remote] ? "open" : 'start'
  cmd = config[:command] ? ARGV.shift : RbConfig.ruby

  env = ::DEBUGGER__.config_to_env_hash(config)
  env['RUBYOPT'] = "-r #{libpath}/#{start_mode}"

  exec(env, cmd, *ARGV)

when :attach
  require_relative "../lib/debug/client"

  config.each{|k, v|
    DEBUGGER__::CONFIG[k] = v
  }

  begin
    if ARGV.empty? && config[:port]
      DEBUGGER__::Client.new([config[:host], config[:port]].compact).connect
    else
      DEBUGGER__::Client.new(ARGV).connect
    end
  rescue DEBUGGER__::CommandLineOptionError
    puts opt.help
  end
else
  raise # assert
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
debug-1.0.0.beta8 exe/rdbg