rb8-trepanning 0.1.3 → 0.1.4
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/CHANGES +10 -0
- data/ChangeLog +276 -0
- data/Makefile +13 -0
- data/Rakefile +1 -2
- data/app/display.rb +41 -1
- data/app/irb.rb +55 -49
- data/app/options.rb +3 -2
- data/app/run.rb +25 -7
- data/app/util.rb +19 -1
- data/bin/trepan8 +0 -2
- data/data/perldb.bindings +17 -0
- data/interface/script.rb +1 -1
- data/interface/server.rb +1 -1
- data/interface/user.rb +3 -1
- data/{interface/base_intf.rb → interface.rb} +1 -1
- data/io/input.rb +1 -1
- data/io/null_output.rb +1 -1
- data/io/string_array.rb +2 -2
- data/io/tcpclient.rb +1 -1
- data/io/tcpserver.rb +1 -1
- data/{io/base_io.rb → io.rb} +0 -0
- data/lib/debugger.rb +0 -1
- data/lib/trepanning.rb +3 -1
- data/processor/command/alias.rb +13 -2
- data/processor/command/backtrace.rb +2 -1
- data/processor/command/base/subcmd.rb +1 -5
- data/processor/command/base/submgr.rb +1 -1
- data/processor/command/base/subsubcmd.rb +1 -1
- data/processor/command/base/subsubmgr.rb +4 -4
- data/processor/command/break.rb +19 -11
- data/processor/command/catch.rb +1 -1
- data/processor/command/complete.rb +1 -1
- data/processor/command/continue.rb +7 -1
- data/processor/command/directory.rb +2 -2
- data/processor/command/disable.rb +13 -14
- data/processor/command/display.rb +3 -1
- data/processor/command/down.rb +8 -8
- data/processor/command/edit.rb +1 -1
- data/processor/command/enable.rb +21 -22
- data/processor/command/eval.rb +1 -2
- data/processor/command/exit.rb +25 -8
- data/processor/command/finish.rb +7 -2
- data/processor/command/frame.rb +1 -1
- data/processor/command/help.rb +3 -4
- data/processor/command/info.rb +2 -0
- data/processor/command/info_subcmd/files.rb +2 -2
- data/processor/command/info_subcmd/locals.rb +6 -53
- data/processor/command/info_subcmd/source.rb +10 -4
- data/processor/command/info_subcmd/variables.rb +35 -0
- data/processor/command/info_subcmd/variables_subcmd/.gitignore +1 -0
- data/processor/command/info_subcmd/variables_subcmd/class.rb +42 -0
- data/processor/command/info_subcmd/variables_subcmd/constant.rb +42 -0
- data/processor/command/info_subcmd/{globals.rb → variables_subcmd/globals.rb} +22 -17
- data/processor/command/info_subcmd/variables_subcmd/instance.rb +42 -0
- data/processor/command/info_subcmd/variables_subcmd/locals.rb +80 -0
- data/processor/command/kill.rb +8 -7
- data/processor/command/list.rb +2 -2
- data/processor/command/macro.rb +27 -9
- data/processor/command/next.rb +1 -1
- data/processor/command/parsetree.rb +1 -1
- data/processor/command/pp.rb +1 -1
- data/processor/command/pr.rb +1 -1
- data/processor/command/ps.rb +1 -1
- data/processor/command/restart.rb +1 -1
- data/processor/command/save.rb +1 -1
- data/processor/command/set_subcmd/auto.rb +7 -1
- data/processor/command/set_subcmd/different.rb +1 -1
- data/processor/command/set_subcmd/trace.rb +5 -4
- data/processor/command/set_subcmd/trace_subcmd/print.rb +4 -3
- data/processor/command/shell.rb +5 -4
- data/processor/command/show_subcmd/{alias.rb → aliases.rb} +2 -2
- data/processor/command/source.rb +1 -1
- data/processor/command/step.rb +2 -5
- data/processor/command/tbreak.rb +1 -1
- data/processor/command/unalias.rb +13 -8
- data/processor/command/undisplay.rb +13 -9
- data/processor/command/up.rb +12 -14
- data/processor/command.rb +138 -230
- data/processor/display.rb +46 -10
- data/processor/help.rb +5 -3
- data/processor/hook.rb +2 -2
- data/processor/location.rb +25 -0
- data/processor/mock.rb +3 -2
- data/processor/msg.rb +55 -42
- data/processor/old-command.rb +270 -0
- data/processor/{processor.rb → old-processor.rb} +7 -8
- data/processor/running.rb +7 -12
- data/processor/subcmd.rb +15 -41
- data/processor/validate.rb +240 -238
- data/{processor/main.rb → processor.rb} +20 -42
- data/test/data/trace.cmd +6 -0
- data/test/data/trace.right +46 -0
- data/test/integration/helper.rb +2 -0
- data/test/integration/test-trace.rb +29 -0
- data/test/unit/cmd-helper.rb +2 -3
- data/test/unit/test-app-options.rb +13 -11
- data/test/unit/test-app-run.rb +7 -1
- data/test/unit/test-base-cmd.rb +1 -1
- data/test/unit/test-cmd-kill.rb +11 -4
- data/test/unit/test-io-tcpserver.rb +9 -4
- data/test/unit/test-proc-eval.rb +1 -2
- data/test/unit/test-proc-location.rb +26 -32
- data/test/unit/test-subcmd-help.rb +1 -1
- data/trepan8.gemspec +9 -1
- metadata +60 -17
- data/processor/command/base/cmd.rb +0 -177
@@ -7,14 +7,15 @@ require_relative '../base/subsubmgr'
|
|
7
7
|
class Trepan::SubSubcommand::SetTrace < Trepan::SubSubcommandMgr
|
8
8
|
unless defined?(HELP)
|
9
9
|
Trepanning::Subcommand.set_name_prefix(__FILE__, self)
|
10
|
-
HELP =
|
10
|
+
HELP = <<-EOH
|
11
|
+
Set tracing of various sorts.
|
11
12
|
|
12
13
|
The types of tracing include events from the trace buffer, or printing
|
13
14
|
those events.
|
14
15
|
|
15
|
-
See
|
16
|
-
|
17
|
-
|
16
|
+
See "help #{PREFIX.join(' ')} *" for a list of subcommands or "#{PREFIX.join(' ')} <name>"
|
17
|
+
for help on a particular trace subcommand.
|
18
|
+
EOH
|
18
19
|
IN_LIST = true
|
19
20
|
MIN_ABBREV = 'tr'.size
|
20
21
|
SHORT_HELP = 'Set tracing of various sorts.'
|
@@ -7,13 +7,14 @@ class Trepan::SubSubcommand::SetTracePrint < Trepan::SetBoolSubSubcommand
|
|
7
7
|
unless defined?(HELP)
|
8
8
|
Trepanning::SubSubcommand.set_name_prefix(__FILE__, self)
|
9
9
|
HELP = <<-EOH
|
10
|
-
#{CMD} [on|off
|
10
|
+
#{CMD} [on|off]
|
11
11
|
|
12
|
-
Set printing trace events.
|
12
|
+
Set printing trace events. This is similar to "set -x" tracing in
|
13
|
+
POSIX shells.
|
13
14
|
EOH
|
14
15
|
|
15
16
|
MIN_ABBREV = 'p'.size
|
16
|
-
SHORT_HELP = 'Set print trace events'
|
17
|
+
SHORT_HELP = 'Set print trace events, like "set -x" of POSIX shell'
|
17
18
|
end
|
18
19
|
|
19
20
|
def run(args)
|
data/processor/command/shell.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
2
2
|
require 'rubygems'; require 'require_relative'
|
3
|
-
require_relative '
|
4
|
-
Trepan.suppress_warnings { require 'irb' }
|
5
|
-
require_relative 'base/cmd'
|
3
|
+
require_relative '../command'
|
6
4
|
require_relative '../../app/irb'
|
7
5
|
|
8
6
|
class Trepan::Command::IRBCommand < Trepan::Command
|
9
7
|
|
10
8
|
unless defined?(HELP)
|
9
|
+
require_relative '../../io/input' # For GNU_readline? and supress_warnings
|
10
|
+
Trepan.suppress_warnings { require 'irb' }
|
11
11
|
NAME = File.basename(__FILE__, '.rb')
|
12
12
|
HELP = <<-HELP
|
13
13
|
#{NAME} [-d]
|
@@ -62,8 +62,8 @@ Here then is a loop to query VM stack values:
|
|
62
62
|
end
|
63
63
|
|
64
64
|
$trepan = @proc.dbgr
|
65
|
+
$trepan_cmdproc = @proc
|
65
66
|
if add_debugging
|
66
|
-
$trepan_cmdproc = @proc
|
67
67
|
$trepan_frame = @proc.frame
|
68
68
|
end
|
69
69
|
$trepan_in_irb = true
|
@@ -127,6 +127,7 @@ end
|
|
127
127
|
|
128
128
|
if __FILE__ == $0
|
129
129
|
require_relative '../mock'
|
130
|
+
require_relative '../../app/irb'
|
130
131
|
# dbgr, cmd = MockDebugger::setup
|
131
132
|
dbgr, cmd = MockDebugger::setup(nil, false)
|
132
133
|
cmd.proc.frame.instance_variable_set('@binding', binding)
|
@@ -3,7 +3,7 @@
|
|
3
3
|
require 'rubygems'; require 'require_relative'
|
4
4
|
require_relative '../base/subcmd'
|
5
5
|
|
6
|
-
class Trepan::Subcommand::
|
6
|
+
class Trepan::Subcommand::ShowAliases < Trepan::Subcommand
|
7
7
|
Trepanning::Subcommand.set_name_prefix(__FILE__, self)
|
8
8
|
unless defined?(HELP)
|
9
9
|
HELP = <<-EOH
|
@@ -32,7 +32,7 @@ all alias names
|
|
32
32
|
elsif @proc.aliases.empty?
|
33
33
|
msg "No aliases defined."
|
34
34
|
else
|
35
|
-
section "List of
|
35
|
+
section "List of alias names currently defined:"
|
36
36
|
msg columnize_commands(@proc.aliases.keys.sort)
|
37
37
|
end
|
38
38
|
end
|
data/processor/command/source.rb
CHANGED
@@ -4,7 +4,7 @@ require 'optparse'
|
|
4
4
|
|
5
5
|
# Our local modules
|
6
6
|
require 'rubygems'; require 'require_relative'
|
7
|
-
require_relative '
|
7
|
+
require_relative '../command'
|
8
8
|
require_relative '../../interface/script'
|
9
9
|
require_relative '../../io/null_output'
|
10
10
|
require_relative '../../app/default'
|
data/processor/command/step.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
2
2
|
require 'rubygems'; require 'require_relative'
|
3
|
-
require_relative '
|
3
|
+
require_relative '../command'
|
4
4
|
|
5
5
|
class Trepan::Command::StepCommand < Trepan::Command
|
6
6
|
|
@@ -68,10 +68,7 @@ See also the commands:
|
|
68
68
|
step_count = @proc.get_an_int(step_str, count_opts)
|
69
69
|
return unless step_count
|
70
70
|
end
|
71
|
-
|
72
|
-
@proc.context.step(step_count, opts[:different_pos])
|
73
|
-
@proc.state.proceed
|
74
|
-
@proc.leave_cmd_loop = true
|
71
|
+
@proc.step(step_count, opts)
|
75
72
|
end
|
76
73
|
end
|
77
74
|
|
data/processor/command/tbreak.rb
CHANGED
@@ -1,17 +1,18 @@
|
|
1
|
-
# Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
|
1
|
+
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
2
2
|
require 'rubygems'; require 'require_relative'
|
3
|
-
require_relative '
|
3
|
+
require_relative '../command'
|
4
|
+
require_relative '../../app/complete'
|
4
5
|
|
5
6
|
class Trepan::Command::UnaliasCommand < Trepan::Command
|
6
7
|
|
7
8
|
unless defined?(HELP)
|
8
|
-
HELP =
|
9
|
-
|
9
|
+
HELP = <<-HELP
|
10
|
+
unalias ALIAS
|
10
11
|
|
11
|
-
Remove alias
|
12
|
+
Remove alias ALIAS
|
12
13
|
|
13
14
|
See also 'alias'.
|
14
|
-
|
15
|
+
HELP
|
15
16
|
|
16
17
|
CATEGORY = 'support'
|
17
18
|
MIN_ARGS = 1
|
@@ -21,6 +22,10 @@ See also 'alias'.
|
|
21
22
|
SHORT_HELP = 'Remove an alias'
|
22
23
|
end
|
23
24
|
|
25
|
+
def complete(prefix)
|
26
|
+
Trepan::Complete.complete_token(@proc.aliases.keys, prefix)
|
27
|
+
end
|
28
|
+
|
24
29
|
# Run command.
|
25
30
|
def run(args)
|
26
31
|
args[1..-1].each do |arg|
|
@@ -38,7 +43,7 @@ if __FILE__ == $0
|
|
38
43
|
# Demo it.
|
39
44
|
require_relative '../mock'
|
40
45
|
dbgr, cmd = MockDebugger::setup
|
41
|
-
cmd.run %w(cmd.name
|
42
|
-
cmd.run %w(cmd.name
|
46
|
+
cmd.run %w(cmd.name n)
|
47
|
+
cmd.run %w(cmd.name n)
|
43
48
|
cmd.run %w(cmd.name foo bar c)
|
44
49
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
3
3
|
require 'rubygems'; require 'require_relative'
|
4
|
-
require_relative '
|
4
|
+
require_relative '../command'
|
5
5
|
|
6
6
|
# undisplay display-number...
|
7
7
|
class Trepan::Command::UndisplayCommand < Trepan::Command
|
@@ -9,37 +9,41 @@ class Trepan::Command::UndisplayCommand < Trepan::Command
|
|
9
9
|
unless defined?(HELP)
|
10
10
|
NAME = File.basename(__FILE__, '.rb')
|
11
11
|
HELP = <<EOH
|
12
|
-
|
12
|
+
#{NAME} DISPLAY_NUMBER ...
|
13
13
|
Cancel some expressions to be displayed when program stops.
|
14
14
|
Arguments are the code numbers of the expressions to stop displaying.
|
15
15
|
No argument means cancel all automatic-display expressions.
|
16
16
|
"delete display" has the same effect as this command.
|
17
|
-
|
17
|
+
Use "info display" to see current list of display numbers.
|
18
18
|
EOH
|
19
19
|
|
20
|
-
ALIASES = %w(und)
|
21
20
|
CATEGORY = 'data'
|
22
21
|
NEED_STACK = false
|
23
22
|
SHORT_HELP = 'Cancel some expressions to be displayed when program stops'
|
24
23
|
end
|
25
24
|
|
25
|
+
def complete(prefix)
|
26
|
+
@proc.displays.nums.map{|disp| disp.to_s}
|
27
|
+
end
|
28
|
+
|
26
29
|
def run(args)
|
27
30
|
|
28
31
|
if args.size == 1
|
29
|
-
|
30
|
-
|
32
|
+
if confirm('Delete all displays?', false)
|
33
|
+
@proc.displays.clear
|
34
|
+
return
|
35
|
+
end
|
31
36
|
end
|
32
37
|
opts = {}
|
33
38
|
args[1..-1].each do |arg|
|
34
|
-
opts
|
39
|
+
opts = {:msg_on_error => '%s must be a display number' % arg}
|
35
40
|
i = @proc.get_an_int(arg, opts)
|
36
41
|
if i
|
37
42
|
unless @proc.displays.delete_index(i)
|
38
|
-
errmsg("
|
43
|
+
errmsg("No display number %d." % i)
|
39
44
|
return
|
40
45
|
end
|
41
46
|
end
|
42
|
-
return false
|
43
47
|
end
|
44
48
|
end
|
45
49
|
end
|
data/processor/command/up.rb
CHANGED
@@ -1,17 +1,15 @@
|
|
1
|
-
# Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
|
1
|
+
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
2
2
|
require 'rubygems'; require 'require_relative'
|
3
|
-
require_relative '
|
3
|
+
require_relative '../command'
|
4
4
|
|
5
|
-
# up command. Like 'down'
|
5
|
+
# up command. Like 'down' but the direction (set by DIRECTION) is different.
|
6
6
|
#
|
7
7
|
# NOTE: The down command subclasses this, so beware when changing!
|
8
8
|
class Trepan::Command::UpCommand < Trepan::Command
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
NAME = File.basename(__FILE__, '.rb')
|
14
|
-
HELP = <<-HELP
|
10
|
+
Trepan::Util.suppress_warnings {
|
11
|
+
NAME = File.basename(__FILE__, '.rb')
|
12
|
+
HELP = <<-HELP
|
15
13
|
#{NAME} [count]
|
16
14
|
|
17
15
|
Move the current frame up in the stack trace (to an older frame). 0 is
|
@@ -20,12 +18,12 @@ the most recent frame. If no count is given, move up 1.
|
|
20
18
|
See also 'down' and 'frame'.
|
21
19
|
HELP
|
22
20
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
21
|
+
ALIASES = %w(u)
|
22
|
+
CATEGORY = 'stack'
|
23
|
+
MAX_ARGS = 1 # Need at most this many
|
24
|
+
NEED_STACK = true
|
25
|
+
SHORT_HELP = 'Move frame in the direction of the caller of the last-selected frame'
|
26
|
+
}
|
29
27
|
|
30
28
|
def complete(prefix)
|
31
29
|
@proc.frame_complete(prefix, @direction)
|