Sha256: d482cc98c7b98c87393b5febefe92e565fdbf0b1bd2e645dde6a0d9ae206d804

Contents?: true

Size: 860 Bytes

Versions: 2

Compression:

Stored size: 860 Bytes

Contents

require 'ruby-debug-ide/attach/lldb'
require 'ruby-debug-ide/attach/gdb'

def command_exists(command)
  checking_command = "checking command #{command} for existence\n"
  `command -v #{command} >/dev/null 2>&1 || { exit 1; }`
  if $?.exitstatus != 0
    DebugPrinter.print_debug("#{checking_command}command does not exist.")
  else
    DebugPrinter.print_debug("#{checking_command}command does exist.")
  end
  $?.exitstatus == 0
end

def choose_debugger(ruby_path, pid, gems_to_include, debugger_loader_path, argv)
  if command_exists(LLDB.to_s)
    debugger = LLDB.new(ruby_path, pid, '--no-lldbinit', gems_to_include, debugger_loader_path, argv)
  elsif command_exists(GDB.to_s)
    debugger = GDB.new(ruby_path, pid, '-nh -nx', gems_to_include, debugger_loader_path, argv)
  else
    raise 'Neither gdb nor lldb was found. Aborting.'
  end

  debugger
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ruby-debug-ide-0.6.1.beta4 lib/ruby-debug-ide/attach/util.rb
ruby-debug-ide-0.6.1.beta3 lib/ruby-debug-ide/attach/util.rb