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.
- data/ChangeLog +237 -0
- data/NEWS +8 -0
- data/Rakefile +3 -2
- data/app/breakpoint.rb +8 -8
- data/app/brkptmgr.rb +86 -85
- data/app/client.rb +60 -0
- data/app/core.rb-consider +198 -0
- data/app/default.rb +17 -7
- data/app/disassemble.rb +12 -2
- data/app/options.rb +51 -20
- data/app/yarv.rb +183 -0
- data/bin/trepan +15 -9
- data/data/custom_require.rb +44 -0
- data/data/irbrc +41 -0
- data/data/prelude.rb +38 -0
- data/interface/base_intf.rb +10 -4
- data/interface/client.rb +79 -0
- data/interface/comcodes.rb +18 -0
- data/interface/server.rb +142 -0
- data/io/base_io.rb +57 -3
- data/io/tcpclient.rb +122 -0
- data/io/tcpfns.rb +31 -0
- data/io/tcpserver.rb +137 -0
- data/lib/trepanning.rb +57 -28
- data/processor/command/base/cmd.rb +10 -6
- data/processor/command/base/subcmd.rb +13 -1
- data/processor/command/directory.rb +15 -8
- data/processor/command/disassemble.rb +3 -2
- data/processor/command/help.rb +71 -19
- data/processor/command/info_subcmd/args.rb +2 -3
- data/processor/command/info_subcmd/breakpoints.rb +2 -3
- data/processor/command/info_subcmd/file.rb +2 -3
- data/processor/command/info_subcmd/frame.rb +2 -3
- data/processor/command/info_subcmd/iseq.rb +4 -5
- data/processor/command/info_subcmd/locals.rb +2 -3
- data/processor/command/info_subcmd/program.rb +2 -3
- data/processor/command/info_subcmd/registers.rb +2 -3
- data/processor/command/info_subcmd/return.rb +2 -3
- data/processor/command/info_subcmd/thread.rb +2 -3
- data/processor/command/list.rb +10 -6
- data/processor/command/reload.rb +1 -1
- data/processor/command/reload_subcmd/command.rb +29 -16
- data/processor/command/server.rb +70 -0
- data/processor/command/set_subcmd/auto.rb +2 -3
- data/processor/command/set_subcmd/basename.rb +2 -3
- data/processor/command/set_subcmd/debug.rb +2 -3
- data/processor/command/set_subcmd/different.rb +2 -3
- data/processor/command/set_subcmd/events.rb +2 -3
- data/processor/command/set_subcmd/hidelevel.rb +6 -7
- data/processor/command/set_subcmd/highlight.rb +32 -0
- data/processor/command/set_subcmd/max.rb +2 -3
- data/processor/command/set_subcmd/return.rb +2 -3
- data/processor/command/set_subcmd/sp.rb +2 -3
- data/processor/command/set_subcmd/substitute.rb +2 -3
- data/processor/command/set_subcmd/timer.rb +2 -3
- data/processor/command/set_subcmd/trace.rb +3 -4
- data/processor/command/show_subcmd/alias.rb +3 -3
- data/processor/command/show_subcmd/args.rb +2 -3
- data/processor/command/show_subcmd/auto.rb +1 -2
- data/processor/command/show_subcmd/basename.rb +2 -3
- data/processor/command/show_subcmd/debug.rb +1 -2
- data/processor/command/show_subcmd/different.rb +2 -1
- data/processor/command/show_subcmd/events.rb +2 -2
- data/processor/command/show_subcmd/hidelevel.rb +2 -3
- data/processor/command/show_subcmd/highlight.rb +23 -0
- data/processor/command/show_subcmd/macro.rb +2 -1
- data/processor/command/show_subcmd/max.rb +2 -3
- data/processor/command/show_subcmd/trace.rb +2 -3
- data/processor/command/source.rb +78 -28
- data/processor/default.rb +3 -2
- data/processor/load_cmds.rb +39 -19
- data/processor/location.rb +11 -7
- data/processor/main.rb +31 -15
- data/processor/mock.rb +22 -7
- data/processor/msg.rb +24 -8
- data/test/data/fname-with-blank.right +3 -0
- data/test/data/quit.right +2 -0
- data/test/functional/test-break-long.rb +87 -0
- data/test/functional/tmp/b3.rb +5 -0
- data/test/functional/tmp/immediate-bug1.rb +9 -0
- data/test/integration/helper.rb +14 -11
- data/test/integration/test-fname-with-blank.rb +5 -1
- data/test/integration/test-quit.rb +6 -2
- data/test/unit/cmd-helper.rb +9 -4
- data/test/unit/mock-helper.rb +9 -0
- data/test/unit/test-app-brkpt.rb +4 -4
- data/test/unit/test-app-brkptmgr.rb +2 -2
- data/test/unit/test-app-file.rb +0 -1
- data/test/unit/test-app-options.rb +26 -5
- data/test/unit/test-base-subcmd.rb +0 -1
- data/test/unit/test-cmd-alias.rb +0 -1
- data/test/unit/test-cmd-break.rb +0 -4
- data/test/unit/test-cmd-endisable.rb +1 -3
- data/test/unit/test-cmd-help.rb +0 -1
- data/test/unit/test-cmd-kill.rb +4 -5
- data/test/unit/test-cmd-quit.rb +4 -7
- data/test/unit/test-cmd-source.rb +33 -0
- data/test/unit/test-cmd-step.rb +0 -2
- data/test/unit/test-io-tcp.rb +32 -0
- data/test/unit/test-io-tcpclient.rb +53 -0
- data/test/unit/test-io-tcpserver.rb +49 -0
- data/test/unit/test-proc-main.rb +2 -2
- metadata +195 -175
- data/processor/command/stepi.rb +0 -63
- data/test/functional/tmp/b1.rb +0 -5
- data/test/functional/tmp/s1.rb +0 -9
- data/test/functional/tmp/t2.rb +0 -6
- data/test/integration/try-test-enable.rb +0 -11
data/lib/trepanning.rb
CHANGED
@@ -6,6 +6,8 @@ require_relative '../app/core' # core event-handling mechanism
|
|
6
6
|
require_relative '../app/default' # default debugger settings
|
7
7
|
require_relative '../interface/user' # user interface (includes I/O)
|
8
8
|
require_relative '../interface/script' # --command interface (includes I/O)
|
9
|
+
require_relative '../interface/client' # client interface (remote debugging)
|
10
|
+
require_relative '../interface/server' # server interface (remote debugging)
|
9
11
|
|
10
12
|
# SCRIPT_ISEQS__ is like SCRIPT_LINES__ in a patched Ruby 1.9. Setting
|
11
13
|
# this variable to a hash causes instruction sequences to be added in
|
@@ -20,7 +22,6 @@ ISEQS__ = {} unless
|
|
20
22
|
defined?(ISEQS__) && ISEQS__.is_a?(Hash)
|
21
23
|
|
22
24
|
class Trepan
|
23
|
-
VERSION = '0.0.9'
|
24
25
|
|
25
26
|
attr_accessor :core # access to Trepan::Core instance
|
26
27
|
attr_accessor :intf # Array. The way the outside world
|
@@ -40,40 +41,56 @@ class Trepan
|
|
40
41
|
th = Thread.current
|
41
42
|
th.exec_event_tracing = true
|
42
43
|
|
43
|
-
@settings =
|
44
|
-
@input
|
45
|
-
@output
|
44
|
+
@settings = Trepan::DEFAULT_SETTINGS.merge(settings)
|
45
|
+
@input = @settings[:input] || STDIN
|
46
|
+
@output = @settings[:output] || STDOUT
|
46
47
|
|
47
|
-
@intf
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
48
|
+
@intf =
|
49
|
+
if @settings[:server]
|
50
|
+
opts = Trepan::ServerInterface::DEFAULT_INIT_CONNECTION_OPTS.dup
|
51
|
+
opts[:port] = @settings[:port] if @settings[:port]
|
52
|
+
opts[:host] = @settings[:host] if @settings[:host]
|
53
|
+
puts("starting debugger in out-of-process mode port at " +
|
54
|
+
"#{opts[:host]}:#{opts[:port]}")
|
55
|
+
[Trepan::ServerInterface.new(nil, nil, opts)]
|
56
|
+
elsif @settings[:client]
|
57
|
+
opts = Trepan::ClientInterface::DEFAULT_INIT_CONNECTION_OPTS.dup
|
58
|
+
opts[:port] = @settings[:port] if @settings[:port]
|
59
|
+
opts[:host] = @settings[:host] if @settings[:host]
|
60
|
+
[Trepan::ClientInterface.new(nil, nil, nil, nil, opts)]
|
61
|
+
else
|
62
|
+
[Trepan::UserInterface.new(@input, @output)]
|
63
|
+
end
|
64
|
+
|
65
|
+
process_cmdfile_setting(@settings)
|
66
|
+
|
67
|
+
# FIXME: The below option settings is a big crock.
|
68
|
+
@settings[:core_opts][:cmdproc_opts] ||= {}
|
69
|
+
@settings[:core_opts][:cmdproc_opts][:highlight] ||= settings[:highlight]
|
70
|
+
|
71
|
+
@core = Core.new(self, @settings[:core_opts])
|
72
|
+
|
52
73
|
if @settings[:initial_dir]
|
53
74
|
Dir.chdir(@settings[:initial_dir])
|
54
75
|
else
|
55
76
|
@settings[:initial_dir] = Dir.pwd
|
56
77
|
end
|
57
78
|
@initial_dir = @settings[:initial_dir]
|
58
|
-
@restart_argv =
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
nil
|
79
|
+
@restart_argv = @settings[:restart_argv]
|
80
|
+
|
81
|
+
unless @settings[:client]
|
82
|
+
@trace_filter = Trace::Filter.new
|
83
|
+
%w(debugger start stop).each do |m|
|
84
|
+
@trace_filter << self.method(m.to_sym)
|
65
85
|
end
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
@trace_filter <<
|
86
|
+
%w(debugger event_processor trace_var_processor).each do
|
87
|
+
|m|
|
88
|
+
@trace_filter << @core.method(m)
|
89
|
+
end
|
90
|
+
@trace_filter << @trace_filter.method(:add_trace_func)
|
91
|
+
@trace_filter << @trace_filter.method(:remove_trace_func)
|
92
|
+
@trace_filter << Kernel.method(:add_trace_func)
|
73
93
|
end
|
74
|
-
@trace_filter << @trace_filter.method(:add_trace_func)
|
75
|
-
@trace_filter << @trace_filter.method(:remove_trace_func)
|
76
|
-
@trace_filter << Kernel.method(:add_trace_func)
|
77
94
|
|
78
95
|
# Run user debugger command startup files.
|
79
96
|
add_startup_files unless @settings[:nx]
|
@@ -185,8 +202,8 @@ class Trepan
|
|
185
202
|
|
186
203
|
def add_startup_files()
|
187
204
|
seen = {}
|
188
|
-
cwd_initfile = File.join('.',
|
189
|
-
[cwd_initfile,
|
205
|
+
cwd_initfile = File.join('.', Trepan::CMD_INITFILE_BASE)
|
206
|
+
[cwd_initfile, Trepan::CMD_INITFILE].each do |initfile|
|
190
207
|
full_initfile_path = File.expand_path(initfile)
|
191
208
|
next if seen[full_initfile_path]
|
192
209
|
add_command_file(full_initfile_path) if File.readable?(full_initfile_path)
|
@@ -194,6 +211,18 @@ class Trepan
|
|
194
211
|
end
|
195
212
|
end
|
196
213
|
|
214
|
+
def process_cmdfile_setting(settings)
|
215
|
+
settings[:cmdfiles].each do |item|
|
216
|
+
cmdfile, opts =
|
217
|
+
if item.kind_of?(Array)
|
218
|
+
item
|
219
|
+
else
|
220
|
+
[item, {}]
|
221
|
+
end
|
222
|
+
add_command_file(cmdfile, opts)
|
223
|
+
end if settings.member?(:cmdfiles)
|
224
|
+
end
|
225
|
+
|
197
226
|
# As a simplification for creating a debugger object, and then
|
198
227
|
# calling using the object to invoke the debugger, we allow this
|
199
228
|
# two-step process in one step. That is, instead of
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
-
# Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
|
2
|
+
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
3
3
|
# Base class of all commands. Code common to all commands is here.
|
4
4
|
# Note: don't end classname with Command (capital C) since main
|
5
5
|
# will think this a command name like QuitCommand
|
@@ -46,21 +46,21 @@ class Trepan
|
|
46
46
|
@proc.confirm(message, default)
|
47
47
|
end
|
48
48
|
|
49
|
-
def errmsg(message)
|
50
|
-
@proc.errmsg(message)
|
49
|
+
def errmsg(message, opts={})
|
50
|
+
@proc.errmsg(message, opts)
|
51
51
|
end
|
52
52
|
|
53
53
|
def obj_const(obj, name)
|
54
54
|
obj.class.const_get(name)
|
55
55
|
end
|
56
56
|
|
57
|
-
def msg(message)
|
58
|
-
@proc.msg(message)
|
57
|
+
def msg(message, opts={})
|
58
|
+
@proc.msg(message, opts)
|
59
59
|
end
|
60
60
|
|
61
61
|
# Convenience short-hand for @dbgr.intf[-1].msg_nocr
|
62
62
|
def msg_nocr(msg)
|
63
|
-
@proc.msg_nocr(msg)
|
63
|
+
@proc.msg_nocr(msg, opts={})
|
64
64
|
end
|
65
65
|
|
66
66
|
def my_const(name)
|
@@ -86,6 +86,10 @@ class Trepan
|
|
86
86
|
raise RuntimeError, 'You need to define this method elsewhere'
|
87
87
|
end
|
88
88
|
|
89
|
+
def section(message, opts={})
|
90
|
+
@proc.section(message, opts)
|
91
|
+
end
|
92
|
+
|
89
93
|
def settings
|
90
94
|
@proc.settings
|
91
95
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
-
# Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
|
2
|
+
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
3
3
|
# A base class for debugger subcommands.
|
4
4
|
#
|
5
5
|
# Note: don't end classname with Command (capital C) since main
|
@@ -193,6 +193,18 @@ class Trepan
|
|
193
193
|
|
194
194
|
end
|
195
195
|
|
196
|
+
module Trepanning
|
197
|
+
module Subcommand
|
198
|
+
module_function
|
199
|
+
def set_name_prefix(__file__, klass)
|
200
|
+
dirname = File.basename(File.dirname(File.expand_path(__file__)))
|
201
|
+
name = File.basename(__file__, '.rb')
|
202
|
+
klass.const_set('NAME', name)
|
203
|
+
klass.const_set('PREFIX', %W(#{dirname[0...-'_subcmd'.size]} #{name}))
|
204
|
+
end
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
196
208
|
if __FILE__ == $0
|
197
209
|
# Demo it.
|
198
210
|
require_relative '../../mock'
|
@@ -8,22 +8,30 @@ class Trepan::Command::DirectoryCommand < Trepan::Command
|
|
8
8
|
MAX_ARGS = 1 # Need at most this many
|
9
9
|
NAME = File.basename(__FILE__, '.rb')
|
10
10
|
HELP = <<-HELP
|
11
|
+
#{NAME} [DIR]
|
12
|
+
|
11
13
|
Add directory DIR to beginning of search path for source files.
|
12
14
|
DIR can also be $cwd for the current working directory, or $cdir for the
|
13
15
|
directory in which the debugged file start.
|
14
16
|
With no argument, reset the search path to $cdir:$cwd, the default.
|
15
17
|
|
16
|
-
This command may be useful for
|
17
|
-
|
18
|
+
This command may be useful if for some reason the debugger can't find
|
19
|
+
source files because directories have been moved.
|
20
|
+
|
21
|
+
Examples:
|
22
|
+
#{NAME} ~/.rvm/src/ruby-head # Adds an rvm-like directory to path
|
23
|
+
#{NAME} # reset to $cdir:$cwd
|
18
24
|
HELP
|
25
|
+
|
19
26
|
SHORT_HELP =
|
20
27
|
'Add directory DIR to beginning of search path for source files'
|
21
28
|
end
|
22
29
|
|
23
30
|
# This method runs the command
|
24
|
-
def run(args)
|
31
|
+
def run(args) # :nodoc
|
25
32
|
if args.size > 1
|
26
|
-
|
33
|
+
path = File.expand_path(args[1])
|
34
|
+
settings[:directory] = "#{path}:#{settings[:directory]}"
|
27
35
|
msg "Source directories searched: #{settings[:directory]}"
|
28
36
|
else
|
29
37
|
if confirm('Reintialize source path to empty?', false)
|
@@ -36,8 +44,7 @@ end
|
|
36
44
|
|
37
45
|
if __FILE__ == $0
|
38
46
|
require_relative '../mock'
|
39
|
-
|
40
|
-
|
41
|
-
cmd.run([name])
|
42
|
-
cmd.run([name, '/tmp'])
|
47
|
+
dbgr, cmd = MockDebugger::setup
|
48
|
+
cmd.run([cmd.name])
|
49
|
+
cmd.run([cmd.name, '/tmp'])
|
43
50
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
-
# Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
|
2
|
+
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
3
3
|
require_relative 'base/cmd'
|
4
4
|
require_relative '../../app/disassemble'
|
5
5
|
require_relative '../../app/file'
|
@@ -43,7 +43,8 @@ Examples:
|
|
43
43
|
ary = mark_disassembly(iseq.disasm_nochildren,
|
44
44
|
@proc.frame.iseq.equal?(iseq),
|
45
45
|
@proc.frame.pc_offset,
|
46
|
-
iseq.brkpts, settings[:maxwidth]
|
46
|
+
iseq.brkpts, settings[:maxwidth],
|
47
|
+
settings[:highlight])
|
47
48
|
msg ary
|
48
49
|
end
|
49
50
|
end
|
data/processor/command/help.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
|
1
|
+
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
2
2
|
require_relative 'base/cmd'
|
3
3
|
class Trepan::Command::HelpCommand < Trepan::Command
|
4
4
|
|
@@ -41,13 +41,15 @@ See also 'examine' and 'whatis'.
|
|
41
41
|
|
42
42
|
# List the command categories and a short description of each.
|
43
43
|
def list_categories
|
44
|
-
|
44
|
+
section 'Classes of commands:'
|
45
45
|
CATEGORIES.keys.sort.each do |cat|
|
46
46
|
msg("%-13s -- %s" % [cat, CATEGORIES[cat]])
|
47
47
|
end
|
48
48
|
final_msg = '
|
49
49
|
Type "help" followed by a class name for a list of commands in that class.
|
50
|
+
Type "help syntax" for information on debugger command syntax.
|
50
51
|
Type "help *" for the list of all commands.
|
52
|
+
Type "help all" for the list of all commands.
|
51
53
|
Type "help REGEXP" for the list of commands matching /^#{REGEXP}/
|
52
54
|
Type "help CLASS *" for the list of all commands in class CLASS.
|
53
55
|
Type "help" followed by command name for full documentation.
|
@@ -56,12 +58,18 @@ Type "help" followed by command name for full documentation.
|
|
56
58
|
end
|
57
59
|
|
58
60
|
# This method runs the command
|
59
|
-
def run(args)
|
61
|
+
def run(args) # :nodoc
|
60
62
|
if args.size > 1
|
61
63
|
cmd_name = args[1]
|
62
64
|
if cmd_name == '*'
|
63
|
-
|
65
|
+
section 'All command names:'
|
64
66
|
msg columnize_commands(@proc.commands.keys.sort)
|
67
|
+
elsif cmd_name =~ /^syntax$/i
|
68
|
+
show_command_syntax
|
69
|
+
elsif cmd_name =~ /^all$/i
|
70
|
+
CATEGORIES.sort.each do |category|
|
71
|
+
show_category(category[0], [])
|
72
|
+
end
|
65
73
|
elsif CATEGORIES.member?(cmd_name)
|
66
74
|
show_category(args[1], args[2..-1])
|
67
75
|
elsif @proc.commands.member?(cmd_name) or @proc.aliases.member?(cmd_name)
|
@@ -87,37 +95,82 @@ Type "help" followed by command name for full documentation.
|
|
87
95
|
if matches.empty?
|
88
96
|
errmsg("No commands found matching /^#{cmd_name}/. Try \"help\".")
|
89
97
|
else
|
90
|
-
|
98
|
+
section "Command names matching /^#{cmd_name}/:"
|
91
99
|
msg columnize_commands(matches.sort)
|
92
100
|
end
|
93
101
|
end
|
94
102
|
else
|
95
103
|
list_categories
|
96
104
|
end
|
97
|
-
return false # Don't break out of cmd loop
|
98
105
|
end
|
99
106
|
|
100
107
|
# Show short help for all commands in `category'.
|
101
108
|
def show_category(category, args)
|
102
109
|
|
103
110
|
if args.size == 1 && args[0] == '*'
|
104
|
-
|
111
|
+
section "Commands in class %s:" % category
|
105
112
|
|
106
113
|
cmds = @proc.commands.keys.select do |cmd_name|
|
107
114
|
category == @proc.commands[cmd_name].category
|
108
115
|
end.sort
|
109
|
-
|
110
116
|
width = settings[:maxwidth]
|
111
117
|
return columnize_commands(cmds)
|
112
118
|
end
|
113
119
|
|
114
|
-
msg(
|
115
|
-
|
120
|
+
msg('')
|
121
|
+
section "Command class: %s" % category
|
122
|
+
msg('')
|
116
123
|
@proc.commands.keys.sort.each do |name|
|
117
124
|
next if category != @proc.commands[name].category
|
118
125
|
msg("%-13s -- %s" % [name, @proc.commands[name].short_help])
|
119
126
|
end
|
120
127
|
end
|
128
|
+
|
129
|
+
def show_command_syntax
|
130
|
+
section "Debugger command syntax"
|
131
|
+
msg <<-EOS
|
132
|
+
Command command syntax is very simple-minded.
|
133
|
+
|
134
|
+
If a line starts with #, the command is ignored.
|
135
|
+
If a line starts with !, the line is eval'd.
|
136
|
+
|
137
|
+
If the command you want eval'd uses the Ruby ! initally, add that
|
138
|
+
after the first !.
|
139
|
+
|
140
|
+
Commands are split at whereever ;; appears. This process disregards
|
141
|
+
any quotes or other symbols that have meaning in Ruby. The strings
|
142
|
+
after the leading command string are put back on a command queue.
|
143
|
+
|
144
|
+
Within a single command, tokens are then white-space split. Again,
|
145
|
+
this process disregards quotes or symbols that have meaning in Ruby.
|
146
|
+
|
147
|
+
The first token is then looked up in the debugger command table and
|
148
|
+
then the debugger alias table. If a match is found the command name
|
149
|
+
and arguments are dispatched to the command object that process the
|
150
|
+
command.
|
151
|
+
|
152
|
+
If the command is not found and "auto eval" is set on, then the
|
153
|
+
command is eval'd in the context that the program is currently stopped
|
154
|
+
at. If "auto eval" is not set on, then we display an error message
|
155
|
+
that the entered string is "undefined".
|
156
|
+
|
157
|
+
If you want irb-like command-processing, it's possible to go into an
|
158
|
+
irb shell with the "irb" command. It is also possible to arrange going
|
159
|
+
into an irb shell every time you enter the debugger.
|
160
|
+
|
161
|
+
Examples:
|
162
|
+
|
163
|
+
# This line does nothing. It is a comment
|
164
|
+
s # by default, this is an alias for the "step" command
|
165
|
+
!s # shows the value of variable step.
|
166
|
+
!!s # Evaluates !s (or "not s"). The first ! is indicates evaluate.
|
167
|
+
info program;; list # Runs two commands "info program" and "list"
|
168
|
+
pr "hi ;;-)" # Syntax error since ;; splits the line and " is not closed.
|
169
|
+
!puts "hi ;;-)" # One way to do the above.
|
170
|
+
|
171
|
+
See also "alias", "irb", "set auto eval", and "set auto irb".
|
172
|
+
EOS
|
173
|
+
end
|
121
174
|
end
|
122
175
|
|
123
176
|
if __FILE__ == $0
|
@@ -125,20 +178,19 @@ if __FILE__ == $0
|
|
125
178
|
require_relative '../mock'
|
126
179
|
dbgr, cmd = MockDebugger::setup
|
127
180
|
|
128
|
-
cmd.run %W(cmd.name help)
|
181
|
+
cmd.run %W(#{cmd.name} help)
|
129
182
|
puts '=' * 40
|
130
|
-
cmd.run %W(cmd.name *)
|
183
|
+
cmd.run %W(#{cmd.name} *)
|
131
184
|
puts '=' * 40
|
132
|
-
cmd.run %W(cmd.name fdafsasfda)
|
185
|
+
cmd.run %W(#{cmd.name} fdafsasfda)
|
133
186
|
puts '=' * 40
|
134
|
-
cmd.run
|
187
|
+
cmd.run [cmd.name]
|
135
188
|
puts '=' * 40
|
136
|
-
cmd.run %W(cmd.name support)
|
189
|
+
cmd.run %W(#{cmd.name} support)
|
137
190
|
puts '=' * 40
|
138
|
-
cmd.run %W(cmd.name support *)
|
139
|
-
|
191
|
+
cmd.run %W(#{cmd.name} support *)
|
140
192
|
puts '=' * 40
|
141
|
-
cmd.run %W(cmd.name s.*)
|
193
|
+
cmd.run %W(#{cmd.name} s.*)
|
142
194
|
puts '=' * 40
|
143
|
-
cmd.run %W(cmd.name s<>)
|
195
|
+
cmd.run %W(#{cmd.name} s<>)
|
144
196
|
end
|
@@ -1,15 +1,14 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
-
# Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
|
2
|
+
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
3
3
|
require_relative '../base/subcmd'
|
4
4
|
require_relative '../../../app/frame'
|
5
5
|
|
6
6
|
class Trepan::Subcommand::InfoArgs < Trepan::Subcommand
|
7
7
|
unless defined?(HELP)
|
8
|
+
Trepanning::Subcommand.set_name_prefix(__FILE__, self)
|
8
9
|
HELP = 'Show argument variables of the current stack frame'
|
9
10
|
MIN_ABBREV = 'ar'.size
|
10
|
-
NAME = File.basename(__FILE__, '.rb')
|
11
11
|
NEED_STACK = true
|
12
|
-
PREFIX = %w(info args)
|
13
12
|
end
|
14
13
|
|
15
14
|
include Trepan::Frame
|
@@ -1,9 +1,10 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
-
# Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
|
2
|
+
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
3
3
|
require_relative '../base/subcmd'
|
4
4
|
|
5
5
|
class Trepan::Subcommand::InfoBreakpoints < Trepan::Subcommand
|
6
6
|
unless defined?(HELP)
|
7
|
+
Trepanning::Subcommand.set_name_prefix(__FILE__, self)
|
7
8
|
HELP = <<EOH
|
8
9
|
info breakpoints [num1 ...] [verbose]
|
9
10
|
|
@@ -21,8 +22,6 @@ The "Where" column indicates where the breakpoint is located.
|
|
21
22
|
EOH
|
22
23
|
|
23
24
|
MIN_ABBREV = 'br'.size
|
24
|
-
NAME = File.basename(__FILE__, '.rb')
|
25
|
-
PREFIX = %w(info breakpoints)
|
26
25
|
SHORT_HELP = "Status of user-settable breakpoints"
|
27
26
|
end
|
28
27
|
|