trepanning 0.0.6 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +214 -0
- data/NEWS +12 -0
- data/README.textile +1 -7
- data/Rakefile +13 -0
- data/app/default.rb +5 -4
- data/app/disassemble.rb +25 -3
- data/app/run.rb +0 -18
- data/bin/trepan +4 -6
- data/data/irbrc +3 -17
- data/io/base_io.rb +3 -1
- data/io/null_output.rb +41 -0
- data/lib/trepanning.rb +10 -13
- data/processor/command/backtrace.rb +7 -6
- data/processor/command/base/subcmd.rb +4 -0
- data/processor/command/base/submgr.rb +1 -1
- data/processor/command/base/subsubmgr.rb +1 -1
- data/processor/command/break.rb +12 -4
- data/processor/command/continue.rb +2 -2
- data/processor/command/delete.rb +1 -1
- data/processor/command/disable.rb +1 -1
- data/processor/command/disassemble.rb +1 -1
- data/processor/command/finish.rb +3 -3
- data/processor/command/info_subcmd/iseq.rb +9 -0
- data/processor/command/info_subcmd/registers_subcmd/dfp.rb +7 -16
- data/processor/command/info_subcmd/registers_subcmd/lfp.rb +5 -17
- data/processor/command/info_subcmd/registers_subcmd/pc.rb +6 -19
- data/processor/command/info_subcmd/registers_subcmd/sp.rb +14 -24
- data/processor/command/list.rb +34 -19
- data/processor/command/reload.rb +1 -1
- data/processor/command/restart.rb +8 -9
- data/processor/command/set_subcmd/auto.rb +1 -2
- data/processor/command/set_subcmd/auto_subcmd/eval.rb +6 -19
- data/processor/command/set_subcmd/auto_subcmd/irb.rb +7 -23
- data/processor/command/set_subcmd/auto_subcmd/list.rb +5 -22
- data/processor/command/set_subcmd/basename.rb +6 -20
- data/processor/command/set_subcmd/debug.rb +1 -1
- data/processor/command/set_subcmd/debug_subcmd/dbgr.rb +9 -22
- data/processor/command/set_subcmd/debug_subcmd/except.rb +8 -20
- data/processor/command/set_subcmd/debug_subcmd/macro.rb +7 -19
- data/processor/command/set_subcmd/debug_subcmd/skip.rb +5 -18
- data/processor/command/set_subcmd/debug_subcmd/stack.rb +5 -18
- data/processor/command/set_subcmd/hidelevel.rb +60 -0
- data/processor/command/set_subcmd/max.rb +1 -1
- data/processor/command/set_subcmd/max_subcmd/list.rb +12 -23
- data/processor/command/set_subcmd/max_subcmd/stack.rb +8 -31
- data/processor/command/set_subcmd/substitute.rb +1 -1
- data/processor/command/set_subcmd/substitute_subcmd/eval.rb +1 -1
- data/processor/command/set_subcmd/substitute_subcmd/path.rb +1 -1
- data/processor/command/set_subcmd/substitute_subcmd/string.rb +6 -18
- data/processor/command/set_subcmd/timer.rb +1 -1
- data/processor/command/set_subcmd/trace.rb +1 -1
- data/processor/command/set_subcmd/trace_subcmd/buffer.rb +1 -1
- data/processor/command/set_subcmd/trace_subcmd/print.rb +5 -21
- data/processor/command/set_subcmd/trace_subcmd/var.rb +1 -1
- data/processor/command/show_subcmd/args.rb +9 -27
- data/processor/command/show_subcmd/auto_subcmd/eval.rb +3 -15
- data/processor/command/show_subcmd/auto_subcmd/irb.rb +3 -15
- data/processor/command/show_subcmd/auto_subcmd/list.rb +3 -18
- data/processor/command/show_subcmd/basename.rb +3 -1
- data/processor/command/show_subcmd/hidelevel.rb +41 -0
- data/processor/command/show_subcmd/max.rb +1 -1
- data/processor/command/show_subcmd/trace_subcmd/buffer.rb +1 -1
- data/processor/command/show_subcmd/trace_subcmd/print.rb +1 -1
- data/processor/command/source.rb +6 -5
- data/processor/command/undisplay.rb +0 -1
- data/processor/default.rb +6 -2
- data/processor/frame.rb +2 -21
- data/processor/location.rb +44 -18
- data/processor/main.rb +0 -11
- data/processor/mock.rb +25 -0
- data/processor/validate.rb +34 -18
- data/test/functional/fn_helper.rb +14 -4
- data/test/functional/test-break.rb +35 -73
- data/test/functional/test-condition.rb +9 -10
- data/test/functional/test-delete.rb +5 -3
- data/test/unit/test-app-disassemble.rb +15 -3
- data/test/unit/test-app-run.rb +0 -4
- data/test/unit/test-cmd-break.rb +3 -0
- metadata +15 -11
data/processor/command/list.rb
CHANGED
@@ -5,7 +5,7 @@ require_relative 'base/cmd'
|
|
5
5
|
|
6
6
|
class Trepan::Command::ListCommand < Trepan::Command
|
7
7
|
unless defined?(HELP)
|
8
|
-
NAME
|
8
|
+
NAME = File.basename(__FILE__, '.rb')
|
9
9
|
HELP = <<-HELP
|
10
10
|
#{NAME}[>] [MODULE] [FIRST [NUM]]
|
11
11
|
#{NAME}[>] LOCATION [NUM]
|
@@ -19,7 +19,7 @@ frame. If a subsequent #{NAME} command was issued with no intervening
|
|
19
19
|
frame changing, then that is start the line after we last one
|
20
20
|
previously shown.
|
21
21
|
|
22
|
-
If the command has a '>' suffix, then
|
22
|
+
If the command has a '>' suffix, then line centering is disabled and
|
23
23
|
listing begins at the specificed location.
|
24
24
|
|
25
25
|
The number of line to show is controled by the debugger listsize
|
@@ -59,6 +59,8 @@ Some examples:
|
|
59
59
|
#{NAME} foo.rb:5 2 # Same as above
|
60
60
|
#{NAME} FileUtils.cp # List lines around the FileUtils.cp function.
|
61
61
|
#{NAME} . # List lines centered from where we currently are stopped
|
62
|
+
#{NAME} . 3 # List 3 lines starting from where we currently are stopped
|
63
|
+
# if . > 3. Otherwise we list from . to 3.
|
62
64
|
#{NAME} - # List lines previous to those just shown
|
63
65
|
|
64
66
|
The output of the #{NAME} command give a line number, and some status
|
@@ -84,6 +86,12 @@ disabled.
|
|
84
86
|
SHORT_HELP = 'List source code'
|
85
87
|
end
|
86
88
|
|
89
|
+
# If last is less than first, assume last is a count rather than an
|
90
|
+
# end line number.
|
91
|
+
def adjust_last(first, last)
|
92
|
+
last < first ? first + last - 1 : last
|
93
|
+
end
|
94
|
+
|
87
95
|
# What a f*cking mess. Necessitated I suppose because we want to
|
88
96
|
# allow somewhat flexible parsing with either module names, files or none
|
89
97
|
# and optional line counts or end-line numbers.
|
@@ -122,7 +130,20 @@ disabled.
|
|
122
130
|
first = [1, @proc.line_no - 2*listsize - 1].max
|
123
131
|
elsif args[0] == '.'
|
124
132
|
return no_frame_msg unless @proc.line_no
|
125
|
-
|
133
|
+
if args.size == 2
|
134
|
+
opts = {
|
135
|
+
:msg_on_error =>
|
136
|
+
"#{NAME} command last or count parameter expected, " +
|
137
|
+
'got: %s.' % args[2]
|
138
|
+
}
|
139
|
+
second = @proc.get_an_int(args[1], opts)
|
140
|
+
return nil, nil, nil unless second
|
141
|
+
first = @proc.frame_line
|
142
|
+
last = adjust_last(first, second)
|
143
|
+
else
|
144
|
+
first = [1, @proc.frame_line - center_correction].max
|
145
|
+
end
|
146
|
+
|
126
147
|
else
|
127
148
|
modfunc, container, first = @proc.parse_position(args[0])
|
128
149
|
if first == nil and modfunc == nil
|
@@ -135,29 +156,23 @@ disabled.
|
|
135
156
|
elsif args.size == 2 or (args.size == 3 and modfunc)
|
136
157
|
opts = {
|
137
158
|
:msg_on_error =>
|
138
|
-
|
159
|
+
"#{NAME} command starting line expected, got %s." % args[-1]
|
139
160
|
}
|
140
|
-
|
141
|
-
|
142
|
-
return nil, nil, nil unless num
|
161
|
+
last = @proc.get_an_int(args[1], opts)
|
162
|
+
return nil, nil, nil unless last
|
143
163
|
if modfunc
|
144
164
|
if first
|
145
|
-
first =
|
165
|
+
first = last
|
146
166
|
if args.size == 3 and modfunc
|
147
|
-
opts[:msg_on_error] =
|
148
|
-
|
167
|
+
opts[:msg_on_error] =
|
168
|
+
("#{NAME} command last or count parameter expected, " +
|
169
|
+
'got: %s.' % args[2])
|
149
170
|
last = @proc.get_an_int(args[2], opts)
|
171
|
+
return nil, nil, nil unless last
|
150
172
|
end
|
151
|
-
else
|
152
|
-
last = num
|
153
173
|
end
|
154
|
-
else
|
155
|
-
first = num - center_correction
|
156
|
-
end
|
157
|
-
if last and last < first
|
158
|
-
# Assume last is a count rather than an end line number
|
159
|
-
last = first + last - 1
|
160
174
|
end
|
175
|
+
last = adjust_last(first, last)
|
161
176
|
elsif not modfunc
|
162
177
|
errmsg('At most 2 parameters allowed when no module' +
|
163
178
|
' name is found/given. Saw: %d parameters' % args.size)
|
@@ -168,7 +183,7 @@ disabled.
|
|
168
183
|
return nil, nil, nil
|
169
184
|
end
|
170
185
|
end
|
171
|
-
elsif !@proc.line_no and frame
|
186
|
+
elsif !@proc.line_no and @proc.frame
|
172
187
|
first = [1, @proc.frame_line - center_correction].max
|
173
188
|
else
|
174
189
|
first = [1, @proc.line_no - center_correction].max
|
data/processor/command/reload.rb
CHANGED
@@ -25,20 +25,19 @@ new copy of the debugger is used.
|
|
25
25
|
dbgr = @proc.dbgr
|
26
26
|
argv = dbgr.restart_argv
|
27
27
|
if argv and argv.size > 0
|
28
|
-
unless File.executable?(argv[0])
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
end
|
28
|
+
# unless File.executable?(argv[0])
|
29
|
+
# msg(["File #{argv[0]} not executable.",
|
30
|
+
# "Adding Ruby interpreter."])
|
31
|
+
# argv.unshift Trepanning::ruby_path
|
32
|
+
# end
|
33
33
|
@proc.run_cmd(%w(show args))
|
34
34
|
if not confirm('Restart (exec)?', false)
|
35
35
|
msg "Restart not confirmed"
|
36
36
|
else
|
37
37
|
msg 'Restarting...'
|
38
38
|
@proc.run_cmd(%w(save))
|
39
|
-
argv.unshift
|
40
39
|
# FIXME: Run atexit finalize routines?
|
41
|
-
Dir.chdir(
|
40
|
+
Dir.chdir(RubyVM::OS_STARTUP_DIR)
|
42
41
|
exec(*argv)
|
43
42
|
end
|
44
43
|
else
|
@@ -48,11 +47,11 @@ new copy of the debugger is used.
|
|
48
47
|
end
|
49
48
|
|
50
49
|
if __FILE__ == $0
|
51
|
-
exit if ARGV[
|
50
|
+
exit if ARGV[-1] == 'exit'
|
52
51
|
require_relative '../mock'
|
53
52
|
dbgr, cmd = MockDebugger::setup
|
54
53
|
dbgr.restart_argv = []
|
55
54
|
cmd.run([cmd.name])
|
56
|
-
dbgr.restart_argv = [
|
55
|
+
dbgr.restart_argv = RubyVM::OS_ARGV + ['exit']
|
57
56
|
cmd.run([cmd.name])
|
58
57
|
end
|
@@ -18,10 +18,9 @@ if __FILE__ == $0
|
|
18
18
|
set_cmd = cmds['set']
|
19
19
|
command = Trepan::SubSubcommand::SetAuto.new(dbgr.core.processor,
|
20
20
|
set_cmd)
|
21
|
-
name = File.basename(__FILE__, '.rb')
|
22
21
|
cmd_args = ['set', name]
|
23
22
|
set_cmd.instance_variable_set('@last_args', cmd_args)
|
24
23
|
# require_relative '../../../lib/trepanning'
|
25
|
-
# Trepan.debug
|
24
|
+
# Trepan.debug
|
26
25
|
command.run(cmd_args)
|
27
26
|
end
|
@@ -36,7 +36,7 @@ problem. Another possibility is to go into a real Ruby shell via the
|
|
36
36
|
"
|
37
37
|
MIN_ABBREV = 'ev'.size
|
38
38
|
NAME = File.basename(__FILE__, '.rb')
|
39
|
-
PREFIX = %
|
39
|
+
PREFIX = %W(set auto #{NAME})
|
40
40
|
SHORT_HELP = "Set evaluation of unrecognized debugger commands"
|
41
41
|
end
|
42
42
|
|
@@ -45,23 +45,10 @@ end
|
|
45
45
|
if __FILE__ == $0
|
46
46
|
# Demo it.
|
47
47
|
require_relative '../../../mock'
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
auto_cmd = Trepan::SubSubcommand::SetAuto.new(dbgr.core.processor,
|
53
|
-
set_cmd)
|
54
|
-
|
55
|
-
# FIXME: remove the 'join' below
|
56
|
-
cmd_name = Trepan::SubSubcommand::SetAutoEval::PREFIX.join('')
|
57
|
-
subcmd = Trepan::SubSubcommand::SetAutoEval.new(set_cmd.proc,
|
58
|
-
auto_cmd,
|
59
|
-
cmd_name)
|
60
|
-
# require_relative '../../../../lib/trepanning'
|
61
|
-
# Trepan.debug(:set_restart => true)
|
62
|
-
|
63
|
-
subcmd.run([cmd_name])
|
64
|
-
%w(off on 0 1).each { |arg| subcmd.run([cmd_name, arg]) }
|
48
|
+
require_relative '../auto'
|
49
|
+
cmd = MockDebugger::subsub_setup(Trepan::SubSubcommand::SetAuto,
|
50
|
+
Trepan::SubSubcommand::SetAutoEval)
|
51
|
+
%w(off on 0 1).each { |arg| cmd.run([cmd.name, arg]) }
|
65
52
|
puts '-' * 10
|
66
|
-
puts
|
53
|
+
puts cmd.save_command.join("\n")
|
67
54
|
end
|
@@ -7,7 +7,7 @@ class Trepan::Subcommand::SetAutoIrb < Trepan::SetBoolSubSubcommand
|
|
7
7
|
HELP = "Set to automatically go into irb each time we enter the debugger"
|
8
8
|
MIN_ABBREV = 'ir'.size
|
9
9
|
NAME = File.basename(__FILE__, '.rb')
|
10
|
-
PREFIX = %
|
10
|
+
PREFIX = %W(set auto #{NAME})
|
11
11
|
end
|
12
12
|
|
13
13
|
def run(args)
|
@@ -24,26 +24,10 @@ end
|
|
24
24
|
if __FILE__ == $0
|
25
25
|
# Demo it.
|
26
26
|
require_relative '../../../mock'
|
27
|
-
require_relative '
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
auto_cmd = Trepan::SubSubcommand::SetAuto.new(dbgr.core.processor,
|
34
|
-
set_cmd)
|
35
|
-
# FIXME: remove the 'join' below
|
36
|
-
cmd_name = Trepan::Subcommand::SetAutoIrb::PREFIX.join('')
|
37
|
-
autox_cmd = Trepan::SubSubcommand::SetAutoIrb.new(set_cmd.proc,
|
38
|
-
auto_cmd,
|
39
|
-
cmd_name)
|
40
|
-
# require_relative '../../../../lib/trepanning'
|
41
|
-
# dbgr = Trepan.new(:set_restart => true)
|
42
|
-
# dbgr.debugger
|
43
|
-
set_cmd.proc.hook_initialize(set_cmd.proc.commands)
|
44
|
-
subcmd_name = Trepan::Subcommand::SetAutoIrb::PREFIX[1..-1].join('')
|
45
|
-
autox_cmd.run([subcmd_name])
|
46
|
-
autox_cmd.run([subcmd_name, 'off'])
|
47
|
-
puts autox_cmd.save_command.join("\n")
|
48
|
-
|
27
|
+
require_relative '../auto'
|
28
|
+
cmd = MockDebugger::subsub_setup(Trepan::SubSubcommand::SetAuto,
|
29
|
+
Trepan::SubSubcommand::SetAutoIrb)
|
30
|
+
%w(off on 0 1).each { |arg| cmd.run([cmd.name, arg]) }
|
31
|
+
puts '-' * 10
|
32
|
+
puts cmd.save_command.join("\n")
|
49
33
|
end
|
@@ -25,27 +25,10 @@ end
|
|
25
25
|
if __FILE__ == $0
|
26
26
|
# Demo it.
|
27
27
|
require_relative '../../../mock'
|
28
|
-
require_relative '
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
# FIXME: DRY the below code
|
33
|
-
dbgr, set_cmd = MockDebugger::setup('set')
|
34
|
-
testcmdMgr = Trepan::Subcmd.new(set_cmd)
|
35
|
-
auto_cmd = Trepan::SubSubcommand::SetAuto.new(dbgr.core.processor,
|
36
|
-
set_cmd)
|
37
|
-
# FIXME: remove the 'join' below
|
38
|
-
cmd_name = Trepan::Subcommand::SetAutoList::PREFIX.join('')
|
39
|
-
autox_cmd = Trepan::SubSubcommand::SetAutoList.new(set_cmd.proc,
|
40
|
-
auto_cmd,
|
41
|
-
cmd_name)
|
42
|
-
# require_relative '../../../../lib/trepanning'
|
43
|
-
# dbgr = Trepan.new(:set_restart => true)
|
44
|
-
# dbgr.debugger
|
45
|
-
set_cmd.proc.hook_initialize(set_cmd.proc.commands)
|
46
|
-
subcmd_name = Trepan::Subcommand::SetAutoList::PREFIX[1..-1].join('')
|
47
|
-
autox_cmd.run([subcmd_name])
|
48
|
-
autox_cmd.run([subcmd_name, 'off'])
|
28
|
+
require_relative '../auto'
|
29
|
+
cmd = MockDebugger::subsub_setup(Trepan::SubSubcommand::SetAuto,
|
30
|
+
Trepan::SubSubcommand::SetAutoList)
|
31
|
+
%w(off on 0 1).each { |arg| cmd.run([cmd.name, arg]) }
|
49
32
|
puts '-' * 10
|
50
|
-
puts
|
33
|
+
puts cmd.save_command.join("\n")
|
51
34
|
end
|
@@ -15,25 +15,11 @@ end
|
|
15
15
|
|
16
16
|
if __FILE__ == $0
|
17
17
|
# Demo it.
|
18
|
+
$0 = __FILE__ + 'notagain' # So we don't run this agin
|
18
19
|
require_relative '../../mock'
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
testcmdMgr = Trepan::Subcmd.new(subcommand)
|
25
|
-
|
26
|
-
subcommand.run_show_bool
|
27
|
-
subcommand.summary_help(name)
|
28
|
-
|
29
|
-
# require 'trepanning'
|
30
|
-
# Trepan.debug(:set_restart => true)
|
31
|
-
subcommand.run(['set', name])
|
32
|
-
subcommand.run(['set', name, 'off'])
|
33
|
-
subcommand.run(['set', name, 'on'])
|
34
|
-
subcommand.summary_help(name)
|
35
|
-
puts
|
36
|
-
puts '-' * 20
|
37
|
-
puts subcommand.save_command
|
38
|
-
|
20
|
+
cmd = MockDebugger::sub_setup(Trepan::Subcommand::SetBasename, false)
|
21
|
+
cmd.run(cmd.prefix + ['off'])
|
22
|
+
cmd.run(cmd.prefix + ['ofn'])
|
23
|
+
cmd.run(cmd.prefix)
|
24
|
+
puts cmd.save_command
|
39
25
|
end
|
@@ -4,15 +4,15 @@ require_relative '../../base/subsubcmd'
|
|
4
4
|
|
5
5
|
class Trepan::SubSubcommand::SetDebugDbgr < Trepan::SetBoolSubSubcommand
|
6
6
|
unless defined?(HELP)
|
7
|
-
|
7
|
+
NAME = File.basename(__FILE__, '.rb')
|
8
|
+
PREFIX = %W(set debug #{NAME})
|
9
|
+
HELP = "#{PREFIX.join(" ")} [on|off]
|
8
10
|
|
9
11
|
Facilitates debugging the debugger. Global variables $trepan_cmdproc
|
10
12
|
and $trepan_frame are set to the current values of @frame and self
|
11
|
-
when the command processor was entered.
|
13
|
+
when the command processor was entered."
|
12
14
|
|
13
15
|
MIN_ABBREV = 'db'.size
|
14
|
-
NAME = File.basename(__FILE__, '.rb')
|
15
|
-
PREFIX = %W(set debug #{NAME})
|
16
16
|
SHORT_HELP = 'Set debugging debugger'
|
17
17
|
end
|
18
18
|
|
@@ -27,23 +27,10 @@ end
|
|
27
27
|
if __FILE__ == $0
|
28
28
|
# Demo it.
|
29
29
|
require_relative '../../../mock'
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
debug_cmd = Trepan::SubSubcommand::SetDebug.new(dbgr.core.processor,
|
35
|
-
dbg_cmd)
|
36
|
-
# FIXME: remove the 'join' below
|
37
|
-
cmd_name = Trepan::SubSubcommand::SetDebugDbgr::PREFIX.join('')
|
38
|
-
debugx_cmd = Trepan::SubSubcommand::SetDebugDbgr.new(dbg_cmd.proc,
|
39
|
-
debug_cmd,
|
40
|
-
cmd_name)
|
41
|
-
# require_relative '../.././../lib/trepanning'
|
42
|
-
# dbgr = Trepan.new(:set_restart => true)
|
43
|
-
# dbgr.debugger
|
44
|
-
debugx_cmd.run([name])
|
45
|
-
debugx_cmd.run([name, 'on'])
|
46
|
-
debugx_cmd.run([name, 'off'])
|
30
|
+
require_relative '../debug'
|
31
|
+
cmd = MockDebugger::subsub_setup(Trepan::SubSubcommand::SetDebug,
|
32
|
+
Trepan::SubSubcommand::SetDebugDbgr)
|
33
|
+
%w(off on 0 1).each { |arg| cmd.run([cmd.name, arg]) }
|
47
34
|
puts '-' * 10
|
48
|
-
puts
|
35
|
+
puts cmd.save_command.join("\n")
|
49
36
|
end
|
@@ -5,31 +5,19 @@ require_relative '../../base/subsubcmd'
|
|
5
5
|
class Trepan::SubSubcommand::SetDebugExcept < Trepan::SetBoolSubSubcommand
|
6
6
|
unless defined?(HELP)
|
7
7
|
HELP = 'Set to show execution traceback on debugger command exception'
|
8
|
-
MIN_ABBREV = '
|
8
|
+
MIN_ABBREV = 'ex'.size
|
9
9
|
NAME = File.basename(__FILE__, '.rb')
|
10
|
-
PREFIX = %
|
10
|
+
PREFIX = %W(set debug #{NAME})
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
14
|
if __FILE__ == $0
|
15
15
|
# Demo it.
|
16
16
|
require_relative '../../../mock'
|
17
|
-
require_relative '
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
dbg_cmd)
|
24
|
-
# FIXME: remove the 'join' below
|
25
|
-
cmd_name = Trepan::SubSubcommand::SetDebugExcept::PREFIX.join('')
|
26
|
-
debugx_cmd = Trepan::SubSubcommand::SetDebugExcept.new(dbg_cmd.proc,
|
27
|
-
debug_cmd,
|
28
|
-
cmd_name)
|
29
|
-
# require_relative '../../../../lib/trepan'
|
30
|
-
# dbgr = Trepan.new(:set_restart => true)
|
31
|
-
# dbgr.debugger
|
32
|
-
debugx_cmd.run([name, 'off'])
|
33
|
-
debugx_cmd.run([name])
|
34
|
-
debugx_cmd.run([name, 'on'])
|
17
|
+
require_relative '../debug'
|
18
|
+
cmd = MockDebugger::subsub_setup(Trepan::SubSubcommand::SetDebug,
|
19
|
+
Trepan::SubSubcommand::SetDebugExcept)
|
20
|
+
%w(off on 0 1).each { |arg| cmd.run([cmd.name, arg]) }
|
21
|
+
puts '-' * 10
|
22
|
+
puts cmd.save_command.join("\n")
|
35
23
|
end
|
@@ -7,29 +7,17 @@ class Trepan::SubSubcommand::SetDebugMacro < Trepan::SetBoolSubSubcommand
|
|
7
7
|
HELP = "Set macro debugging"
|
8
8
|
MIN_ABBREV = 'macro'.size
|
9
9
|
NAME = File.basename(__FILE__, '.rb')
|
10
|
-
PREFIX = %
|
10
|
+
PREFIX = %W(set debug #{NAME})
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
14
|
if __FILE__ == $0
|
15
15
|
# Demo it.
|
16
16
|
require_relative '../../../mock'
|
17
|
-
require_relative '
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
set_cmd)
|
24
|
-
# FIXME: remove the 'join' below
|
25
|
-
cmd_name = Trepan::SubSubcommand::SetDebugMacro::PREFIX.join('')
|
26
|
-
debugx_cmd = Trepan::SubSubcommand::SetDebugMacro.new(set_cmd.proc,
|
27
|
-
debug_cmd,
|
28
|
-
cmd_name)
|
29
|
-
# require_relative '../../../../lib/trepanning'
|
30
|
-
# dbgr = Trepan.new(:set_restart => true)
|
31
|
-
# dbgr.debugger
|
32
|
-
debugx_cmd.run([name])
|
33
|
-
debugx_cmd.run([name, 'off'])
|
34
|
-
debugx_cmd.run([name, 'on'])
|
17
|
+
require_relative '../debug'
|
18
|
+
cmd = MockDebugger::subsub_setup(Trepan::SubSubcommand::SetDebug,
|
19
|
+
Trepan::SubSubcommand::SetDebugMacro)
|
20
|
+
%w(off on 0 1).each { |arg| cmd.run([cmd.name, arg]) }
|
21
|
+
puts '-' * 10
|
22
|
+
puts cmd.save_command.join("\n")
|
35
23
|
end
|