trepanning 0.0.4 → 0.0.6
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 +161 -0
- data/NEWS +10 -0
- data/Rakefile +13 -19
- data/app/frame.rb +1 -1
- data/app/irb.rb +1 -1
- data/app/util.rb +3 -10
- data/data/irbrc +1 -1
- data/lib/trepanning.rb +2 -2
- data/processor/command/alias.rb +10 -11
- data/processor/command/backtrace.rb +8 -9
- data/processor/command/base/cmd.rb +4 -0
- data/processor/command/base/subcmd.rb +0 -1
- data/processor/command/base/submgr.rb +12 -3
- data/processor/command/break.rb +14 -15
- data/processor/command/condition.rb +11 -12
- data/processor/command/continue.rb +10 -11
- data/processor/command/debug.rb +7 -8
- data/processor/command/delete.rb +10 -9
- data/processor/command/directory.rb +1 -1
- data/processor/command/disable.rb +8 -9
- data/processor/command/disassemble.rb +7 -8
- data/processor/command/display.rb +10 -11
- data/processor/command/down.rb +8 -9
- data/processor/command/enable.rb +9 -10
- data/processor/command/exit.rb +11 -10
- data/processor/command/finish.rb +12 -11
- data/processor/command/frame.rb +3 -4
- data/processor/command/help.rb +14 -16
- data/processor/command/info.rb +7 -8
- data/processor/command/irb.rb +13 -14
- data/processor/command/kill.rb +21 -10
- data/processor/command/list.rb +36 -36
- data/processor/command/macro.rb +4 -5
- data/processor/command/next.rb +19 -20
- data/processor/command/nocache.rb +3 -4
- data/processor/command/{print.rb → pr.rb} +11 -9
- data/processor/command/ps.rb +8 -8
- data/processor/command/quit.rb +17 -15
- data/processor/command/raise.rb +11 -10
- data/processor/command/reload.rb +4 -5
- data/processor/command/restart.rb +11 -10
- data/processor/command/save.rb +12 -9
- data/processor/command/set.rb +14 -15
- data/processor/command/set_subcmd/debug_subcmd/dbgr.rb +1 -1
- data/processor/command/set_subcmd/debug_subcmd/skip.rb +1 -1
- data/processor/command/show.rb +7 -7
- data/processor/command/show_subcmd/alias.rb +3 -4
- data/processor/command/show_subcmd/args.rb +0 -2
- data/processor/command/show_subcmd/auto.rb +2 -3
- data/processor/command/show_subcmd/basename.rb +0 -3
- data/processor/command/show_subcmd/debug.rb +2 -1
- data/processor/command/show_subcmd/debug_subcmd/dbgr.rb +1 -1
- data/processor/command/show_subcmd/different.rb +0 -3
- data/processor/command/show_subcmd/events.rb +0 -2
- data/processor/command/show_subcmd/macro.rb +2 -5
- data/processor/command/show_subcmd/max.rb +2 -1
- data/processor/command/show_subcmd/trace.rb +2 -2
- data/processor/command/source.rb +9 -8
- data/processor/command/step.rb +28 -29
- data/processor/command/stepi.rb +1 -1
- data/processor/command/unalias.rb +4 -5
- data/processor/command/undisplay.rb +4 -5
- data/processor/command/up.rb +9 -10
- data/processor/eval.rb +6 -2
- data/processor/frame.rb +32 -26
- data/processor/main.rb +1 -1
- data/processor/mock.rb +9 -3
- data/processor/running.rb +11 -7
- data/processor/validate.rb +1 -2
- data/test/functional/test-fn_helper.rb +42 -0
- data/test/functional/test-raise.rb +1 -1
- data/test/functional/test-return.rb +2 -2
- data/test/unit/test-app-util.rb +3 -4
- data/test/unit/test-base-subcmd.rb +2 -1
- data/test/unit/test-cmd-help.rb +4 -4
- data/test/unit/test-proc-frame.rb +1 -2
- data/test/unit/test-proc-main.rb +1 -1
- metadata +10 -7
@@ -7,7 +7,7 @@ class Trepan::SubSubcommand::SetDebugSkip < Trepan::SetBoolSubSubcommand
|
|
7
7
|
HELP = 'Set debugging of statement skip logic'
|
8
8
|
MIN_ABBREV = 'sk'.size
|
9
9
|
NAME = File.basename(__FILE__, '.rb')
|
10
|
-
PREFIX = %
|
10
|
+
PREFIX = %W(set debug #{NAME})
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
data/processor/command/show.rb
CHANGED
@@ -4,16 +4,17 @@ require_relative 'base/submgr'
|
|
4
4
|
|
5
5
|
class Trepan::Command::ShowCommand < Trepan::SubcommandMgr
|
6
6
|
unless defined?(HELP)
|
7
|
-
|
7
|
+
NAME = File.basename(__FILE__, '.rb')
|
8
|
+
HELP = <<-HELP
|
8
9
|
'Generic command for showing things about the debugger. You can
|
9
10
|
give unique prefix of the name of a subcommand to get information
|
10
11
|
about just that subcommand.
|
11
12
|
|
12
|
-
Type "
|
13
|
-
Type "help
|
13
|
+
Type "#{NAME}" for a list of "#{NAME}" subcommands and what they do.
|
14
|
+
Type "help #{NAME} *" for just a list of "#{NAME}" subcommands.
|
15
|
+
HELP
|
14
16
|
|
15
17
|
CATEGORY = 'status'
|
16
|
-
NAME = File.basename(__FILE__, '.rb')
|
17
18
|
NEED_STACK = false
|
18
19
|
SHORT_HELP = 'Show parts of the debugger environment'
|
19
20
|
end
|
@@ -21,7 +22,6 @@ end
|
|
21
22
|
|
22
23
|
if __FILE__ == $0
|
23
24
|
require_relative '../mock'
|
24
|
-
|
25
|
-
|
26
|
-
cmd.run([name])
|
25
|
+
dbgr, cmd = MockDebugger::setup
|
26
|
+
cmd.run([cmd.name])
|
27
27
|
end
|
@@ -10,8 +10,7 @@ If aliases names are given, show their definition. If left blank, show
|
|
10
10
|
all alias names"
|
11
11
|
|
12
12
|
MIN_ABBREV = 'al'.size
|
13
|
-
NAME
|
14
|
-
PREFIX = %w(show alias)
|
13
|
+
NAME = File.basename(__FILE__, '.rb')
|
15
14
|
SHORT_HELP = "Show defined aliases"
|
16
15
|
end
|
17
16
|
|
@@ -45,6 +44,6 @@ if __FILE__ == $0
|
|
45
44
|
name = File.basename(__FILE__, '.rb')
|
46
45
|
subcommand.summary_help(name)
|
47
46
|
puts
|
48
|
-
subcommand.run(%
|
49
|
-
subcommand.run(%w(show
|
47
|
+
subcommand.run(%W(show #{name}))
|
48
|
+
subcommand.run(%w(show #{name} u foo))
|
50
49
|
end
|
@@ -7,7 +7,8 @@ class Trepan::SubSubcommand::ShowAuto < Trepan::SubSubcommandMgr
|
|
7
7
|
unless defined?(HELP)
|
8
8
|
HELP = 'Show settings which some sort of "automatic" default behavior'
|
9
9
|
NAME = File.basename(__FILE__, '.rb')
|
10
|
-
PREFIX = %
|
10
|
+
PREFIX = %W(show #{NAME})
|
11
|
+
MIN_ABBREV = 'au'.size
|
11
12
|
end
|
12
13
|
end
|
13
14
|
|
@@ -21,7 +22,5 @@ if __FILE__ == $0
|
|
21
22
|
name = File.basename(__FILE__, '.rb')
|
22
23
|
cmd_args = ['show', name]
|
23
24
|
show_cmd.instance_variable_set('@last_args', cmd_args)
|
24
|
-
# require_relative '../../../lib/trepanning'
|
25
|
-
# Trepan.debug(:set_restart => true)
|
26
25
|
command.run(cmd_args)
|
27
26
|
end
|
@@ -6,8 +6,6 @@ class Trepan::Subcommand::ShowBasename < Trepan::ShowBoolSubcommand
|
|
6
6
|
unless defined?(HELP)
|
7
7
|
HELP = "Show only file basename in showing file names"
|
8
8
|
MIN_ABBREV = 'ba'.size
|
9
|
-
NAME = File.basename(__FILE__, '.rb')
|
10
|
-
PREFIX = %w(show basename)
|
11
9
|
end
|
12
10
|
|
13
11
|
end
|
@@ -15,7 +13,6 @@ end
|
|
15
13
|
if __FILE__ == $0
|
16
14
|
# Demo it.
|
17
15
|
require_relative '../../mock'
|
18
|
-
name = File.basename(__FILE__, '.rb')
|
19
16
|
|
20
17
|
# FIXME: DRY the below code
|
21
18
|
dbgr, cmd = MockDebugger::setup('show')
|
@@ -7,7 +7,8 @@ class Trepan::SubSubcommand::ShowDebug < Trepan::SubSubcommandMgr
|
|
7
7
|
unless defined?(HELP)
|
8
8
|
HELP = 'Show internal debugger settings.'
|
9
9
|
NAME = File.basename(__FILE__, '.rb')
|
10
|
-
PREFIX = %
|
10
|
+
PREFIX = %W(show #{NAME})
|
11
|
+
MIN_ABBREV = 'de'.size
|
11
12
|
end
|
12
13
|
end
|
13
14
|
|
@@ -6,8 +6,6 @@ class Trepan::Subcommand::ShowDifferent < Trepan::ShowBoolSubcommand
|
|
6
6
|
unless defined?(HELP)
|
7
7
|
HELP = "Show status of 'set different'"
|
8
8
|
MIN_ABBREV = 'dif'.size
|
9
|
-
PREFIX = %w(show different)
|
10
|
-
NAME = File.basename(__FILE__, '.rb')
|
11
9
|
end
|
12
10
|
|
13
11
|
def run(args)
|
@@ -24,7 +22,6 @@ end
|
|
24
22
|
if __FILE__ == $0
|
25
23
|
# Demo it.
|
26
24
|
require_relative '../../mock'
|
27
|
-
name = File.basename(__FILE__, '.rb')
|
28
25
|
|
29
26
|
# FIXME: DRY the below code
|
30
27
|
dbgr, cmd = MockDebugger::setup('exit')
|
@@ -7,7 +7,6 @@ class Trepan::Subcommand::ShowEvents < Trepan::Subcommand
|
|
7
7
|
HELP = 'Show trace events we may stop on.'
|
8
8
|
MIN_ABBREV = 'ev'.size
|
9
9
|
NAME = File.basename(__FILE__, '.rb')
|
10
|
-
PREFIX = %w(show events)
|
11
10
|
end
|
12
11
|
|
13
12
|
# FIXME: this really should be a subcommand of "set trace"
|
@@ -26,7 +25,6 @@ end
|
|
26
25
|
if __FILE__ == $0
|
27
26
|
# Demo it.
|
28
27
|
require_relative '../../mock'
|
29
|
-
name = File.basename(__FILE__, '.rb')
|
30
28
|
|
31
29
|
# FIXME: DRY the below code
|
32
30
|
dbgr, cmd = MockDebugger::setup('exit')
|
@@ -6,8 +6,6 @@ class Trepan::Subcommand::ShowMacro < Trepan::Subcommand
|
|
6
6
|
unless defined?(HELP)
|
7
7
|
HELP = "Show defined macros"
|
8
8
|
MIN_ABBREV = 'ma'.size
|
9
|
-
NAME = File.basename(__FILE__, '.rb')
|
10
|
-
PREFIX = %w(show macro)
|
11
9
|
end
|
12
10
|
|
13
11
|
def run(args)
|
@@ -31,7 +29,6 @@ end
|
|
31
29
|
if __FILE__ == $0
|
32
30
|
# Demo it.
|
33
31
|
require_relative '../../mock'
|
34
|
-
name = File.basename(__FILE__, '.rb')
|
35
32
|
|
36
33
|
# FIXME: DRY the below code
|
37
34
|
dbgr, cmd = MockDebugger::setup('show')
|
@@ -40,6 +37,6 @@ if __FILE__ == $0
|
|
40
37
|
|
41
38
|
name = File.basename(__FILE__, '.rb')
|
42
39
|
subcommand.summary_help(name)
|
43
|
-
subcommand.run(%
|
44
|
-
subcommand.run(%
|
40
|
+
subcommand.run(%W(show #{name}))
|
41
|
+
subcommand.run(%W(show #{name} u foo))
|
45
42
|
end
|
@@ -7,7 +7,8 @@ class Trepan::SubSubcommand::ShowMax < Trepan::SubSubcommandMgr
|
|
7
7
|
unless defined?(HELP)
|
8
8
|
HELP = 'Show "maximum length" settings'
|
9
9
|
NAME = File.basename(__FILE__, '.rb')
|
10
|
-
PREFIX = %
|
10
|
+
PREFIX = %W(show #{NAME})
|
11
|
+
MIN_ABBREV = NAME.size
|
11
12
|
end
|
12
13
|
|
13
14
|
def run(args)
|
@@ -7,9 +7,9 @@ class Trepan::SubSubcommand::ShowTrace < Trepan::SubSubcommandMgr
|
|
7
7
|
|
8
8
|
unless defined?(HELP)
|
9
9
|
HELP = "Show event tracing printing"
|
10
|
-
MIN_ABBREV = 'tr'.size
|
11
10
|
NAME = File.basename(__FILE__, '.rb')
|
12
|
-
PREFIX = %
|
11
|
+
PREFIX = %W(show #{NAME})
|
12
|
+
MIN_ABBREV = 'tr'.size
|
13
13
|
SHORT_HELP = HELP
|
14
14
|
end
|
15
15
|
end
|
data/processor/command/source.rb
CHANGED
@@ -8,7 +8,9 @@ require_relative '../../interface/script'
|
|
8
8
|
|
9
9
|
class Trepan::Command::SourceCommand < Trepan::Command
|
10
10
|
unless defined?(HELP)
|
11
|
-
|
11
|
+
NAME = File.basename(__FILE__, '.rb')
|
12
|
+
HELP = <<-HELP
|
13
|
+
#{NAME} [-v][-Y|-N][-c] FILE
|
12
14
|
|
13
15
|
Read debugger commands from a file named FILE. Optional -v switch
|
14
16
|
(before the filename) causes each command in FILE to be echoed as it
|
@@ -16,15 +18,14 @@ is executed. Option -Y sets the default value in any confirmation
|
|
16
18
|
command to be 'yes' and -N sets the default value to 'no'.
|
17
19
|
|
18
20
|
Note that the command startup file '.pydbgrc' is read automatically
|
19
|
-
via a
|
21
|
+
via a #{NAME} command the debugger is started.
|
20
22
|
|
21
23
|
An error in any command terminates execution of the command file
|
22
24
|
unless option -c is given.
|
23
|
-
|
25
|
+
HELP
|
24
26
|
CATEGORY = 'support'
|
25
27
|
MIN_ARGS = 1 # Need at least this many
|
26
28
|
MAX_ARGS = nil
|
27
|
-
NAME = File.basename(__FILE__, '.rb')
|
28
29
|
SHORT_HELP = 'Read and run debugger commands from a file'
|
29
30
|
end
|
30
31
|
|
@@ -66,9 +67,9 @@ end
|
|
66
67
|
# Demo it
|
67
68
|
if __FILE__ == $0
|
68
69
|
require_relative '../mock'
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
cmd.run([name, *ARGV])
|
70
|
+
dbgr, cmd = MockDebugger::setup
|
71
|
+
if ARGV.size >= 1
|
72
|
+
puts "running... #{cmd.name} #{ARGV}"
|
73
|
+
cmd.run([cmd.name, *ARGV])
|
73
74
|
end
|
74
75
|
end
|
data/processor/command/step.rb
CHANGED
@@ -5,13 +5,14 @@ require_relative '../../app/condition'
|
|
5
5
|
class Trepan::Command::StepCommand < Trepan::Command
|
6
6
|
|
7
7
|
unless defined?(HELP)
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
8
|
+
NAME = File.basename(__FILE__, '.rb')
|
9
|
+
HELP = <<-HELP
|
10
|
+
#{NAME}[+|=|-|<|>|!|<>] [into] [EVENT-NAME...] [count]
|
11
|
+
#{NAME} until EXPRESSION
|
12
|
+
#{NAME} thread
|
13
|
+
#{NAME} to METHOD-NAME
|
14
|
+
#{NAME} over
|
15
|
+
#{NAME} out
|
15
16
|
|
16
17
|
Execute the current line, stopping at the next event. Sometimes this
|
17
18
|
is called 'step into'.
|
@@ -37,23 +38,23 @@ If no suffix is given, the debugger setting 'different' determines
|
|
37
38
|
this behavior.
|
38
39
|
|
39
40
|
Examples:
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
41
|
+
#{NAME} # step 1 event, *any* event obeying 'set different' setting
|
42
|
+
#{NAME} 1 # same as above
|
43
|
+
#{NAME}+ # same but force stopping on a new line
|
44
|
+
#{NAME}= # same but force stopping on a new line a new frame added
|
45
|
+
#{NAME}- # same but force stopping on a new line a new frame added
|
46
|
+
#{NAME} 5/5+0 # same as above
|
47
|
+
#{NAME} line # step only line events
|
48
|
+
#{NAME} call # step only call call events
|
49
|
+
#{NAME}> # step call and c-call events
|
50
|
+
#{NAME}< # step only return and c-return events
|
51
|
+
#{NAME} call line # step line *and* call events
|
52
|
+
#{NAME}<> # same as step call c-call return c-return
|
53
|
+
#{NAME} until a > b
|
54
|
+
#{NAME} over # same as 'next'
|
55
|
+
#{NAME} out # same as 'finish'
|
56
|
+
#{NAME} thread # step stopping only in the current thread. Is the same
|
57
|
+
# as step until Thread.current.object_id == #object_id
|
57
58
|
|
58
59
|
Related and similar is the 'next' (step over) and 'finish' (step out)
|
59
60
|
commands. All of these are slower than running to a breakpoint.
|
@@ -61,12 +62,11 @@ commands. All of these are slower than running to a breakpoint.
|
|
61
62
|
See also the commands:
|
62
63
|
'skip', 'jump' (there's no 'hop' yet), 'continue', 'return' and
|
63
64
|
'finish' for other ways to progress execution.
|
64
|
-
|
65
|
+
HELP
|
65
66
|
|
66
67
|
ALIASES = %w(s step+ step- step< step> step<> step! s> s< s+ s-
|
67
68
|
s<> s! s=)
|
68
69
|
CATEGORY = 'running'
|
69
|
-
NAME = File.basename(__FILE__, '.rb')
|
70
70
|
NEED_RUNNING = true
|
71
71
|
SHORT_HELP = 'Step program (possibly entering called functions)'
|
72
72
|
|
@@ -133,7 +133,6 @@ end
|
|
133
133
|
|
134
134
|
if __FILE__ == $0
|
135
135
|
require_relative '../mock'
|
136
|
-
|
137
|
-
|
138
|
-
p cmd.run([name])
|
136
|
+
dbgr, cmd = MockDebugger::setup
|
137
|
+
p cmd.run([cmd.name])
|
139
138
|
end
|
data/processor/command/stepi.rb
CHANGED
@@ -36,9 +36,8 @@ end
|
|
36
36
|
if __FILE__ == $0
|
37
37
|
# Demo it.
|
38
38
|
require_relative '../mock'
|
39
|
-
|
40
|
-
|
41
|
-
cmd.run %
|
42
|
-
cmd.run %
|
43
|
-
cmd.run %w(unalias foo bar n)
|
39
|
+
dbgr, cmd = MockDebugger::setup
|
40
|
+
cmd.run %W(cmd.name s)
|
41
|
+
cmd.run %W(cmd.name s)
|
42
|
+
cmd.run %W(cmd.name foo bar n)
|
44
43
|
end
|
@@ -6,6 +6,7 @@ require_relative 'base/cmd'
|
|
6
6
|
class Trepan::Command::UndisplayCommand < Trepan::Command
|
7
7
|
|
8
8
|
unless defined?(HELP)
|
9
|
+
NAME = File.basename(__FILE__, '.rb')
|
9
10
|
HELP = <<EOH
|
10
11
|
|
11
12
|
undisplay DISPLAY_NUMBER ...
|
@@ -18,7 +19,6 @@ EOH
|
|
18
19
|
|
19
20
|
ALIASES = %w(und)
|
20
21
|
CATEGORY = 'data'
|
21
|
-
NAME = File.basename(__FILE__, '.rb')
|
22
22
|
NEED_STACK = false
|
23
23
|
SHORT_HELP = 'Cancel some expressions to be displayed when program stops'
|
24
24
|
end
|
@@ -48,8 +48,7 @@ if __FILE__ == $0
|
|
48
48
|
# demo it.
|
49
49
|
require 'thread_frame'
|
50
50
|
require_relative '../mock'
|
51
|
-
|
52
|
-
dbgr, cmd = MockDebugger::setup(name)
|
51
|
+
dbgr, cmd = MockDebugger::setup
|
53
52
|
|
54
53
|
def run_cmd(cmd, args)
|
55
54
|
cmd.run(args)
|
@@ -58,6 +57,6 @@ if __FILE__ == $0
|
|
58
57
|
|
59
58
|
cmd.proc.frame_setup(RubyVM::ThreadFrame::current)
|
60
59
|
|
61
|
-
run_cmd(cmd, %
|
62
|
-
run_cmd(cmd, %
|
60
|
+
run_cmd(cmd, %W(#{cmd.name} z))
|
61
|
+
run_cmd(cmd, %W(#{cmd.name} 1 10))
|
63
62
|
end
|
data/processor/command/up.rb
CHANGED
@@ -9,19 +9,19 @@ class Trepan::Command::UpCommand < Trepan::Command
|
|
9
9
|
# Silence already initialized constant .. warnings
|
10
10
|
old_verbose = $VERBOSE
|
11
11
|
$VERBOSE = nil
|
12
|
-
|
13
|
-
|
12
|
+
NAME = File.basename(__FILE__, '.rb')
|
13
|
+
HELP = <<-HELP
|
14
|
+
#{NAME} [count]
|
14
15
|
|
15
16
|
Move the current frame up in the stack trace (to an older frame). 0 is
|
16
17
|
the most recent frame. If no count is given, move up 1.
|
17
18
|
|
18
19
|
See also 'down' and 'frame'.
|
19
|
-
|
20
|
+
HELP
|
20
21
|
|
21
22
|
ALIASES = %w(u)
|
22
23
|
CATEGORY = 'stack'
|
23
24
|
MAX_ARGS = 1 # Need at most this many
|
24
|
-
NAME = File.basename(__FILE__, '.rb')
|
25
25
|
NEED_STACK = true
|
26
26
|
SHORT_HELP = 'Move frame in the direction of the caller of the last-selected frame'
|
27
27
|
$VERBOSE = old_verbose
|
@@ -67,14 +67,13 @@ if __FILE__ == $0
|
|
67
67
|
# Demo it.
|
68
68
|
require 'thread_frame'
|
69
69
|
require_relative '../mock'
|
70
|
-
|
71
|
-
dbgr, cmd = MockDebugger::setup(name)
|
70
|
+
dbgr, cmd = MockDebugger::setup
|
72
71
|
|
73
72
|
def sep ; puts '=' * 40 end
|
74
|
-
cmd.run [name]
|
73
|
+
cmd.run [cmd.name]
|
75
74
|
%w(-1 0 1 -2).each do |count|
|
76
|
-
puts "#{name} #{count}"
|
77
|
-
cmd.run([name, count])
|
75
|
+
puts "#{cmd.name} #{count}"
|
76
|
+
cmd.run([cmd.name, count])
|
78
77
|
sep
|
79
78
|
end
|
80
79
|
def foo(cmd, name)
|
@@ -88,5 +87,5 @@ if __FILE__ == $0
|
|
88
87
|
sep
|
89
88
|
end
|
90
89
|
end
|
91
|
-
foo(cmd, name)
|
90
|
+
foo(cmd, cmd.name)
|
92
91
|
end
|