rbx-trepanning 0.0.8-universal-rubinius-1.2 → 0.1.0-universal-rubinius-1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +762 -238
- data/NEWS +44 -0
- data/Rakefile +61 -32
- data/app/breakpoint.rb +2 -0
- data/app/brkptmgr.rb +9 -11
- data/app/client.rb +0 -1
- data/app/cmd_parse.kpeg +21 -4
- data/app/cmd_parse.rb +10 -10
- data/app/cmd_parser.rb +1029 -840
- data/app/complete.rb +1 -1
- data/app/display.rb +38 -0
- data/app/file.rb +24 -0
- data/app/frame.rb +11 -4
- data/app/irb.rb +41 -39
- data/app/iseq.rb +71 -0
- data/app/options.rb +55 -30
- data/app/rbx-llvm.rb +0 -2
- data/app/run.rb +13 -9
- data/app/util.rb +55 -5
- data/bin/trepanx +3 -3
- data/data/irbrc +13 -13
- data/{interface/base_intf.rb → interface.rb} +5 -1
- data/interface/client.rb +4 -0
- data/interface/script.rb +13 -5
- data/interface/server.rb +5 -1
- data/interface/user.rb +8 -1
- data/{io/base_io.rb → io.rb} +0 -0
- data/io/input.rb +1 -1
- data/io/null_output.rb +28 -24
- data/io/string_array.rb +2 -3
- data/io/tcpclient.rb +1 -1
- data/io/tcpserver.rb +1 -1
- data/lib/trepanning.rb +11 -13
- data/{processor/main.rb → processor.rb} +50 -54
- data/processor/breakpoint.rb +150 -137
- data/processor/{command/base/cmd.rb → command.rb} +1 -1
- data/processor/command/alias.rb +14 -3
- data/processor/command/backtrace.rb +2 -1
- data/processor/command/base/subcmd.rb +1 -5
- data/processor/command/base/submgr.rb +5 -2
- data/processor/command/base/subsubcmd.rb +1 -1
- data/processor/command/base/subsubmgr.rb +4 -4
- data/processor/command/break.rb +1 -1
- data/processor/command/complete.rb +2 -1
- data/processor/command/condition.rb +2 -2
- data/processor/command/continue.rb +4 -4
- data/processor/command/delete.rb +34 -20
- data/processor/command/directory.rb +4 -4
- data/processor/command/disable.rb +71 -0
- data/processor/command/disassemble.rb +55 -22
- data/processor/command/display.rb +3 -1
- data/processor/command/down.rb +8 -8
- data/processor/command/edit.rb +74 -0
- data/processor/command/enable.rb +43 -0
- data/processor/command/eval.rb +37 -15
- data/processor/command/exit.rb +25 -6
- data/processor/command/finish.rb +5 -5
- data/processor/command/frame.rb +2 -2
- data/processor/command/help.rb +7 -9
- data/processor/command/help/README +10 -0
- data/processor/command/help/command.txt +37 -27
- data/processor/command/help/examples.txt +16 -0
- data/processor/command/help/filename.txt +1 -1
- data/processor/command/help/suffixes.txt +17 -0
- data/processor/command/info.rb +3 -1
- data/processor/command/info_subcmd/files.rb +3 -2
- data/processor/command/info_subcmd/frame.rb +2 -1
- data/processor/command/info_subcmd/line.rb +17 -28
- data/processor/command/info_subcmd/locals.rb +22 -0
- data/processor/command/{show_subcmd → info_subcmd}/macro.rb +4 -4
- data/processor/command/info_subcmd/program.rb +2 -0
- data/processor/command/info_subcmd/ruby.rb +2 -0
- data/processor/command/info_subcmd/source.rb +75 -0
- data/processor/command/info_subcmd/stack.rb +25 -0
- data/processor/command/info_subcmd/variables.rb +23 -36
- data/processor/command/info_subcmd/variables_subcmd/.gitignore +2 -0
- data/processor/command/info_subcmd/variables_subcmd/class.rb +42 -0
- data/processor/command/info_subcmd/variables_subcmd/constant.rb +42 -0
- data/processor/command/info_subcmd/variables_subcmd/globals.rb +69 -0
- data/processor/command/info_subcmd/variables_subcmd/instance.rb +42 -0
- data/processor/command/info_subcmd/variables_subcmd/locals.rb +80 -0
- data/processor/command/kill.rb +8 -9
- data/processor/command/list.rb +101 -167
- data/processor/command/macro.rb +28 -10
- data/processor/command/next.rb +2 -1
- data/processor/command/nexti.rb +1 -1
- data/processor/command/parsetree.rb +51 -0
- data/processor/command/pr.rb +1 -2
- data/processor/command/ps.rb +1 -1
- data/processor/command/restart.rb +2 -2
- data/processor/command/save.rb +1 -1
- data/processor/command/server.rb +1 -1
- data/processor/command/set_subcmd/abbrev.rb +25 -0
- data/processor/command/set_subcmd/auto.rb +7 -1
- data/processor/command/set_subcmd/auto_subcmd/eval.rb +1 -2
- data/processor/command/set_subcmd/auto_subcmd/irb.rb +2 -3
- data/processor/command/set_subcmd/auto_subcmd/list.rb +2 -3
- data/processor/command/set_subcmd/different.rb +1 -1
- data/processor/command/set_subcmd/highlight.rb +7 -1
- data/processor/command/set_subcmd/reload.rb +42 -0
- data/processor/command/set_subcmd/timer.rb +58 -0
- data/processor/command/set_subcmd/trace.rb +4 -3
- data/processor/command/{irb.rb → shell.rb} +22 -19
- data/processor/command/show_subcmd/abbrev.rb +20 -0
- data/processor/command/show_subcmd/{alias.rb → aliases.rb} +2 -2
- data/processor/command/show_subcmd/auto_subcmd/eval.rb +2 -6
- data/processor/command/show_subcmd/directories.rb +22 -0
- data/processor/command/show_subcmd/hidelevel.rb +1 -1
- data/processor/command/show_subcmd/highlight.rb +2 -1
- data/processor/command/show_subcmd/reload.rb +18 -0
- data/processor/command/show_subcmd/timer.rb +18 -0
- data/processor/command/source.rb +9 -9
- data/processor/command/step.rb +1 -1
- data/processor/command/tbreak.rb +3 -2
- data/processor/command/unalias.rb +11 -6
- data/processor/command/undisplay.rb +13 -9
- data/processor/command/up.rb +13 -14
- data/processor/default.rb +47 -44
- data/processor/disassemble.rb +48 -35
- data/processor/display.rb +38 -3
- data/processor/eval.rb +54 -53
- data/processor/eventbuf.rb +69 -69
- data/processor/frame.rb +186 -187
- data/processor/help.rb +6 -4
- data/processor/hook.rb +103 -102
- data/processor/list.rb +123 -0
- data/processor/load_cmds.rb +9 -1
- data/processor/location.rb +193 -188
- data/processor/mock.rb +1 -7
- data/processor/msg.rb +56 -42
- data/processor/running.rb +26 -15
- data/processor/stepping.rb +2 -1
- data/processor/subcmd.rb +18 -43
- data/processor/validate.rb +41 -30
- data/processor/virtual.rb +33 -0
- data/rbx-trepanning.gemspec +7 -8
- data/sample/rocky-trepanx-colors.rb +0 -1
- data/test/data/fname-with-blank.right +2 -0
- data/test/data/inline-call.right +11 -10
- data/test/data/quit.right +1 -0
- data/test/example/debugger-stop.rb +1 -1
- data/test/example/goto2goto.rb +11 -0
- data/test/functional/fn_helper.rb +2 -2
- data/test/functional/test-list.rb +7 -6
- data/test/integration/helper.rb +5 -5
- data/test/unit/cmd-helper.rb +2 -6
- data/test/unit/test-app-cmd_parser.rb +3 -2
- data/test/unit/test-app-display.rb +22 -0
- data/test/unit/test-app-options.rb +14 -10
- data/test/unit/test-app-run.rb +0 -2
- data/test/unit/test-app-util.rb +21 -4
- data/test/unit/test-base-cmd.rb +5 -7
- data/test/unit/test-base-subcmd.rb +1 -5
- data/test/unit/test-base-submgr.rb +1 -1
- data/test/unit/test-base-subsubcmd.rb +0 -4
- data/test/unit/test-bin-trepanx.rb +2 -2
- data/test/unit/test-cmd-break.rb +2 -0
- data/test/unit/test-cmd-edit.rb +34 -0
- data/test/unit/test-cmd-kill.rb +11 -4
- data/test/unit/test-cmd-parse_list_cmd.rb +36 -0
- data/test/unit/test-command.rb +45 -0
- data/test/unit/test-completion.rb +1 -1
- data/test/unit/test-proc-eval.rb +1 -2
- data/test/unit/test-proc-frame.rb +5 -3
- data/test/unit/test-proc-list.rb +55 -0
- data/test/unit/test-proc-load_cmds.rb +4 -3
- data/test/unit/test-proc-location.rb +32 -29
- data/test/unit/test-proc-main.rb +1 -5
- data/test/unit/test-proc-validate.rb +14 -4
- data/test/unit/test-subcmd-help.rb +1 -5
- metadata +73 -107
data/app/complete.rb
CHANGED
@@ -10,7 +10,7 @@ class Trepan
|
|
10
10
|
# Return an Array of String found from Array of String
|
11
11
|
# +complete_ary+ which start out with String +prefix+.
|
12
12
|
def complete_token(complete_ary, prefix)
|
13
|
-
complete_ary.select { |cmd| cmd.to_s.start_with?(prefix) }.sort
|
13
|
+
complete_ary.select { |cmd| cmd.to_s.start_with?(prefix) }.map{|cmd| cmd.to_s}.sort
|
14
14
|
end
|
15
15
|
|
16
16
|
def complete_token_with_next(complete_hash, prefix, cmd_prefix='')
|
data/app/display.rb
CHANGED
@@ -19,6 +19,13 @@ class DisplayMgr
|
|
19
19
|
@list = []
|
20
20
|
end
|
21
21
|
|
22
|
+
def [](index)
|
23
|
+
raise TypeError,
|
24
|
+
"index #{index} should be a Fixnum, is #{index.class}" unless
|
25
|
+
index.is_a?(Fixnum)
|
26
|
+
@list.detect {|disp| disp.number == index }
|
27
|
+
end
|
28
|
+
|
22
29
|
def add(frame, arg, fmt=nil)
|
23
30
|
return nil unless frame
|
24
31
|
begin
|
@@ -83,6 +90,18 @@ Num Enb Expression"
|
|
83
90
|
end
|
84
91
|
false
|
85
92
|
end
|
93
|
+
|
94
|
+
def max
|
95
|
+
@list.map{|disp| disp.number}.max
|
96
|
+
end
|
97
|
+
|
98
|
+
def nums
|
99
|
+
@list.map{|disp| disp.number}
|
100
|
+
end
|
101
|
+
|
102
|
+
def size
|
103
|
+
@list.size
|
104
|
+
end
|
86
105
|
end
|
87
106
|
|
88
107
|
class Display
|
@@ -98,6 +117,22 @@ class Display
|
|
98
117
|
@number = number
|
99
118
|
end
|
100
119
|
|
120
|
+
def disable
|
121
|
+
@enabled = false
|
122
|
+
end
|
123
|
+
|
124
|
+
def disabled?
|
125
|
+
!@enabled
|
126
|
+
end
|
127
|
+
|
128
|
+
def enable
|
129
|
+
@enabled = true
|
130
|
+
end
|
131
|
+
|
132
|
+
def enabled?
|
133
|
+
@enabled
|
134
|
+
end
|
135
|
+
|
101
136
|
def to_s(frame)
|
102
137
|
return 'No symbol "' + @arg + '" in current context.' unless frame
|
103
138
|
|
@@ -119,6 +154,7 @@ class Display
|
|
119
154
|
what += @arg if @arg
|
120
155
|
'%3d: %s' % [@number, what]
|
121
156
|
end
|
157
|
+
|
122
158
|
end
|
123
159
|
|
124
160
|
if __FILE__ == $0
|
@@ -134,6 +170,8 @@ if __FILE__ == $0
|
|
134
170
|
|
135
171
|
x = 1
|
136
172
|
mgr.add(frame, 'x > 1')
|
173
|
+
puts "Number of displays %s" % mgr.size
|
174
|
+
puts "Max Number %d" % mgr.max
|
137
175
|
print_display(mgr)
|
138
176
|
|
139
177
|
mgr.enable_disable(1, false)
|
data/app/file.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
3
|
+
# Things related to file/module status
|
4
|
+
|
5
|
+
module Trepanning
|
6
|
+
module FileName
|
7
|
+
def find_load_path(filename)
|
8
|
+
cl = Rubinius::CodeLoader.new(filename)
|
9
|
+
if cl.verify_load_path(filename)
|
10
|
+
path = cl.instance_variable_get('@load_path')
|
11
|
+
path.end_with?(filename) ? filename : nil
|
12
|
+
else
|
13
|
+
nil
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
if __FILE__ == $0
|
19
|
+
include Trepanning::FileName
|
20
|
+
require 'tmpdir.rb'
|
21
|
+
[__FILE__, 'tmpdir.rb'].each do |name|
|
22
|
+
p find_load_path(name)
|
23
|
+
end
|
24
|
+
end
|
data/app/frame.rb
CHANGED
@@ -3,8 +3,8 @@ class Trepan
|
|
3
3
|
|
4
4
|
# Call-Stack frame methods
|
5
5
|
class Frame
|
6
|
-
def initialize(
|
7
|
-
@debugger =
|
6
|
+
def initialize(dbgr, number, vm_location)
|
7
|
+
@debugger = dbgr
|
8
8
|
@number = number
|
9
9
|
@vm_location = vm_location
|
10
10
|
end
|
@@ -49,7 +49,9 @@ class Trepan
|
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
-
|
52
|
+
filename = loc.method.active_path
|
53
|
+
filename = File.basename(filename) if opts[:basename]
|
54
|
+
str = "#{recv} at #{filename}:#{loc.line}"
|
53
55
|
if opts[:show_ip]
|
54
56
|
str << " (@#{loc.ip})"
|
55
57
|
end
|
@@ -70,7 +72,8 @@ class Trepan
|
|
70
72
|
end
|
71
73
|
|
72
74
|
def line
|
73
|
-
@vm_location.line
|
75
|
+
line_no = @vm_location.line
|
76
|
+
line_no == 0 ? ISeq::tail_code_line(method, next_ip) : line_no
|
74
77
|
end
|
75
78
|
|
76
79
|
def local_variables
|
@@ -85,6 +88,10 @@ class Trepan
|
|
85
88
|
@vm_location.variables
|
86
89
|
end
|
87
90
|
|
91
|
+
def stack_size
|
92
|
+
@debugger.vm_locations.size
|
93
|
+
end
|
94
|
+
|
88
95
|
def eval?
|
89
96
|
static = @vm_location.static_scope
|
90
97
|
static && static.script && static.script.eval_source
|
data/app/irb.rb
CHANGED
@@ -6,49 +6,51 @@ module IRB # :nodoc:
|
|
6
6
|
# FIXME: should we read these out of a directory to
|
7
7
|
# make this more user-customizable?
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
$trepan_irb_statements
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
9
|
+
unless defined? Continue
|
10
|
+
# A base command class that resume execution
|
11
|
+
class DebuggerResumeCommand
|
12
|
+
def self.execute(conf, *opts)
|
13
|
+
name =
|
14
|
+
if self.name =~ /IRB::ExtendCommand::(\S+)/
|
15
|
+
$1.downcase
|
16
|
+
else
|
17
|
+
'unknown'
|
18
|
+
end
|
19
|
+
$trepan_args = opts
|
20
|
+
$trepan_command =
|
21
|
+
if $trepan_irb_statements
|
22
|
+
$trepan_irb_statements
|
23
|
+
else
|
24
|
+
([name] + opts).join(' ')
|
25
|
+
end
|
26
|
+
|
27
|
+
throw :IRB_EXIT, name.to_sym
|
28
|
+
end
|
27
29
|
end
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
30
|
+
|
31
|
+
class Continue < DebuggerResumeCommand ; end
|
32
|
+
class Finish < DebuggerResumeCommand ; end
|
33
|
+
class Next < DebuggerResumeCommand ; end
|
34
|
+
class Quit < DebuggerResumeCommand ; end
|
35
|
+
class Step < DebuggerResumeCommand ; end
|
36
|
+
|
37
|
+
# Issues a comamnd to the debugger without continuing
|
38
|
+
# execution.
|
39
|
+
class Dbgr
|
40
|
+
def self.execute(conf, *opts)
|
41
|
+
$trepan_command =
|
42
|
+
if opts.size == 1 && opts[0].is_a?(String)
|
43
|
+
$trepan_args = opts[0]
|
44
|
+
else
|
45
|
+
opts.join(' ')
|
46
|
+
end
|
47
|
+
dbg_cmdproc = conf.workspace.instance_variable_get('@dbg_cmdproc')
|
48
|
+
dbg_cmdproc.run_command($trepan_command)
|
49
|
+
end
|
48
50
|
end
|
49
51
|
end
|
50
|
-
|
51
52
|
end
|
53
|
+
|
52
54
|
if defined?(ExtendCommandBundle)
|
53
55
|
# New irb Commands which are the same name as their debugger
|
54
56
|
# counterpart
|
data/app/iseq.rb
CHANGED
@@ -61,6 +61,42 @@ class Trepan
|
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
64
|
+
def ip_ranges_for_line(lines, line)
|
65
|
+
result = []
|
66
|
+
in_range = false
|
67
|
+
start_ip = nil
|
68
|
+
total = lines.size
|
69
|
+
i = 1
|
70
|
+
while i < total
|
71
|
+
cur_line = lines.at(i)
|
72
|
+
if cur_line == line
|
73
|
+
start_ip = lines.at(i-1)
|
74
|
+
in_range = true
|
75
|
+
elsif cur_line > line && in_range
|
76
|
+
result << [start_ip, lines.at(i-1)]
|
77
|
+
start_ip = nil
|
78
|
+
in_range = false
|
79
|
+
end
|
80
|
+
i += 2
|
81
|
+
end
|
82
|
+
if in_range && start_ip
|
83
|
+
result << [start_ip, lines.at(total-1)]
|
84
|
+
end
|
85
|
+
result
|
86
|
+
end
|
87
|
+
|
88
|
+
# Return range of ips covering ip. There will be only one of these.
|
89
|
+
# We surround this in another list to match the format of
|
90
|
+
# ip_ranges_for_line.
|
91
|
+
def ip_ranges_for_ip(lines, ip)
|
92
|
+
total = lines.size
|
93
|
+
i = 0
|
94
|
+
while i < total and lines.at(i) <= ip
|
95
|
+
i += 2
|
96
|
+
end
|
97
|
+
[[lines.at(i-2), lines.at(i)]]
|
98
|
+
end
|
99
|
+
|
64
100
|
def next_interesting(cm, ip)
|
65
101
|
pop = Rubinius::InstructionSet.opcodes_map[:pop]
|
66
102
|
|
@@ -70,6 +106,41 @@ class Trepan
|
|
70
106
|
|
71
107
|
return ip
|
72
108
|
end
|
109
|
+
|
110
|
+
# start is assumed to be on a tail code "synthesized" line, which
|
111
|
+
# has line number 0. Follow opcodes until we get to a line that is
|
112
|
+
# not 0.
|
113
|
+
def tail_code_line(cm, start)
|
114
|
+
|
115
|
+
iseq = cm.iseq
|
116
|
+
|
117
|
+
i = start
|
118
|
+
fin = cm.lines.last
|
119
|
+
while i < fin
|
120
|
+
line_no = cm.line_from_ip(i)
|
121
|
+
return line_no if line_no > 0
|
122
|
+
op = iseq[i]
|
123
|
+
case op
|
124
|
+
when OP_GOTO_IF_TRUE, OP_GOTO_IF_FALSE, OP_GOTO
|
125
|
+
when OP_GOTO
|
126
|
+
i = iseq[i+1]
|
127
|
+
when OP_RET
|
128
|
+
return -2
|
129
|
+
when nil
|
130
|
+
return -1
|
131
|
+
else
|
132
|
+
# Rubinius is getting an error here sometimes. Need to figure
|
133
|
+
# out what's wrong.
|
134
|
+
begin
|
135
|
+
op = Rubinius::InstructionSet[op]
|
136
|
+
rescue TypeError
|
137
|
+
return -1
|
138
|
+
end
|
139
|
+
i += (op.arg_count + 1)
|
140
|
+
end
|
141
|
+
end
|
142
|
+
return 0
|
143
|
+
end
|
73
144
|
|
74
145
|
def yield_or_return_between(cm, start, fin)
|
75
146
|
iseq = cm.iseq
|
data/app/options.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
|
1
2
|
#!/usr/bin/env ruby
|
2
3
|
# -*- coding: utf-8 -*-
|
3
4
|
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
@@ -9,8 +10,8 @@ class Trepan
|
|
9
10
|
require 'rubygems'; require 'require_relative'
|
10
11
|
require_relative 'default'
|
11
12
|
|
12
|
-
|
13
|
-
|
13
|
+
VERSION = '0.1.0'
|
14
|
+
PROGRAM = 'trepanx' unless defined? Trepan::PROGRAM
|
14
15
|
|
15
16
|
def self.show_version
|
16
17
|
"#{PROGRAM}, version #{VERSION}"
|
@@ -34,16 +35,18 @@ class Trepan
|
|
34
35
|
#{show_version}
|
35
36
|
Usage: #{PROGRAM} [options] [[--] <script.rb> <script.rb parameters>]
|
36
37
|
EOB
|
38
|
+
opts.separator ''
|
39
|
+
opts.separator 'Options:'
|
37
40
|
opts.on('--client',
|
38
|
-
|
41
|
+
'Connect to out-of-process program') do
|
39
42
|
if options[:server]
|
40
|
-
stderr.puts
|
43
|
+
stderr.puts '--server option previously given. --client option ignored.'
|
41
44
|
else
|
42
45
|
options[:client] = true
|
43
46
|
end
|
44
47
|
end
|
45
48
|
opts.on('-c', '--command FILE', String,
|
46
|
-
|
49
|
+
'Execute debugger commands from FILE') do |cmdfile|
|
47
50
|
if File.readable?(cmdfile)
|
48
51
|
options[:cmdfiles] << cmdfile
|
49
52
|
elsif File.exists?(cmdfile)
|
@@ -52,14 +55,7 @@ EOB
|
|
52
55
|
stderr.puts "Command file '#{cmdfile}' does not exist."
|
53
56
|
end
|
54
57
|
end
|
55
|
-
opts.on('--
|
56
|
-
"Do not run debugger initialization file #{CMD_INITFILE}") do
|
57
|
-
options[:nx] = true
|
58
|
-
end
|
59
|
-
# opts.on('--output FILE', String, "Name of file to record output") do |outfile|
|
60
|
-
# options[:outfile] = outfile
|
61
|
-
# end
|
62
|
-
opts.on("--cd DIR", String, "Change current directory to DIR") do |dir|
|
58
|
+
opts.on('--cd DIR', String, 'Change current directory to DIR') do |dir|
|
63
59
|
if File.directory?(dir)
|
64
60
|
if File.executable?(dir)
|
65
61
|
options[:chdir] = dir
|
@@ -70,40 +66,69 @@ EOB
|
|
70
66
|
stderr.puts "\"#{dir}\" is not a directory. Option --cd ignored."
|
71
67
|
end
|
72
68
|
end
|
73
|
-
opts.on(
|
74
|
-
|
69
|
+
opts.on('--basename',
|
70
|
+
'Show only file basename in file locations') do
|
71
|
+
options[:basename] = true
|
72
|
+
end
|
73
|
+
opts.on('-d', '--debug', 'Set $DEBUG=true') do
|
74
|
+
$DEBUG = true
|
75
|
+
end
|
76
|
+
opts.on('--[no-]highlight',
|
77
|
+
'Use [no] syntax highlight output') do |v|
|
78
|
+
options[:highlight] = ((v) ? :term : nil)
|
79
|
+
end
|
80
|
+
opts.on('-h', '--host NAME', String,
|
81
|
+
'Host or IP used in TCP connections for --server or --client. ' +
|
75
82
|
"Default is #{DEFAULT_SETTINGS[:host].inspect}.") do
|
76
83
|
|name_or_ip|
|
77
84
|
options[:host] = name_or_ip
|
78
85
|
end
|
79
|
-
opts.on(
|
80
|
-
|
86
|
+
opts.on('-I', '--include PATH', String, 'Add PATH to $LOAD_PATH') do
|
87
|
+
|path|
|
88
|
+
$LOAD_PATH.unshift(path)
|
89
|
+
end
|
90
|
+
opts.on('--nx',
|
91
|
+
"Do not run debugger initialization file #{CMD_INITFILE}") do
|
92
|
+
options[:nx] = true
|
93
|
+
end
|
94
|
+
opts.on('-p', '--port NUMBER', Integer,
|
95
|
+
'Port number used in TCP connections for --server or --client. ' +
|
81
96
|
"Default is #{DEFAULT_SETTINGS[:port]}.") do
|
82
97
|
|num|
|
83
98
|
options[:port] = num
|
84
99
|
end
|
85
|
-
opts.on('--
|
86
|
-
|
100
|
+
opts.on('--[no-]readline',
|
101
|
+
'Try [not] GNU Readline') do |v|
|
102
|
+
options[:readline] = v
|
103
|
+
end
|
104
|
+
opts.on('-r', '--require SCRIPT', String,
|
105
|
+
'Require the library, before executing your script') do |name|
|
106
|
+
if name == 'debug'
|
107
|
+
stderr.puts "ruby-debug is not compatible with Ruby's 'debug' library. This option is ignored."
|
108
|
+
else
|
109
|
+
require name
|
110
|
+
end
|
111
|
+
end
|
112
|
+
opts.on('-s', '--server',
|
113
|
+
'Set up for out-of-process debugging') do
|
87
114
|
if options[:client]
|
88
|
-
stderr.puts
|
115
|
+
stderr.puts '--client option previously given. --server option ignored.'
|
89
116
|
else
|
90
117
|
options[:server] = true
|
91
118
|
end
|
92
119
|
end
|
93
|
-
opts.on('
|
94
|
-
|
95
|
-
options[:
|
96
|
-
end
|
97
|
-
opts.on('--[no-]readline',
|
98
|
-
"Try [not] GNU Readline") do |v|
|
99
|
-
options[:readline] = v
|
120
|
+
opts.on('-x', '--trace', 'Turn on line tracing') do
|
121
|
+
options[:traceprint] = true
|
122
|
+
options[:nx] = true
|
100
123
|
end
|
101
|
-
opts.
|
124
|
+
opts.separator ''
|
125
|
+
opts.on_tail('-?', '--help', 'Show this message') do
|
102
126
|
options[:help] = true
|
103
127
|
stdout.puts opts
|
128
|
+
exit
|
104
129
|
end
|
105
|
-
opts.on_tail(
|
106
|
-
|
130
|
+
opts.on_tail('-v', '--version',
|
131
|
+
'print the version') do
|
107
132
|
options[:version] = true
|
108
133
|
stdout.puts show_version
|
109
134
|
end
|