trepanning 0.0.9 → 0.1.0

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.
Files changed (108) hide show
  1. data/ChangeLog +237 -0
  2. data/NEWS +8 -0
  3. data/Rakefile +3 -2
  4. data/app/breakpoint.rb +8 -8
  5. data/app/brkptmgr.rb +86 -85
  6. data/app/client.rb +60 -0
  7. data/app/core.rb-consider +198 -0
  8. data/app/default.rb +17 -7
  9. data/app/disassemble.rb +12 -2
  10. data/app/options.rb +51 -20
  11. data/app/yarv.rb +183 -0
  12. data/bin/trepan +15 -9
  13. data/data/custom_require.rb +44 -0
  14. data/data/irbrc +41 -0
  15. data/data/prelude.rb +38 -0
  16. data/interface/base_intf.rb +10 -4
  17. data/interface/client.rb +79 -0
  18. data/interface/comcodes.rb +18 -0
  19. data/interface/server.rb +142 -0
  20. data/io/base_io.rb +57 -3
  21. data/io/tcpclient.rb +122 -0
  22. data/io/tcpfns.rb +31 -0
  23. data/io/tcpserver.rb +137 -0
  24. data/lib/trepanning.rb +57 -28
  25. data/processor/command/base/cmd.rb +10 -6
  26. data/processor/command/base/subcmd.rb +13 -1
  27. data/processor/command/directory.rb +15 -8
  28. data/processor/command/disassemble.rb +3 -2
  29. data/processor/command/help.rb +71 -19
  30. data/processor/command/info_subcmd/args.rb +2 -3
  31. data/processor/command/info_subcmd/breakpoints.rb +2 -3
  32. data/processor/command/info_subcmd/file.rb +2 -3
  33. data/processor/command/info_subcmd/frame.rb +2 -3
  34. data/processor/command/info_subcmd/iseq.rb +4 -5
  35. data/processor/command/info_subcmd/locals.rb +2 -3
  36. data/processor/command/info_subcmd/program.rb +2 -3
  37. data/processor/command/info_subcmd/registers.rb +2 -3
  38. data/processor/command/info_subcmd/return.rb +2 -3
  39. data/processor/command/info_subcmd/thread.rb +2 -3
  40. data/processor/command/list.rb +10 -6
  41. data/processor/command/reload.rb +1 -1
  42. data/processor/command/reload_subcmd/command.rb +29 -16
  43. data/processor/command/server.rb +70 -0
  44. data/processor/command/set_subcmd/auto.rb +2 -3
  45. data/processor/command/set_subcmd/basename.rb +2 -3
  46. data/processor/command/set_subcmd/debug.rb +2 -3
  47. data/processor/command/set_subcmd/different.rb +2 -3
  48. data/processor/command/set_subcmd/events.rb +2 -3
  49. data/processor/command/set_subcmd/hidelevel.rb +6 -7
  50. data/processor/command/set_subcmd/highlight.rb +32 -0
  51. data/processor/command/set_subcmd/max.rb +2 -3
  52. data/processor/command/set_subcmd/return.rb +2 -3
  53. data/processor/command/set_subcmd/sp.rb +2 -3
  54. data/processor/command/set_subcmd/substitute.rb +2 -3
  55. data/processor/command/set_subcmd/timer.rb +2 -3
  56. data/processor/command/set_subcmd/trace.rb +3 -4
  57. data/processor/command/show_subcmd/alias.rb +3 -3
  58. data/processor/command/show_subcmd/args.rb +2 -3
  59. data/processor/command/show_subcmd/auto.rb +1 -2
  60. data/processor/command/show_subcmd/basename.rb +2 -3
  61. data/processor/command/show_subcmd/debug.rb +1 -2
  62. data/processor/command/show_subcmd/different.rb +2 -1
  63. data/processor/command/show_subcmd/events.rb +2 -2
  64. data/processor/command/show_subcmd/hidelevel.rb +2 -3
  65. data/processor/command/show_subcmd/highlight.rb +23 -0
  66. data/processor/command/show_subcmd/macro.rb +2 -1
  67. data/processor/command/show_subcmd/max.rb +2 -3
  68. data/processor/command/show_subcmd/trace.rb +2 -3
  69. data/processor/command/source.rb +78 -28
  70. data/processor/default.rb +3 -2
  71. data/processor/load_cmds.rb +39 -19
  72. data/processor/location.rb +11 -7
  73. data/processor/main.rb +31 -15
  74. data/processor/mock.rb +22 -7
  75. data/processor/msg.rb +24 -8
  76. data/test/data/fname-with-blank.right +3 -0
  77. data/test/data/quit.right +2 -0
  78. data/test/functional/test-break-long.rb +87 -0
  79. data/test/functional/tmp/b3.rb +5 -0
  80. data/test/functional/tmp/immediate-bug1.rb +9 -0
  81. data/test/integration/helper.rb +14 -11
  82. data/test/integration/test-fname-with-blank.rb +5 -1
  83. data/test/integration/test-quit.rb +6 -2
  84. data/test/unit/cmd-helper.rb +9 -4
  85. data/test/unit/mock-helper.rb +9 -0
  86. data/test/unit/test-app-brkpt.rb +4 -4
  87. data/test/unit/test-app-brkptmgr.rb +2 -2
  88. data/test/unit/test-app-file.rb +0 -1
  89. data/test/unit/test-app-options.rb +26 -5
  90. data/test/unit/test-base-subcmd.rb +0 -1
  91. data/test/unit/test-cmd-alias.rb +0 -1
  92. data/test/unit/test-cmd-break.rb +0 -4
  93. data/test/unit/test-cmd-endisable.rb +1 -3
  94. data/test/unit/test-cmd-help.rb +0 -1
  95. data/test/unit/test-cmd-kill.rb +4 -5
  96. data/test/unit/test-cmd-quit.rb +4 -7
  97. data/test/unit/test-cmd-source.rb +33 -0
  98. data/test/unit/test-cmd-step.rb +0 -2
  99. data/test/unit/test-io-tcp.rb +32 -0
  100. data/test/unit/test-io-tcpclient.rb +53 -0
  101. data/test/unit/test-io-tcpserver.rb +49 -0
  102. data/test/unit/test-proc-main.rb +2 -2
  103. metadata +195 -175
  104. data/processor/command/stepi.rb +0 -63
  105. data/test/functional/tmp/b1.rb +0 -5
  106. data/test/functional/tmp/s1.rb +0 -9
  107. data/test/functional/tmp/t2.rb +0 -6
  108. data/test/integration/try-test-enable.rb +0 -11
@@ -0,0 +1,60 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (C) 2011 Rocky Bernstein <rockyb@rubyforge.net>
3
+ require_relative 'default' # default debugger settings
4
+ require_relative '../interface/comcodes' # communication codes
5
+
6
+ module Trepanning
7
+ include Trepanning::RemoteCommunication
8
+ def start_client(options)
9
+ puts "Client option given"
10
+ dbgr = Trepan.new(:client => true,
11
+ :cmdfiles => [],
12
+ :initial_dir => options[:chdir],
13
+ :nx => true,
14
+ :host => options[:host],
15
+ :port => options[:port]
16
+ )
17
+ intf = dbgr.intf[-1]
18
+ while true
19
+ begin
20
+ control_code, line = intf.read_remote
21
+ rescue EOFError, Errno::EPIPE
22
+ puts "Remote debugged process closed connection"
23
+ break
24
+ end
25
+ # p [control_code, line]
26
+ case control_code
27
+ when PRINT
28
+ print line
29
+ when CONFIRM_TRUE
30
+ response = intf.confirm(line, true)
31
+ intf.write_remote(CONFIRM_REPLY, response ? 'Y' : 'N')
32
+ when CONFIRM_FALSE
33
+ response = intf.confirm(line, true)
34
+ intf.write_remote(CONFIRM_REPLY, response ? 'Y' : 'N')
35
+ when PROMPT
36
+ # require 'trepanning'
37
+ # debugger
38
+ begin
39
+ command = intf.read_command(line)
40
+ rescue EOFError
41
+ puts "user-side EOF. Quitting..."
42
+ break
43
+ end
44
+ begin
45
+ intf.write_remote(COMMAND, command)
46
+ rescue Errno::EPIPE
47
+ puts "Remote debugged process died"
48
+ break
49
+ end
50
+ when QUIT
51
+ break
52
+ when RESTART
53
+ break
54
+ else
55
+ $stderr.puts "** Unknown control code: #{control_code}"
56
+ end
57
+ end
58
+ end
59
+ module_function :start_client
60
+ end
@@ -0,0 +1,198 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'thread_frame'
3
+ require 'trace'
4
+ # require_relative '../../rb-trace/app/trace'
5
+ require_relative '../processor/main'
6
+ class Debugger
7
+ # This class contains the Debugger core routines, such as an event
8
+ # processor which is responsible of handling what to do when an event is
9
+ # triggered.
10
+ #
11
+ # See also 'rdbgr' the top-level Debugger class and command-line routine
12
+ # which ultimately will call this.
13
+
14
+ class Core
15
+ attr_accessor :async_events # bitmask of asyncronous events - used all
16
+ # the time
17
+ attr_reader :dbgr # Debugger instance
18
+ attr_reader :event # String - event which triggering event
19
+ # processor
20
+ attr_reader :event_proc # Proc of method event_processor
21
+ attr_accessor :exception # Return exception to pass back. A 'raise'
22
+ # command can set this.
23
+ attr_reader :frame # ThreadFrame instance
24
+ attr_reader :hook_arg # 'arg' passed from trace hook
25
+ attr_accessor :mutex # mutex to lock out other threads from
26
+ # entering debugger while we are in it.
27
+ attr_accessor :processor # Debugger::CmdProc instance
28
+ attr_reader :settings # Hash of things you can configure
29
+ attr_accessor :step_count # Fixnum. Negative means no tracing,
30
+ # 0 means stop on next event, 1 means
31
+ # ignore one event. Step events gives the
32
+ # kind of things to count as a step.
33
+ attr_accessor :step_events # bitmask of events - used only when
34
+ # we are stepping
35
+ attr_accessor :unmaskable_events
36
+
37
+ include Trace
38
+
39
+ unless defined?(CORE_DEFAULT_SETTINGS)
40
+ # Synchronous events
41
+ STEPPING_EVENT_MASK =
42
+ LINE_EVENT_MASK | CLASS_EVENT_MASK | CALL_EVENT_MASK |
43
+ RETURN_EVENT_MASK | C_CALL_EVENT_MASK | C_RETURN_EVENT_MASK |
44
+ INSN_EVENT_MASK | BRKPT_EVENT_MASK
45
+
46
+ ASYNC_EVENT_MASK =
47
+ RAISE_EVENT_MASK | VM_EVENT_MASK | SWITCH_EVENT_MASK
48
+
49
+ CORE_DEFAULT_SETTINGS = {
50
+ :cmdproc_opts => {},
51
+ :debug_core_events => false,
52
+ :hook_name => :event_processor, # or :old_event_processor
53
+ :step_count => 0, # Stop at next event
54
+ :async_events => ASYNC_EVENT_MASK,
55
+
56
+ # FIXME:
57
+ # Somewhere inside the VM we allow I guess nested tracing which is messing
58
+ # up ThreadFrame pointers and information. When this is fixed we can do the below.
59
+ # Until then we need to at least remove C calls and returns and possibly other
60
+ # events as well.
61
+ # :step_events =>
62
+ # (DEFAULT_EVENT_MASK | INSN_EVENT_MASK)
63
+
64
+ :step_events =>
65
+ (DEFAULT_EVENT_MASK | INSN_EVENT_MASK) &
66
+ ~(C_CALL_EVENT_MASK | C_RETURN_EVENT_MASK)
67
+ }
68
+
69
+ end
70
+
71
+ def initialize(debugger, settings={})
72
+ @dbgr = debugger
73
+ @exception = nil
74
+ @mutex = Mutex.new
75
+ @settings = CORE_DEFAULT_SETTINGS.merge(settings)
76
+
77
+ @step_count = @settings[:step_count]
78
+ @step_events = @settings[:step_events]
79
+ @async_events = @settings[:async_events]
80
+ @debug_events = @settings[:debug_core_events]
81
+
82
+ hook_name = @settings[:hook_name]
83
+ @event_proc = self.method(hook_name).to_proc
84
+ @processor = CmdProcessor.new(self, @settings[:cmdproc_opts])
85
+ @unmaskable_events = %w(brkpt raise switch vm)
86
+ end
87
+
88
+ def step_events_list
89
+ if 0 == @step_events
90
+ return nil
91
+ else
92
+ Trace.bitmask2events(@step_events).join(', ')
93
+ end
94
+ end
95
+
96
+ # A trace-hook processor with the interface a trace hook should have.
97
+ def event_processor(event, frame, arg=nil)
98
+
99
+ return_exception = nil
100
+ # FIXME: check for breakpoints or other unmaskable events.
101
+ # For now there are none.
102
+
103
+ @mutex.synchronize do
104
+ @frame = frame
105
+ while @frame.type == 'IFUNC'
106
+ @frame = @frame.prev
107
+ end
108
+
109
+ if @step_count > 0
110
+ @step_count -= 1
111
+ break
112
+ elsif @step_count < 0 && ! @unmaskable_events.member?(event)
113
+ break
114
+ end
115
+
116
+ @event = event
117
+ @hook_arg = arg
118
+
119
+ ### debug:
120
+ ### puts "#{frame.source_container[1]}:#{frame.source_location[0]}:in `#{frame.method}' #{event}" # if %w(line).member?(event)
121
+ @processor.process_commands(@frame)
122
+
123
+ # FIXME: There should be a Trace.event_mask which should return the first
124
+ # mask that matches the given trace hook.
125
+ if @step_count < 0
126
+ # If we are continuing, no need to stop at stepping events.
127
+ Trace.event_masks[0] &= ~STEPPING_EVENT_MASK
128
+ else
129
+ # Set to trace only those events we are interested in.
130
+
131
+ # Don't step/trace into Ruby routines called from here in the code
132
+ # below (e.g. "trace_hooks").
133
+ th = Thread.current
134
+ exec_event_tracing_old = th.exec_event_tracing
135
+ th.exec_event_tracing = true
136
+
137
+ # FIXME: this doesn't work. Bug in rb-trace?
138
+ # Trace.event_masks[0] = @step_events | @async_events
139
+ RubyVM::TraceHook::trace_hooks[0].event_mask =
140
+ @step_events | @async_events
141
+ th.exec_event_tracing = exec_event_tracing_old
142
+ end
143
+
144
+ # Nil out variables just in case...
145
+
146
+ return_exception = @exception
147
+ @frame = @event = @arg = @exception = nil
148
+
149
+ end
150
+ return return_exception
151
+ end
152
+
153
+ # A Ruby 1.8-style event processor. We don't use file, line, id, bind.
154
+ def old_event_processor(event, file, line, id, bind, klass)
155
+ event_processor(event, RubyVM::ThreadFrame.current.prev)
156
+ end
157
+
158
+ # Call this from inside the program you want to get a synchronous
159
+ # call to the debugger. set prev_count to the number of levels
160
+ # *before* the caller you want to skip.
161
+ def debugger(prev_count=0)
162
+ while @frame && @frame.type == 'IFUNC'
163
+ @frame = @frame.prev
164
+ end
165
+ frame = RubyVM::ThreadFrame.current.prev(prev_count+1)
166
+ @step_count = 0 # Make event processor stop
167
+ event_processor('debugger-call', frame)
168
+ end
169
+
170
+ # A trace-hook processor for 'trace var'
171
+ def trace_var_processor(val)
172
+ frame = RubyVM::ThreadFrame.current.prev
173
+ if 'CFUNC' == frame.type
174
+ # Don't need the C call that got us here.
175
+ prev = frame.prev
176
+ frame = frame.prev if prev
177
+ end
178
+
179
+ # Stop future tracing into the debugger
180
+ Thread.current.tracing = true
181
+
182
+ @step_count = 0 # Make event processor stop
183
+ event_processor('trace-var', frame)
184
+ end
185
+
186
+ end
187
+ end
188
+ if __FILE__ == $0
189
+ require_relative '../lib/trepan'
190
+ dbg = Debugger.new()
191
+ if ARGV.size > 0
192
+ def foo(dbg)
193
+ p 'foo here'
194
+ dbg.debugger(:immediate=>true)
195
+ end
196
+ foo(dbg)
197
+ end
198
+ end
@@ -1,8 +1,6 @@
1
- # Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
1
+ # Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
2
2
  # A place for the default settings
3
- # This could be put elsewhere but it is expected that this will grow
4
- # get quite large.
5
- module Trepanning
3
+ class Trepan
6
4
 
7
5
  # I am not sure if we need to sets of hashes, but we'll start out
8
6
  # that way.
@@ -14,16 +12,28 @@ module Trepanning
14
12
  :delete_restore => true, # Delete restore profile after reading?
15
13
  :initial_dir => nil, # If --cd option was given, we save it here.
16
14
  :nx => false, # Don't run user startup file (e.g. .trepanrc)
15
+
16
+ # Default values used only when 'server' or 'client'
17
+ # (out-of-process debugging)
18
+ :port => 1955,
19
+ :host => 'localhost',
20
+
17
21
  :restart_argv => RubyVM::OS_ARGV,
18
22
  # Command run when "restart" is given.
19
- :restore_profile => nil # Profile used to set/restore debugger state
23
+ :restore_profile => nil, # Profile used to set/restore debugger state
24
+ :server => false, # Out-of-process debugging?
20
25
  } unless defined?(DEFAULT_SETTINGS)
21
26
 
22
27
  # Default settings for Trepan run from the command line.
23
28
  DEFAULT_CMDLINE_SETTINGS = {
24
29
  :cmdfiles => [], # Initialization command files to run
30
+ :client => false, # Attach to out-of-process program?
25
31
  :nx => false, # Don't run user startup file (e.g. .trepanrc)
26
32
  :output => nil,
33
+ :port => DEFAULT_SETTINGS[:port],
34
+ :host => DEFAULT_SETTINGS[:host],
35
+ :server => false, # Out-of-process debugging?
36
+ # Note that at most one of :server or :client can be true.
27
37
  } unless defined?(DEFAULT_CMDLINE_SETTINGS)
28
38
 
29
39
  DEFAULT_DEBUG_STR_SETTINGS = {
@@ -49,7 +59,7 @@ end
49
59
  if __FILE__ == $0
50
60
  # Show it:
51
61
  require 'pp'
52
- PP.pp(Trepanning::DEFAULT_SETTINGS)
62
+ PP.pp(Trepan::DEFAULT_SETTINGS)
53
63
  puts '=' * 30
54
- PP.pp(Trepanning::DEFAULT_CMDLINE_SETTINGS)
64
+ PP.pp(Trepan::DEFAULT_CMDLINE_SETTINGS)
55
65
  end
@@ -7,7 +7,13 @@
7
7
  class Trepan
8
8
  module Disassemble
9
9
  def mark_disassembly(disassembly_str, iseq_equal, pc_offset,
10
- brkpt_offsets=[], max_width=80)
10
+ brkpt_offsets=[], max_width=80, highlight=nil)
11
+
12
+ if highlight
13
+ require_relative '../app/yarv'
14
+ highlighter = CodeRay::Duo[:yarv, :term]
15
+ end
16
+
11
17
  dis_array = disassembly_str.split(/\n/)
12
18
  dis_array.map do |line|
13
19
  if line =~ /^(.*?)(\s+)(\(\s+\d+\))?$/
@@ -37,7 +43,11 @@ class Trepan
37
43
  if (shrink_amount > 0) && line_padding.size > shrink_amount
38
44
  line_padding = ' ' * (line_padding.size - shrink_amount)
39
45
  end
40
- prefix + line_begin + line_padding + line_end
46
+ if highlight && prefix != ''
47
+ prefix + highlighter.encode(line_begin + line_padding + line_end)
48
+ else
49
+ prefix + line_begin + line_padding + line_end
50
+ end
41
51
  end
42
52
  end
43
53
  module_function :mark_disassembly
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  # -*- coding: utf-8 -*-
3
- # Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
3
+ # Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
4
4
  #=== Summary
5
5
  # Parses command-line options.
6
6
  #=== Options
@@ -26,17 +26,17 @@
26
26
  # Show invocation help and exit.
27
27
 
28
28
  require 'optparse'
29
- module Trepanning
29
+ class Trepan
30
30
  require_relative 'default'
31
31
 
32
- Trepanning::VERSION = '0.0.4.git' unless defined?(Trepanning::VERSION)
33
- Trepanning::PROGRAM = 'trepan' unless defined?(Rbdbgr::PROGRAM)
32
+ Trepan::VERSION = '0.1.0'
33
+ Trepan::PROGRAM = 'trepan'
34
34
 
35
- def show_version
36
- "#{PROGRAM} version #{VERSION}"
35
+ def self.show_version
36
+ "#{PROGRAM}, version #{VERSION}"
37
37
  end
38
38
 
39
- def copy_default_options
39
+ def self.copy_default_options
40
40
  options = {}
41
41
  DEFAULT_CMDLINE_SETTINGS.each do |key, value|
42
42
  begin
@@ -48,18 +48,26 @@ module Trepanning
48
48
  options
49
49
  end
50
50
 
51
- def setup_options(options, stdout=$stdout, stderr=$stderr)
51
+ def self.setup_options(options, stdout=$stdout, stderr=$stderr)
52
52
  OptionParser.new do |opts|
53
53
  opts.banner = <<EOB
54
54
  #{show_version}
55
55
  Usage: #{PROGRAM} [options] <script.rb> -- <script.rb parameters>
56
56
  EOB
57
- opts.on('--command FILE', String,
58
- "Execute debugger commnds from FILE") do |cmdfile|
57
+ opts.on('--client',
58
+ "Connect to out-of-process program") do
59
+ if options[:server]
60
+ stderr.puts "--server option previously given. --client option ignored."
61
+ else
62
+ options[:client] = true
63
+ end
64
+ end
65
+ opts.on('-c', '--command FILE', String,
66
+ "Execute debugger commands from FILE") do |cmdfile|
59
67
  if File.readable?(cmdfile)
60
68
  options[:cmdfiles] << cmdfile
61
69
  elsif File.exists?(cmdfile)
62
- stderr.puts "Command file '#{cmdfile}' is not readable."
70
+ stderr.puts "Command file '#{cmdfile}' is not readable. Option ignored."
63
71
  else
64
72
  stderr.puts "Command file '#{cmdfile}' does not exist."
65
73
  end
@@ -82,6 +90,18 @@ EOB
82
90
  stderr.puts "\"#{dir}\" is not a directory. Option --cd ignored."
83
91
  end
84
92
  end
93
+ opts.on("-h", "--host NAME", String,
94
+ "Host or IP used in TCP connections for --server or --client. " +
95
+ "Default is #{DEFAULT_SETTINGS[:host].inspect}.") do
96
+ |name_or_ip|
97
+ options[:host] = name_or_ip
98
+ end
99
+ opts.on("-p", "--port NUMBER", Integer,
100
+ "Port number used in TCP connections for --server or --client. " +
101
+ "Default is #{DEFAULT_SETTINGS[:port]}.") do
102
+ |num|
103
+ options[:port] = num
104
+ end
85
105
  opts.on("--restore PROFILE", String,
86
106
  "Restore debugger state using PROFILE") do |profile|
87
107
  if File.readable?(profile)
@@ -89,11 +109,23 @@ EOB
89
109
  stderr.puts "Debugger command file #{profile} is not readable. --restore option ignored."
90
110
  end
91
111
  end
92
- opts.on_tail("--help", "Show this message") do
112
+ opts.on('--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('--[no-]highlight',
121
+ "Set output for terminal highlighting") do |v|
122
+ options[:highlight] = ((v) ? :term : nil)
123
+ end
124
+ opts.on_tail("-?", "--help", "Show this message") do
93
125
  options[:help] = true
94
126
  stdout.puts opts
95
127
  end
96
- opts.on_tail("--version",
128
+ opts.on_tail("-v", "--version",
97
129
  "print the version") do
98
130
  options[:version] = true
99
131
  stdout.puts show_version
@@ -103,20 +135,19 @@ EOB
103
135
  end
104
136
 
105
137
  if __FILE__ == $0
106
- include Rbdbgr
107
138
  opts = {}
108
139
  options ={}
109
140
  [%w(--help), %w(--version)].each do |o|
110
- options = copy_default_options
111
- opts = setup_options(options)
141
+ options = Trepan::copy_default_options
142
+ opts = Trepan::setup_options(options)
112
143
  rest = opts.parse o
113
- puts options
144
+ p options
114
145
  puts '=' * 10
115
146
  end
116
147
  rest = opts.parse! ARGV
117
- puts opts.to_s
148
+ puts opts
118
149
  puts '=' * 10
119
- puts options
150
+ p options
120
151
  puts '=' * 10
121
- puts Rbdbgr::DEFAULT_CMDLINE_SETTINGS
152
+ p Trepan::DEFAULT_CMDLINE_SETTINGS
122
153
  end