trepanning 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +354 -0
- data/NEWS +21 -0
- data/Rakefile +27 -20
- data/app/cmd_parse.kpeg +20 -4
- data/app/cmd_parse.rb +11 -10
- data/app/cmd_parser.rb +119 -55
- data/app/complete.rb +1 -0
- data/app/core.rb +3 -3
- data/app/disassemble.rb +13 -3
- data/app/file.rb +2 -1
- data/app/frame.rb +3 -1
- data/app/mock.rb +3 -0
- data/app/options.rb +48 -31
- data/app/util.rb +50 -0
- data/interface/base_intf.rb +4 -0
- data/interface/client.rb +4 -0
- data/interface/script.rb +1 -1
- data/interface/server.rb +4 -0
- data/interface/user.rb +5 -0
- data/io/input.rb +3 -2
- data/io/null_output.rb +7 -1
- data/processor/breakpoint.rb +3 -2
- data/processor/command/base/subcmd.rb +1 -1
- data/processor/command/base/submgr.rb +4 -1
- data/processor/command/base/subsubcmd.rb +2 -2
- data/processor/command/base/subsubmgr.rb +1 -1
- data/processor/command/break.rb +7 -3
- data/processor/command/complete.rb +1 -0
- data/processor/command/continue.rb +1 -1
- data/processor/command/disassemble.rb +1 -1
- data/processor/command/edit.rb +35 -14
- data/processor/command/enable.rb +5 -3
- data/processor/command/eval.rb +35 -14
- data/processor/command/exit.rb +2 -0
- data/processor/command/help.rb +0 -9
- data/processor/command/help/command.txt +37 -27
- data/processor/command/help/examples.txt +16 -0
- data/processor/command/help/suffixes.txt +17 -0
- data/processor/command/info.rb +1 -1
- data/processor/command/info_subcmd/args.rb +7 -13
- data/processor/command/info_subcmd/breakpoints.rb +8 -2
- data/processor/command/info_subcmd/frame.rb +2 -0
- data/processor/command/info_subcmd/globals.rb +63 -0
- data/processor/command/info_subcmd/iseq.rb +3 -1
- data/processor/command/info_subcmd/locals.rb +16 -15
- data/processor/command/{show_subcmd → info_subcmd}/macro.rb +7 -7
- data/processor/command/info_subcmd/program.rb +2 -0
- data/processor/command/info_subcmd/registers.rb +5 -1
- data/processor/command/info_subcmd/registers_subcmd/dfp.rb +2 -3
- data/processor/command/info_subcmd/registers_subcmd/helper.rb +8 -9
- data/processor/command/info_subcmd/registers_subcmd/lfp.rb +10 -5
- data/processor/command/info_subcmd/registers_subcmd/pc.rb +9 -4
- data/processor/command/info_subcmd/registers_subcmd/sp.rb +4 -5
- data/processor/command/info_subcmd/ruby.rb +3 -1
- data/processor/command/info_subcmd/source.rb +78 -0
- data/processor/command/info_subcmd/stack.rb +23 -0
- data/processor/command/kill.rb +4 -6
- data/processor/command/list.rb +118 -120
- data/processor/command/macro.rb +1 -1
- data/processor/command/parsetree.rb +56 -0
- data/processor/command/pp.rb +40 -0
- data/processor/command/pr.rb +1 -2
- data/processor/command/quit.rb +2 -1
- data/processor/command/set_subcmd/abbrev.rb +24 -0
- data/processor/command/set_subcmd/auto_subcmd/eval.rb +1 -2
- data/processor/command/set_subcmd/auto_subcmd/irb.rb +2 -3
- data/processor/command/set_subcmd/auto_subcmd/list.rb +2 -3
- data/processor/command/set_subcmd/highlight.rb +8 -2
- data/processor/command/set_subcmd/reload.rb +41 -0
- data/processor/command/set_subcmd/timer.rb +8 -18
- data/processor/command/set_subcmd/trace.rb +2 -2
- data/processor/command/set_subcmd/trace_subcmd/buffer.rb +2 -2
- data/processor/command/set_subcmd/trace_subcmd/print.rb +3 -3
- data/processor/command/{irb.rb → shell.rb} +9 -6
- data/processor/command/show_subcmd/abbrev.rb +19 -0
- data/processor/command/show_subcmd/directories.rb +21 -0
- data/processor/command/show_subcmd/hidelevel.rb +1 -1
- data/processor/command/show_subcmd/highlight.rb +2 -1
- data/processor/command/show_subcmd/reload.rb +17 -0
- data/processor/command/show_subcmd/timer.rb +17 -0
- data/processor/command/show_subcmd/trace_subcmd/buffer.rb +1 -1
- data/processor/command/source.rb +15 -14
- data/processor/command/tbreak.rb +20 -0
- data/processor/command/watchg.rb +114 -0
- data/processor/default.rb +43 -41
- data/processor/display.rb +3 -2
- data/processor/eval.rb +5 -3
- data/processor/eventbuf.rb +3 -2
- data/processor/frame.rb +12 -3
- data/processor/hook.rb +3 -2
- data/processor/load_cmds.rb +186 -179
- data/processor/location.rb +154 -159
- data/processor/main.rb +44 -16
- data/processor/mock.rb +0 -11
- data/processor/msg.rb +3 -1
- data/processor/running.rb +3 -2
- data/processor/validate.rb +25 -4
- data/processor/virtual.rb +32 -0
- data/test/data/debugger-stop.right +1 -0
- data/test/data/fname-with-blank.right +1 -0
- data/test/example/gcd.rb +1 -0
- data/test/functional/{test-trace-var.rb → test-watchg.rb} +15 -4
- data/test/unit/cmd-helper.rb +0 -3
- data/test/unit/test-app-cmd_parser.rb +2 -2
- data/test/unit/test-app-file.rb +1 -0
- data/test/unit/test-app-frame.rb +1 -1
- data/test/unit/test-app-util.rb +21 -0
- data/test/unit/test-base-cmd.rb +4 -6
- data/test/unit/test-base-subcmd.rb +1 -4
- data/test/unit/test-base-submgr.rb +1 -2
- data/test/unit/test-base-subsubcmd.rb +0 -4
- data/test/unit/test-cmd-edit.rb +33 -0
- data/test/unit/test-cmd-parse_list_cmd.rb +33 -0
- data/test/unit/test-completion.rb +1 -1
- data/test/unit/test-proc-frame.rb +4 -1
- data/test/unit/test-proc-load_cmds.rb +2 -1
- data/test/unit/test-proc-location.rb +9 -26
- data/test/unit/test-proc-main.rb +1 -4
- data/test/unit/test-proc-validate.rb +28 -18
- data/test/unit/test-subcmd-help.rb +0 -4
- data/trepanning.gemspec +1 -1
- metadata +27 -10
- data/processor/command/set_subcmd/trace_subcmd/var.rb +0 -57
@@ -5,7 +5,7 @@ require_relative '../base/subsubcmd'
|
|
5
5
|
class Trepan::Subcommand::ShowHidelevel < Trepan::ShowIntSubcommand
|
6
6
|
unless defined?(HELP)
|
7
7
|
Trepanning::Subcommand.set_name_prefix(__FILE__, self)
|
8
|
-
HELP
|
8
|
+
HELP = 'Show the number of stack levels to hide'
|
9
9
|
MIN_ABBREV = 'hide'.size
|
10
10
|
end
|
11
11
|
def run(args)
|
@@ -6,7 +6,8 @@ require_relative '../base/subsubmgr'
|
|
6
6
|
class Trepan::Subcommand::ShowHighlight < Trepan::ShowBoolSubcommand
|
7
7
|
unless defined?(HELP)
|
8
8
|
Trepanning::Subcommand.set_name_prefix(__FILE__, self)
|
9
|
-
HELP
|
9
|
+
HELP = 'Show whether we use terminal highlighting'
|
10
|
+
MIN_ABBREV = 'high'.size
|
10
11
|
end
|
11
12
|
|
12
13
|
def run(args)
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# Copyright (C) 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
3
|
+
require_relative '../base/subcmd'
|
4
|
+
|
5
|
+
class Trepan::Subcommand::ShowReload < Trepan::ShowBoolSubcommand
|
6
|
+
unless defined?(SHORT_HELP)
|
7
|
+
Trepanning::Subcommand.set_name_prefix(__FILE__, self)
|
8
|
+
HELP = "Show whether to reread source text when it changes"
|
9
|
+
MIN_ABBREV = 're'.size
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
if __FILE__ == $0
|
14
|
+
# Demo it.
|
15
|
+
require_relative '../../mock'
|
16
|
+
cmd = MockDebugger::sub_setup(Trepan::Subcommand::ShowReload, false)
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# Copyright (C) 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
3
|
+
require_relative '../base/subcmd'
|
4
|
+
|
5
|
+
class Trepan::Subcommand::ShowTimer < Trepan::ShowBoolSubcommand
|
6
|
+
unless defined?(HELP)
|
7
|
+
Trepanning::Subcommand.set_name_prefix(__FILE__, self)
|
8
|
+
HELP = "Show status of the timing hook"
|
9
|
+
MIN_ABBREV = 'ti'.size
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
if __FILE__ == $0
|
14
|
+
# Demo it.
|
15
|
+
require_relative '../../mock'
|
16
|
+
cmd = MockDebugger::sub_setup(Trepan::Subcommand::ShowTimer)
|
17
|
+
end
|
@@ -3,8 +3,8 @@
|
|
3
3
|
require_relative '../../base/subsubcmd'
|
4
4
|
|
5
5
|
class Trepan::SubSubcommand::ShowTraceBuffer < Trepan::ShowBoolSubSubcommand
|
6
|
-
Trepanning::SubSubcommand.set_name_prefix(__FILE__, self)
|
7
6
|
unless defined?(HELP)
|
7
|
+
Trepanning::SubSubcommand.set_name_prefix(__FILE__, self)
|
8
8
|
HELP = <<-EOH
|
9
9
|
#{CMD} [NUM]
|
10
10
|
|
data/processor/command/source.rb
CHANGED
@@ -49,37 +49,37 @@ unless option -c or --continue is given.
|
|
49
49
|
end
|
50
50
|
|
51
51
|
def complete(prefix)
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
52
|
+
files = Readline::FILENAME_COMPLETION_PROC.call(prefix) || []
|
53
|
+
opts = %w(-c --continue --no-continue -N --no -y --yes
|
54
|
+
--verbose --no-verbose) + files
|
55
|
+
Trepan::Complete.complete_token(opts, prefix)
|
56
56
|
end
|
57
57
|
|
58
58
|
def parse_options(options, args) # :nodoc
|
59
59
|
seen_yes_no = false
|
60
60
|
parser = OptionParser.new do |opts|
|
61
|
-
opts.on(
|
62
|
-
|
61
|
+
opts.on('-c', '--[no-]continue',
|
62
|
+
'Continue in the face of errors') do
|
63
63
|
|v|
|
64
64
|
options[:abort_on_error] = !v
|
65
65
|
end
|
66
|
-
opts.on(
|
67
|
-
|
66
|
+
opts.on('-v',
|
67
|
+
'--[no-]verbose', 'echo each command as it is executed') do
|
68
68
|
|v|
|
69
69
|
options[:verbose] = v
|
70
70
|
end
|
71
|
-
opts.on(
|
71
|
+
opts.on('-N', '--no', "Use 'no' in any confirmation prompts") do
|
72
72
|
|v|
|
73
73
|
if seen_yes_no
|
74
|
-
msg(
|
74
|
+
msg('Yes/No option already seen. This option (no) ignored.')
|
75
75
|
end
|
76
76
|
options[:confirm_val] = false
|
77
77
|
end
|
78
|
-
opts.on(
|
78
|
+
opts.on('-q', '--[no-]quiet', 'Silence debugger output') do
|
79
79
|
|v|
|
80
80
|
options[:quiet] = v
|
81
81
|
end
|
82
|
-
opts.on(
|
82
|
+
opts.on('-Y', '--yes', "Use 'yes' in any confirmation prompts") do
|
83
83
|
|v|
|
84
84
|
if seen_yes_no
|
85
85
|
msg("Yes/No option already seen. This option, --yes, ignored.")
|
@@ -94,14 +94,15 @@ unless option -c or --continue is given.
|
|
94
94
|
|
95
95
|
def run(args)
|
96
96
|
options = parse_options(DEFAULT_OPTIONS.dup, args[1..-2])
|
97
|
-
intf = @proc.
|
97
|
+
intf = @proc.interfaces
|
98
98
|
output = options[:quiet] ? Trepan::OutputNull.new(nil) : intf[-1].output
|
99
99
|
|
100
100
|
filename = args[-1]
|
101
101
|
|
102
102
|
expanded_file = File.expand_path(filename)
|
103
103
|
unless File.readable?(expanded_file)
|
104
|
-
errmsg("Debugger command file '%s' is not a readable file" %
|
104
|
+
errmsg("Debugger command file '%s' (%s) is not a readable file" %
|
105
|
+
[filename, expanded_file])
|
105
106
|
return false
|
106
107
|
end
|
107
108
|
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require_relative './base/cmd'
|
2
|
+
require_relative 'break'
|
3
|
+
|
4
|
+
class Trepan::Command::SetTempBreakpointCommand <
|
5
|
+
Trepan::Command::BreakCommand
|
6
|
+
ALIASES = []
|
7
|
+
CATEGORY = 'breakpoints'
|
8
|
+
NAME = File.basename(__FILE__, '.rb')
|
9
|
+
HELP = <<-HELP
|
10
|
+
Same as break, but the breakpoint is deleted when it is hit.
|
11
|
+
|
12
|
+
See also "break".
|
13
|
+
HELP
|
14
|
+
SHORT_HELP = 'Set a temporary breakpoint'
|
15
|
+
|
16
|
+
def run(args)
|
17
|
+
super args, true
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
@@ -0,0 +1,114 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
3
|
+
require_relative 'base/cmd'
|
4
|
+
require_relative '../../app/complete'
|
5
|
+
|
6
|
+
class Trepan::Command::WatchgCommand < Trepan::Command
|
7
|
+
unless defined?(HELP)
|
8
|
+
NAME = File.basename(__FILE__, '.rb')
|
9
|
+
CATEGORY = 'breakpoints'
|
10
|
+
HELP = <<-EOH
|
11
|
+
#{NAME} GLOBAL_VARIABLE [on]
|
12
|
+
#{NAME} GLOBAL_VARIABLE nostop
|
13
|
+
#{NAME} GLOBAL_VARIABLE off
|
14
|
+
|
15
|
+
Use Kernel.trace_var to trace changes of global variable
|
16
|
+
GLOBAL_VARIABLE. If nostop is given, then we just print out the
|
17
|
+
location and variable name but do not stop in the debugger.
|
18
|
+
|
19
|
+
To remove a prior trace, add "off" to the end.
|
20
|
+
|
21
|
+
Note in contrast to other events, stopping for variable tracing occurs
|
22
|
+
*after* the event, not before.
|
23
|
+
|
24
|
+
NOTE: this command name will likely change in the future.
|
25
|
+
|
26
|
+
Examples:
|
27
|
+
#{NAME} $PROGRAM_NAME # enter debugger if global $PROGRAM_NAME changes
|
28
|
+
#{NAME} $PROGRAM_NAME on # same as above
|
29
|
+
#{NAME} $PROGRAN_NAME stop # just print places the varaible is set
|
30
|
+
# along with the location
|
31
|
+
#{NAME} $PROGRAN_NAME off # remove watching changes
|
32
|
+
|
33
|
+
See also 'info breakpoints'
|
34
|
+
EOH
|
35
|
+
|
36
|
+
MAX_ARGS = 3
|
37
|
+
SHORT_HELP = "Set to display trace or untrace a global variable."
|
38
|
+
end
|
39
|
+
|
40
|
+
def complete(prefix)
|
41
|
+
Trepan::Complete.complete_token(global_variables.map{|v| v.to_s},
|
42
|
+
prefix)
|
43
|
+
end
|
44
|
+
|
45
|
+
def trace_var(traced_var, action)
|
46
|
+
traced_sym = traced_var.to_sym
|
47
|
+
if traced_var[0] == '$'
|
48
|
+
unless global_variables.member?(traced_sym)
|
49
|
+
msg "Warning: global variable #{traced_var} is not currently defined"
|
50
|
+
end
|
51
|
+
if @proc.traced_vars.member?(traced_var)
|
52
|
+
if @proc.traced_vars[traced_var] == action
|
53
|
+
errmsg "global variable #{traced_var} is already traced with #{action}."
|
54
|
+
return
|
55
|
+
end
|
56
|
+
else
|
57
|
+
Kernel.trace_var(traced_sym,
|
58
|
+
lambda {|val|
|
59
|
+
@proc.core.trace_var_processor(traced_var, val)})
|
60
|
+
end
|
61
|
+
@proc.traced_vars[traced_var] = action
|
62
|
+
msg("Tracing for variable #{traced_var} set to: #{action}.")
|
63
|
+
else
|
64
|
+
errmsg "Expecting a global variable to trace, got: #{traced_var}"
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def run(args)
|
69
|
+
if args.size == 2
|
70
|
+
trace_var(args[1], 'stop')
|
71
|
+
elsif args.size == 3
|
72
|
+
unless %w(nostop on off).member?(args[2])
|
73
|
+
errmsg "Expecting third argument to be 'on' 'off' or 'nostop'; got #{args[2]}"
|
74
|
+
return
|
75
|
+
end
|
76
|
+
traced_var = args[1]
|
77
|
+
if args[2] == 'off'
|
78
|
+
unless @proc.traced_vars.member?(traced_var)
|
79
|
+
msg "Warning: variable #{traced_var} is not currently marked as traced."
|
80
|
+
end
|
81
|
+
untrace_var(traced_var.to_sym)
|
82
|
+
@proc.traced_vars.delete(traced_var)
|
83
|
+
msg("Removed trace for variable #{traced_var}.")
|
84
|
+
else
|
85
|
+
traced_var = args[1]
|
86
|
+
if @proc.traced_vars.member?(traced_var)
|
87
|
+
@proc.traced_vars[traced_var] = args[2]
|
88
|
+
else
|
89
|
+
trace_var(traced_var, args[2])
|
90
|
+
end
|
91
|
+
end
|
92
|
+
else
|
93
|
+
errmsg "Expecting two or three arguments, got #{args.size}"
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
if __FILE__ == $0
|
99
|
+
# Demo it.
|
100
|
+
require_relative '../mock'
|
101
|
+
dbgr, cmd = MockDebugger::setup
|
102
|
+
core = dbgr.core
|
103
|
+
def core.event_processor(event, frame, arg=nil)
|
104
|
+
puts "traced global changed: event: #{event}, frame #{frame}, #{arg.inspect} "
|
105
|
+
end
|
106
|
+
cmd.run(%w(variable $FOO))
|
107
|
+
cmd.run(%w(variable $FOO))
|
108
|
+
cmd.run(%w(variable gaga))
|
109
|
+
$FOO=0
|
110
|
+
cmd.run(%w(variable $FOO off))
|
111
|
+
$FOO=1
|
112
|
+
cmd.run(%w(variable $FOO off))
|
113
|
+
end
|
114
|
+
|
data/processor/default.rb
CHANGED
@@ -1,48 +1,50 @@
|
|
1
1
|
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
2
2
|
require_relative '../app/default'
|
3
|
-
|
4
|
-
|
3
|
+
require_relative 'virtual'
|
4
|
+
class Trepan::CmdProcessor < Trepan::VirtualCmdProcessor
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
6
|
+
DEFAULT_SETTINGS = {
|
7
|
+
:abbrev => true, # Allow abbreviations of debugger commands?
|
8
|
+
:autoeval => true, # Ruby eval non-debugger commands
|
9
|
+
:autoirb => false, # Go into IRB in debugger command loop
|
10
|
+
:autolist => false, # Run 'list'
|
11
|
+
|
12
|
+
:basename => false, # Show basename of filenames only
|
13
|
+
:confirm => true, # Confirm potentially dangerous operations?
|
14
|
+
:different => 'nostack', # stop *only* when different position?
|
15
|
+
|
16
|
+
:debugdbgr => false, # Debugging the debugger
|
17
|
+
:debugexcept => true, # Internal debugging of command exceptions
|
18
|
+
:debugmacro => false, # debugging macros
|
19
|
+
:debugskip => false, # Internal debugging of step/next skipping
|
20
|
+
:directory => # last-resort path-search for files
|
21
|
+
'$cdir:$cwd', # that are not fully qualified.
|
22
|
+
|
23
|
+
:hidestack => nil, # Fixnum. How many hidden outer
|
24
|
+
# debugger stack frames to hide?
|
25
|
+
# nil or -1 means compute value. 0
|
26
|
+
# means hide none. Less than 0 means show
|
27
|
+
# all stack entries.
|
28
|
+
:hightlight => false, # Use terminal highlight?
|
28
29
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
}
|
45
|
-
|
30
|
+
:maxlist => 10, # Number of source lines to list
|
31
|
+
:maxstack => 10, # backtrace limit
|
32
|
+
:maxstring => 150, # Strings which are larger than this
|
33
|
+
# will be truncated to this length when
|
34
|
+
# printed
|
35
|
+
:maxwidth => (ENV['COLUMNS'] || '80').to_i,
|
36
|
+
:prompt => 'trepan', # core part of prompt. Additional info like
|
37
|
+
# debug nesting and
|
38
|
+
:reload => false, # Reread source file if we determine
|
39
|
+
# it has changed?
|
40
|
+
:save_cmdfile => nil, # If set, debugger command file to be
|
41
|
+
# used on restart
|
42
|
+
:timer => false, # show elapsed time between events
|
43
|
+
:traceprint => false, # event tracing printing
|
44
|
+
:tracebuffer => false, # save events to a trace buffer.
|
45
|
+
:user_cmd_dir => File.join(%W(#{Trepan::HOME_DIR} trepan command)),
|
46
|
+
# User command directory
|
47
|
+
}
|
46
48
|
end
|
47
49
|
|
48
50
|
if __FILE__ == $0
|
data/processor/display.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
|
-
# Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
|
1
|
+
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
2
2
|
require_relative '../app/display'
|
3
|
+
require_relative 'virtual'
|
3
4
|
class Trepan
|
4
|
-
class CmdProcessor
|
5
|
+
class CmdProcessor < VirtualCmdProcessor
|
5
6
|
attr_reader :displays
|
6
7
|
|
7
8
|
def display_initialize
|
data/processor/eval.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
-
# Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
|
1
|
+
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
2
|
+
require 'rubygems'
|
3
|
+
require_relative 'virtual'
|
2
4
|
class Trepan
|
3
|
-
class CmdProcessor
|
5
|
+
class CmdProcessor < VirtualCmdProcessor
|
4
6
|
|
5
7
|
def debug_eval(str, max_fake_filename=15)
|
6
8
|
begin
|
@@ -73,7 +75,7 @@ end
|
|
73
75
|
|
74
76
|
if __FILE__ == $0
|
75
77
|
# Demo it.
|
76
|
-
cmdp = Trepan::CmdProcessor.new
|
78
|
+
cmdp = Trepan::CmdProcessor.new([])
|
77
79
|
puts cmdp.fake_eval_filename('x = 1; y = 2')
|
78
80
|
puts cmdp.fake_eval_filename('x = 1; y = 2', 7)
|
79
81
|
|
data/processor/eventbuf.rb
CHANGED
@@ -3,9 +3,10 @@
|
|
3
3
|
# Trace::Buffer for this prupose.
|
4
4
|
require 'trace'
|
5
5
|
require 'linecache'
|
6
|
+
require_relative 'virtual'
|
6
7
|
|
7
8
|
class Trepan
|
8
|
-
class CmdProcessor
|
9
|
+
class CmdProcessor < VirtualCmdProcessor
|
9
10
|
|
10
11
|
attr_reader :eventbuf
|
11
12
|
attr_reader :event_tracefilter
|
@@ -115,7 +116,7 @@ class Trepan
|
|
115
116
|
end
|
116
117
|
if __FILE__ == $0
|
117
118
|
# Demo it.
|
118
|
-
cmdproc = Trepan::CmdProcessor.new
|
119
|
+
cmdproc = Trepan::CmdProcessor.new([])
|
119
120
|
cmdproc.eventbuf_initialize(5)
|
120
121
|
|
121
122
|
def cmdproc.msg(mess)
|
data/processor/frame.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
|
-
# Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
|
1
|
+
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
2
2
|
require 'linecache'
|
3
3
|
require_relative '../app/complete'
|
4
4
|
require_relative '../app/frame'
|
5
|
+
require_relative 'virtual'
|
5
6
|
class Trepan
|
6
|
-
class CmdProcessor
|
7
|
+
class CmdProcessor < VirtualCmdProcessor
|
7
8
|
|
8
9
|
attr_reader :current_thread
|
9
10
|
|
@@ -44,7 +45,15 @@ class Trepan
|
|
44
45
|
if frame
|
45
46
|
@frame = frame
|
46
47
|
@frame_index = frame_num
|
47
|
-
|
48
|
+
unless @settings[:traceprint]
|
49
|
+
opts = {
|
50
|
+
:basename => settings[:basename],
|
51
|
+
:current_pos => frame_num,
|
52
|
+
:maxwidth => settings[:maxwidth],
|
53
|
+
}
|
54
|
+
print_stack_trace_from_to(frame_num, frame_num, frame, opts)
|
55
|
+
print_location
|
56
|
+
end
|
48
57
|
@line_no = frame_line() - 1
|
49
58
|
@frame
|
50
59
|
else
|