lib/gdbdump/cli.rb in gdbdump-0.9.0 vs lib/gdbdump/cli.rb in gdbdump-0.9.1
- old
+ new
@@ -16,42 +16,43 @@
opts = {
debug: false,
gdbinit: nil,
gdb: nil,
+ ruby: nil,
}
op.on('-d', '--[no-]debug', "print debug log (default: #{opts[:debug]})") {|v|
opts[:debug] = v
}
- op.on('-x', '--gdbinit FILE', "path to ruby trunk's .gdbinit (default: some of ruby trunk's .gdbinit is bundle in this gem, and used})") {|v|
+ op.on('-x', '--gdbinit FILE', "path to ruby trunk's .gdbinit (default: some of ruby trunk's .gdbinit is pre-bundle in this gem)") {|v|
opts[:gdbinit] = v
}
op.on('--gdb PATH', "path to gdb command (default: gdb)") {|v|
opts[:gdb] = v
}
+ op.on('--ruby PATH', "path to ruby which the attached process uses (default: get from /proc/[PID]/exe)") {|v|
+ opts[:ruby] = v
+ }
- op.banner += ' [pid|prog pid]'
+ op.banner += ' pid'
begin
args = op.parse(argv)
rescue OptionParser::InvalidOption => e
usage e.message
end
if args.size == 1
@pid = args.first
- @prog = Gdbdump::Procfs.new(@pid).exe
- elsif args.size == 2
- @prog, @pid = args
else
- usage 'number of arguments must be 1 or 2'
+ usage 'number of arguments must be 1'
end
@opts = opts
end
def run
parse_options
- GDB.new(pid: @pid, prog: @prog, **(@opts)).print_backtrace
+ GDB.new(pid: @pid, **(@opts)).print_backtrace
end
end
end