#!/usr/bin/env ruby require 'rubygems' require 'optparse' require "ostruct" require 'ruby-debug' $stdout.sync=true options = OpenStruct.new( 'host' => nil, 'port' => 1234, 'tracing' => false, 'frame_bind' => false ) opts = OptionParser.new do |opts| opts.banner = < e puts opts puts puts e.message exit(1) end if ARGV.empty? puts opts puts puts "Must specify a script to run" exit(1) end # save script name Debugger::PROG_SCRIPT = ARGV.shift # install interruption handler trap('INT') { Debugger.interrupt_last } # set options Debugger.keep_frame_binding = options.frame_bind Debugger.main(options.host, options.port)