trepanning 0.1.6 → 1.93.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/COPYING +57 -0
- data/ChangeLog +585 -736
- data/NEWS +26 -12
- data/README.md +62 -0
- data/Rakefile +15 -9
- data/app/breakpoint.rb +11 -12
- data/app/complete.rb +14 -14
- data/app/core.rb +34 -30
- data/app/default.rb +8 -7
- data/app/markdown.rb +191 -0
- data/app/options.rb +104 -99
- data/app/run.rb +9 -1
- data/app/util.rb +7 -7
- data/bin/trepan +7 -7
- data/interface.rb +0 -4
- data/interface/user.rb +11 -11
- data/io/input.rb +13 -13
- data/lib/trepanning.rb +30 -29
- data/processor.rb +40 -40
- data/processor/command.rb +13 -9
- data/processor/command/alias.rb +21 -15
- data/processor/command/backtrace.rb +27 -19
- data/processor/command/break.rb +24 -21
- data/processor/command/complete.rb +5 -2
- data/processor/command/condition.rb +14 -9
- data/processor/command/debug.rb +8 -8
- data/processor/command/down.rb +6 -6
- data/processor/command/edit.rb +4 -0
- data/processor/command/eval.rb +2 -2
- data/processor/command/exit.rb +12 -9
- data/processor/command/finish.rb +25 -23
- data/processor/command/frame.rb +30 -26
- data/processor/command/help.rb +203 -185
- data/processor/command/help/{command.txt → command.md} +21 -18
- data/processor/command/help/examples.md +20 -0
- data/processor/command/help/filename.md +46 -0
- data/processor/command/help/location.md +34 -0
- data/processor/command/help/suffixes.md +19 -0
- data/processor/command/info.rb +6 -4
- data/processor/command/info_subcmd/breakpoints.rb +13 -13
- data/processor/command/info_subcmd/files.rb +35 -31
- data/processor/command/info_subcmd/frame.rb +82 -33
- data/processor/command/info_subcmd/macro.rb +1 -1
- data/processor/command/info_subcmd/program.rb +8 -5
- data/processor/command/info_subcmd/registers.rb +15 -13
- data/processor/command/kill.rb +23 -17
- data/processor/command/list.rb +63 -56
- data/processor/command/macro.rb +45 -28
- data/processor/command/next.rb +29 -23
- data/processor/command/pp.rb +11 -9
- data/processor/command/pr.rb +10 -8
- data/processor/command/ps.rb +5 -5
- data/processor/command/quit.rb +24 -17
- data/processor/command/raise.rb +6 -6
- data/processor/command/reload.rb +9 -2
- data/processor/command/reload_subcmd/command.rb +4 -4
- data/processor/command/restart.rb +9 -4
- data/processor/command/save.rb +9 -9
- data/processor/command/server.rb +18 -17
- data/processor/command/set.rb +8 -6
- data/processor/command/set_subcmd/confirm.rb +15 -2
- data/processor/command/set_subcmd/different.rb +7 -5
- data/processor/command/set_subcmd/highlight.rb +14 -3
- data/processor/command/set_subcmd/pc.rb +62 -0
- data/processor/command/set_subcmd/sp.rb +8 -2
- data/processor/command/shell.rb +25 -23
- data/processor/command/show.rb +9 -7
- data/processor/command/show_subcmd/confirm.rb +12 -1
- data/processor/command/show_subcmd/highlight.rb +13 -3
- data/processor/command/source.rb +27 -26
- data/processor/command/step.rb +52 -43
- data/processor/command/tbreak.rb +9 -4
- data/processor/command/unalias.rb +9 -7
- data/processor/command/undisplay.rb +11 -7
- data/processor/command/up.rb +18 -13
- data/processor/command/watchg.rb +20 -17
- data/processor/complete.rb +120 -0
- data/processor/default.rb +47 -43
- data/processor/list.rb +23 -6
- data/processor/load_cmds.rb +25 -105
- data/processor/location.rb +104 -96
- data/processor/mock.rb +12 -12
- data/processor/msg.rb +61 -52
- data/processor/validate.rb +36 -27
- data/test/data/fname-with-blank.right +0 -1
- data/test/data/trace-mingw.right +28 -0
- data/test/data/trace.right +0 -2
- data/test/functional/test-raise.rb +3 -0
- data/test/integration/helper.rb +16 -16
- data/test/integration/test-debugger-stop.rb +8 -2
- data/test/integration/test-quit.rb +16 -15
- data/test/integration/test-trace.rb +19 -10
- data/test/unit/cmd-helper.rb +4 -1
- data/test/unit/test-app-complete.rb +3 -1
- data/test/unit/test-app-options.rb +7 -1
- data/test/unit/test-app-run.rb +9 -1
- data/test/unit/test-cmd-alias.rb +1 -1
- data/test/unit/test-cmd-edit.rb +2 -0
- data/test/unit/test-cmd-help.rb +10 -5
- data/test/unit/test-cmd-parse_list_cmd.rb +3 -3
- data/test/unit/test-completion.rb +2 -2
- data/test/unit/test-proc-default.rb +34 -0
- data/trepanning.gemspec +15 -14
- metadata +70 -44
- data/README.textile +0 -50
- data/processor/command/help/examples.txt +0 -16
- data/processor/command/help/filename.txt +0 -40
- data/processor/command/help/location.txt +0 -37
- data/processor/command/help/suffixes.txt +0 -17
- data/processor/command/info_subcmd/registers_subcmd/dfp.rb +0 -28
- data/processor/command/info_subcmd/registers_subcmd/lfp.rb +0 -47
- data/processor/command/nocache.rb +0 -32
- data/processor/command/parsetree.rb +0 -56
data/app/default.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2010,
|
1
|
+
# Copyright (C) 2010-2011, 2015 Rocky Bernstein <rockyb@rubyforge.net>
|
2
2
|
# A place for the default settings
|
3
3
|
class Trepan
|
4
4
|
|
@@ -9,7 +9,7 @@ class Trepan
|
|
9
9
|
DEFAULT_SETTINGS = {
|
10
10
|
:cmdproc_opts => {}, # Default Trepan::CmdProcessor settings
|
11
11
|
:core_opts => {}, # Default Trepan::Core settings
|
12
|
-
:delete_restore => true, # Delete restore profile after reading?
|
12
|
+
:delete_restore => true, # Delete restore profile after reading?
|
13
13
|
:initial_dir => nil, # If --cd option was given, we save it here.
|
14
14
|
:nx => false, # Don't run user startup file (e.g. .trepanrc)
|
15
15
|
|
@@ -17,7 +17,7 @@ class Trepan
|
|
17
17
|
# (out-of-process debugging)
|
18
18
|
:port => 1955,
|
19
19
|
:post_mortem => false,
|
20
|
-
:host => 'localhost',
|
20
|
+
:host => 'localhost',
|
21
21
|
|
22
22
|
:restart_argv => RubyVM::OS_ARGV,
|
23
23
|
# Command run when "restart" is given.
|
@@ -26,12 +26,13 @@ class Trepan
|
|
26
26
|
|
27
27
|
# Default settings for Trepan run from the command line.
|
28
28
|
DEFAULT_CMDLINE_SETTINGS = {
|
29
|
+
:basename => false,
|
29
30
|
:cmdfiles => [], # Initialization command files to run
|
30
31
|
:client => false, # Attach to out-of-process program?
|
31
32
|
:nx => false, # Don't run user startup file (e.g. .trepanrc)
|
32
33
|
:output => nil,
|
33
34
|
:port => DEFAULT_SETTINGS[:port],
|
34
|
-
:host => DEFAULT_SETTINGS[:host],
|
35
|
+
:host => DEFAULT_SETTINGS[:host],
|
35
36
|
:server => false, # Out-of-process debugging?
|
36
37
|
:readline => true, # Try to use GNU Readline?
|
37
38
|
# Note that at most one of :server or :client can be true.
|
@@ -39,14 +40,14 @@ class Trepan
|
|
39
40
|
|
40
41
|
DEFAULT_DEBUG_STR_SETTINGS = {
|
41
42
|
:core_opts => {
|
42
|
-
:cmdproc_opts => {:different =>
|
43
|
+
:cmdproc_opts => {:different => true, :highlight => true}},
|
43
44
|
:hide_stack => true,
|
44
45
|
} unless defined?(DEFAULT_DEBUG_STR_SETTINGS)
|
45
46
|
|
46
|
-
CMD_INITFILE_BASE =
|
47
|
+
CMD_INITFILE_BASE =
|
47
48
|
if RUBY_PLATFORM =~ /mswin/
|
48
49
|
# Of course MS Windows has to be different
|
49
|
-
HOME_DIR = (ENV['HOME'] ||
|
50
|
+
HOME_DIR = (ENV['HOME'] ||
|
50
51
|
ENV['HOMEDRIVE'].to_s + ENV['HOMEPATH'].to_s).to_s
|
51
52
|
'trepan.ini'
|
52
53
|
else
|
data/app/markdown.rb
ADDED
@@ -0,0 +1,191 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# Copyright (C) 2015 Rocky Bernstein <rockyb@rubyforge.net>
|
3
|
+
|
4
|
+
begin require 'term/ansicolor'; rescue LoadError; end
|
5
|
+
require 'redcarpet'
|
6
|
+
require 'redcarpet/render_strip'
|
7
|
+
|
8
|
+
module Redcarpet
|
9
|
+
|
10
|
+
module Render
|
11
|
+
|
12
|
+
class Terminal < StripDown
|
13
|
+
|
14
|
+
attr_accessor :width
|
15
|
+
attr_accessor :try_ansi
|
16
|
+
|
17
|
+
def strip_term_sequence(text)
|
18
|
+
# to be completed...
|
19
|
+
text
|
20
|
+
end
|
21
|
+
|
22
|
+
# reflow text so lines are not
|
23
|
+
# longer than @width. prefix
|
24
|
+
# is used only after the first line
|
25
|
+
# as this is what we want in lists.
|
26
|
+
def reflow(text, prefix='')
|
27
|
+
lines = []
|
28
|
+
line_len = 0
|
29
|
+
line = ''
|
30
|
+
width = @width - prefix.size
|
31
|
+
text.split.each do |word|
|
32
|
+
word_size = strip_term_sequence(word).size
|
33
|
+
if (line_len + word_size) >= width
|
34
|
+
lines << line
|
35
|
+
line = prefix + word + ' '
|
36
|
+
line_len = prefix.size + word_size + 1
|
37
|
+
else
|
38
|
+
line += word + ' '
|
39
|
+
line_len += word_size + 1
|
40
|
+
end
|
41
|
+
end
|
42
|
+
lines << line
|
43
|
+
lines.join("\n") + "\n"
|
44
|
+
end
|
45
|
+
|
46
|
+
def ansi?
|
47
|
+
defined?(Term::ANSIColor) and try_ansi
|
48
|
+
end
|
49
|
+
|
50
|
+
def header(title, level)
|
51
|
+
if ansi?
|
52
|
+
Term::ANSIColor.bold + title + Term::ANSIColor.reset + "\n\n"
|
53
|
+
else
|
54
|
+
sep = (level == 1) ? '=' : '-'
|
55
|
+
title + "\n" + (sep * title.size) + "\n"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def codespan(text)
|
60
|
+
if ansi?
|
61
|
+
Term::ANSIColor.underline + text + Term::ANSIColor.reset + "\n"
|
62
|
+
else
|
63
|
+
"'" + text + "'"
|
64
|
+
end
|
65
|
+
end
|
66
|
+
def triple_emphasis(text)
|
67
|
+
if ansi?
|
68
|
+
Term::ANSIColor.bold + text + Term::ANSIColor.reset
|
69
|
+
else
|
70
|
+
'***' + text + '***'
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def block_code(code, lang)
|
75
|
+
code + "\n"
|
76
|
+
end
|
77
|
+
|
78
|
+
def double_emphasis(text)
|
79
|
+
if ansi?
|
80
|
+
Term::ANSIColor.bold + text + Term::ANSIColor.reset
|
81
|
+
else
|
82
|
+
'**' + text + '**'
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
def emphasis(text)
|
87
|
+
if ansi?
|
88
|
+
Term::ANSIColor.italic + text + Term::ANSIColor.reset
|
89
|
+
else
|
90
|
+
'*' + text + '*'
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
def underline(text)
|
95
|
+
if ansi?
|
96
|
+
Term::ANSIColor.italic + text + Term::ANSIColor.reset
|
97
|
+
else
|
98
|
+
'_' + text + '_'
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
def strikethrough(text)
|
103
|
+
if ansi?
|
104
|
+
Term::ANSIColor.striketrhough + text + Term::ANSIColor.reset
|
105
|
+
else
|
106
|
+
'_' + text + '_'
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
def linebreak
|
111
|
+
"\n"
|
112
|
+
end
|
113
|
+
|
114
|
+
def paragraph(text)
|
115
|
+
reflow(text) + "\n"
|
116
|
+
end
|
117
|
+
|
118
|
+
def list(content, list_type)
|
119
|
+
case list_type
|
120
|
+
when :ordered
|
121
|
+
@list_count = 0
|
122
|
+
"#{content}\n"
|
123
|
+
when :unordered
|
124
|
+
"\n#{content}\n"
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
def list_item(content, list_type)
|
129
|
+
prefix = ''
|
130
|
+
case list_type
|
131
|
+
when :ordered
|
132
|
+
@list_count ||= 0
|
133
|
+
@list_count += 1
|
134
|
+
prefix = "#{@list_count}. "
|
135
|
+
when :unordered
|
136
|
+
prefix = "* "
|
137
|
+
end
|
138
|
+
text = reflow(content, ' ' * prefix.size)
|
139
|
+
text += "\n" if text =~ /\n./
|
140
|
+
prefix + text
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
class Trepan
|
147
|
+
module Markdown
|
148
|
+
def render(text, width=80, try_ansi=true)
|
149
|
+
@renderer ||= Redcarpet::Render::Terminal.new()
|
150
|
+
@renderer.width = width
|
151
|
+
@renderer.try_ansi = try_ansi
|
152
|
+
@markdown ||= Redcarpet::Markdown.new(@renderer, extensions = {})
|
153
|
+
@markdown.render(text)
|
154
|
+
end
|
155
|
+
module_function :render
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
if __FILE__ == $0
|
160
|
+
include Trepan::Markdown
|
161
|
+
string = <<EOF
|
162
|
+
# HI
|
163
|
+
This is a paragraph
|
164
|
+
|
165
|
+
**This** is another *paragraph*.
|
166
|
+
EOF
|
167
|
+
[[80, true],
|
168
|
+
[80, false],
|
169
|
+
[15, true],
|
170
|
+
[15, false]].each do | width, try_ansi|
|
171
|
+
puts render(string, width, try_ansi)
|
172
|
+
puts '-' * 60
|
173
|
+
end
|
174
|
+
puts
|
175
|
+
string = <<EOF
|
176
|
+
If the first non-blank character of a line starts with `#`,
|
177
|
+
the command is ignored.
|
178
|
+
|
179
|
+
* first
|
180
|
+
* second
|
181
|
+
* third
|
182
|
+
|
183
|
+
1. first
|
184
|
+
1. second
|
185
|
+
1. third
|
186
|
+
|
187
|
+
## See also
|
188
|
+
foo
|
189
|
+
EOF
|
190
|
+
puts render(string, 50, false)
|
191
|
+
end
|
data/app/options.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# -*- coding: utf-8 -*-
|
3
|
-
# Copyright (C) 2010,
|
3
|
+
# Copyright (C) 2010-2011, 2013, 2015 Rocky Bernstein <rockyb@rubyforge.net>
|
4
4
|
#=== Summary
|
5
|
-
# Parses command-line options.
|
5
|
+
# Parses command-line options.
|
6
6
|
|
7
7
|
require 'optparse'
|
8
8
|
class Trepan
|
9
9
|
require_relative 'default'
|
10
10
|
|
11
|
-
VERSION = '
|
11
|
+
VERSION = '1.93.32'
|
12
12
|
PROGRAM = 'trepan'
|
13
13
|
|
14
14
|
def self.show_version
|
@@ -18,7 +18,7 @@ class Trepan
|
|
18
18
|
def self.copy_default_options
|
19
19
|
options = {}
|
20
20
|
DEFAULT_CMDLINE_SETTINGS.each do |key, value|
|
21
|
-
begin
|
21
|
+
begin
|
22
22
|
options[key] = value.clone
|
23
23
|
rescue TypeError
|
24
24
|
options[key] = value
|
@@ -28,106 +28,111 @@ class Trepan
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def self.setup_options(options, stdout=$stdout, stderr=$stderr)
|
31
|
-
|
32
|
-
|
31
|
+
options[:highlight] = :term
|
32
|
+
OptionParser.new do |opts|
|
33
|
+
opts.banner = <<EOB
|
33
34
|
#{show_version}
|
34
35
|
Usage: #{PROGRAM} [options] [[--] <script.rb> <script.rb parameters>]
|
35
36
|
EOB
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
37
|
+
opts.separator ''
|
38
|
+
opts.separator 'Options:'
|
39
|
+
opts.on('--basename',
|
40
|
+
'Show basename only on source file listings') do
|
41
|
+
options[:basename] = true
|
42
|
+
end
|
43
|
+
opts.on('--client',
|
44
|
+
'Connect to out-of-process program') do
|
45
|
+
if options[:server]
|
46
|
+
stderr.puts '--server option previously given. --client option ignored.'
|
47
|
+
else
|
48
|
+
options[:client] = true
|
49
|
+
end
|
50
|
+
end
|
51
|
+
opts.on('-c', '--command FILE', String,
|
52
|
+
'Execute debugger commands from FILE') do |cmdfile|
|
53
|
+
if File.readable?(cmdfile)
|
54
|
+
options[:cmdfiles] << cmdfile
|
55
|
+
elsif File.exists?(cmdfile)
|
56
|
+
stderr.puts "Command file '#{cmdfile}' is not readable. Option ignored."
|
57
|
+
else
|
58
|
+
stderr.puts "Command file '#{cmdfile}' does not exist."
|
59
|
+
end
|
60
|
+
end
|
61
|
+
opts.on('--cd DIR', String, 'Change current directory to DIR') do |dir|
|
62
|
+
if File.directory?(dir)
|
63
|
+
if File.executable?(dir)
|
64
|
+
options[:chdir] = dir
|
65
|
+
else
|
66
|
+
stderr.puts "Can't cd to #{dir}. Option --cd ignored."
|
67
|
+
end
|
68
|
+
else
|
69
|
+
stderr.puts "\"#{dir}\" is not a directory. Option --cd ignored."
|
70
|
+
end
|
71
|
+
end
|
72
|
+
opts.on('-d', '--debug', "Set $DEBUG=true") {$DEBUG = true}
|
73
|
+
opts.on('--[no-]highlight',
|
74
|
+
'Use [no] syntax highlight output') do |v|
|
75
|
+
options[:highlight] = ((v) ? :term : nil)
|
76
|
+
end
|
77
|
+
opts.on('-h', '--host NAME', String,
|
78
|
+
'Host or IP used in TCP connections for --server or --client. ' +
|
79
|
+
"Default is #{DEFAULT_SETTINGS[:host].inspect}.") do
|
80
|
+
|name_or_ip|
|
81
|
+
options[:host] = name_or_ip
|
82
|
+
end
|
83
|
+
opts.on('-I', '--include PATH', String, 'Add PATH to $LOAD_PATH') do
|
84
|
+
|path|
|
85
|
+
$LOAD_PATH.unshift(path)
|
86
|
+
end
|
87
|
+
opts.on('--nx',
|
88
|
+
"Do not run debugger initialization file #{CMD_INITFILE}") do
|
89
|
+
options[:nx] = true
|
90
|
+
end
|
91
|
+
opts.on('-p', '--port NUMBER', Integer,
|
92
|
+
'Port number used in TCP connections for --server or --client. ' +
|
93
|
+
"Default is #{DEFAULT_SETTINGS[:port]}.") do
|
94
|
+
|num|
|
95
|
+
options[:port] = num
|
96
|
+
end
|
97
|
+
# opts.on('-m', '--post-mortem', 'Activate post-mortem mode') do
|
98
|
+
# options[:post_mortem] = true
|
99
|
+
# end
|
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
|
114
|
+
if options[:client]
|
115
|
+
stderr.puts '--client option previously given. --server option ignored.'
|
116
|
+
else
|
117
|
+
options[:server] = true
|
118
|
+
end
|
119
|
+
end
|
120
|
+
opts.on('-x', '--trace', 'Turn on line tracing') do
|
121
|
+
options[:traceprint] = true
|
122
|
+
options[:nx] = true
|
123
|
+
end
|
124
|
+
opts.separator ''
|
125
|
+
opts.on_tail('-?', '--help', 'Show this message') do
|
126
|
+
options[:help] = true
|
127
|
+
stdout.puts opts
|
128
|
+
exit
|
129
|
+
end
|
130
|
+
opts.on_tail('-v', '--version',
|
131
|
+
'print the version') do
|
132
|
+
options[:version] = true
|
133
|
+
stdout.puts show_version
|
62
134
|
end
|
63
|
-
else
|
64
|
-
stderr.puts "\"#{dir}\" is not a directory. Option --cd ignored."
|
65
|
-
end
|
66
|
-
end
|
67
|
-
opts.on('-d', '--debug', "Set $DEBUG=true") {$DEBUG = true}
|
68
|
-
opts.on('--[no-]highlight',
|
69
|
-
'Use [no] syntax highlight output') do |v|
|
70
|
-
options[:highlight] = ((v) ? :term : nil)
|
71
|
-
end
|
72
|
-
opts.on('-h', '--host NAME', String,
|
73
|
-
'Host or IP used in TCP connections for --server or --client. ' +
|
74
|
-
"Default is #{DEFAULT_SETTINGS[:host].inspect}.") do
|
75
|
-
|name_or_ip|
|
76
|
-
options[:host] = name_or_ip
|
77
|
-
end
|
78
|
-
opts.on('-I', '--include PATH', String, 'Add PATH to $LOAD_PATH') do
|
79
|
-
|path|
|
80
|
-
$LOAD_PATH.unshift(path)
|
81
|
-
end
|
82
|
-
opts.on('--nx',
|
83
|
-
"Do not run debugger initialization file #{CMD_INITFILE}") do
|
84
|
-
options[:nx] = true
|
85
|
-
end
|
86
|
-
opts.on('-p', '--port NUMBER', Integer,
|
87
|
-
'Port number used in TCP connections for --server or --client. ' +
|
88
|
-
"Default is #{DEFAULT_SETTINGS[:port]}.") do
|
89
|
-
|num|
|
90
|
-
options[:port] = num
|
91
|
-
end
|
92
|
-
# opts.on('-m', '--post-mortem', 'Activate post-mortem mode') do
|
93
|
-
# options[:post_mortem] = true
|
94
|
-
# end
|
95
|
-
opts.on('--[no-]readline',
|
96
|
-
'Try [not] GNU Readline') do |v|
|
97
|
-
options[:readline] = v
|
98
|
-
end
|
99
|
-
opts.on('-r', '--require SCRIPT', String,
|
100
|
-
'Require the library, before executing your script') do |name|
|
101
|
-
if name == 'debug'
|
102
|
-
stderr.puts "ruby-debug is not compatible with Ruby's 'debug' library. This option is ignored."
|
103
|
-
else
|
104
|
-
require name
|
105
|
-
end
|
106
|
-
end
|
107
|
-
opts.on('-s', '--server',
|
108
|
-
'Set up for out-of-process debugging') do
|
109
|
-
if options[:client]
|
110
|
-
stderr.puts '--client option previously given. --server option ignored.'
|
111
|
-
else
|
112
|
-
options[:server] = true
|
113
|
-
end
|
114
|
-
end
|
115
|
-
opts.on('-x', '--trace', 'Turn on line tracing') do
|
116
|
-
options[:traceprint] = true
|
117
|
-
options[:nx] = true
|
118
|
-
end
|
119
|
-
opts.separator ''
|
120
|
-
opts.on_tail('-?', '--help', 'Show this message') do
|
121
|
-
options[:help] = true
|
122
|
-
stdout.puts opts
|
123
|
-
exit
|
124
|
-
end
|
125
|
-
opts.on_tail('-v', '--version',
|
126
|
-
'print the version') do
|
127
|
-
options[:version] = true
|
128
|
-
stdout.puts show_version
|
129
135
|
end
|
130
|
-
end
|
131
136
|
end
|
132
137
|
end
|
133
138
|
|