trepanning 1.93.35 → 2.15.33
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.
- checksums.yaml +7 -0
- data/ChangeLog +491 -55
- data/LICENSE +1 -1
- data/NEWS +18 -14
- data/README.md +5 -22
- data/Rakefile +22 -1
- data/app/breakpoint.rb +5 -3
- data/app/core.rb +147 -179
- data/app/default.rb +47 -46
- data/app/file.rb +6 -7
- data/app/frame.rb +183 -176
- data/app/markdown.rb +2 -9
- data/app/options.rb +1 -1
- data/app/run.rb +71 -37
- data/interface/script.rb +8 -8
- data/io.rb +19 -20
- data/lib/trepanning.rb +292 -297
- data/processor.rb +332 -344
- data/processor/breakpoint.rb +98 -96
- data/processor/command/base/submgr.rb +9 -9
- data/processor/command/break.rb +40 -38
- data/processor/command/continue.rb +15 -10
- data/processor/command/debug.rb +6 -25
- data/processor/command/delete.rb +21 -12
- data/processor/command/directory.rb +15 -13
- data/processor/command/disable.rb +12 -9
- data/processor/command/disassemble.rb +80 -74
- data/processor/command/display.rb +15 -12
- data/processor/command/down.rb +8 -3
- data/processor/command/edit.rb +37 -23
- data/processor/command/enable.rb +11 -8
- data/processor/command/eval.rb +24 -22
- data/processor/command/finish.rb +50 -48
- data/processor/command/help.rb +1 -1
- data/processor/command/info_subcmd/breakpoints.rb +7 -7
- data/processor/command/info_subcmd/files.rb +195 -196
- data/processor/command/info_subcmd/frame.rb +7 -4
- data/processor/command/info_subcmd/locals.rb +29 -12
- data/processor/command/info_subcmd/program.rb +48 -39
- data/processor/command/info_subcmd/registers_subcmd/ep.rb +46 -0
- data/processor/command/info_subcmd/registers_subcmd/helper.rb +32 -35
- data/processor/command/info_subcmd/registers_subcmd/sp.rb +29 -23
- data/processor/command/info_subcmd/return.rb +28 -10
- data/processor/command/info_subcmd/variables_subcmd/class.rb +3 -3
- data/processor/command/info_subcmd/variables_subcmd/constants.rb +77 -0
- data/processor/command/info_subcmd/variables_subcmd/globals.rb +7 -7
- data/processor/command/info_subcmd/variables_subcmd/instance.rb +68 -22
- data/processor/command/info_subcmd/variables_subcmd/locals.rb +148 -67
- data/processor/command/list.rb +14 -8
- data/processor/command/macro.rb +1 -1
- data/processor/command/next.rb +1 -0
- data/processor/command/set_subcmd/auto.rb +3 -3
- data/processor/command/set_subcmd/different.rb +30 -29
- data/processor/command/set_subcmd/events.rb +74 -48
- data/processor/command/set_subcmd/max_subcmd/list.rb +12 -5
- data/processor/command/set_subcmd/max_subcmd/width.rb +28 -19
- data/processor/command/set_subcmd/register.rb +37 -0
- data/processor/command/set_subcmd/register_subcmd/pc.rb +67 -0
- data/processor/command/set_subcmd/register_subcmd/sp.rb +75 -0
- data/processor/command/set_subcmd/reload.rb +12 -10
- data/processor/command/set_subcmd/return.rb +68 -44
- data/processor/command/shell.rb +3 -2
- data/processor/command/show_subcmd/different.rb +17 -14
- data/processor/command/show_subcmd/events.rb +25 -25
- data/processor/default.rb +1 -1
- data/processor/eval.rb +14 -15
- data/processor/frame.rb +43 -36
- data/processor/help.rb +5 -5
- data/processor/hook.rb +26 -29
- data/processor/location.rb +54 -51
- data/processor/mock.rb +4 -3
- data/processor/running.rb +113 -103
- data/processor/validate.rb +401 -373
- data/test/data/debug.cmd +8 -0
- data/test/data/debug.right +13 -0
- data/test/data/debugger-stop.right +6 -4
- data/test/data/fname-with-blank.cmd +1 -1
- data/test/data/fname-with-blank.right +5 -0
- data/test/data/pc.cmd +8 -0
- data/test/data/pc.right +10 -0
- data/test/data/quit.right +3 -1
- data/test/data/trace.cmd +2 -2
- data/test/data/trace.right +41 -20
- data/test/example/assign.rb +6 -0
- data/test/functional/fn_helper.rb +11 -17
- data/test/functional/test-break-long.rb +15 -16
- data/test/functional/test-break.rb +6 -8
- data/test/functional/test-condition.rb +8 -10
- data/test/functional/test-debugger-call-bug.rb +21 -22
- data/test/functional/test-delete.rb +57 -59
- data/test/functional/test-eval.rb +101 -103
- data/test/functional/test-finish.rb +24 -33
- data/test/functional/test-immediate-step-bug.rb +6 -10
- data/test/functional/test-next.rb +64 -65
- data/test/functional/test-raise.rb +63 -64
- data/test/functional/test-recursive-bt.rb +81 -76
- data/test/functional/test-remap.rb +6 -7
- data/test/functional/test-return.rb +44 -38
- data/test/functional/test-step.rb +55 -53
- data/test/functional/test-stepbug.rb +6 -9
- data/test/functional/test-watchg.rb +40 -39
- data/test/integration/test-debug.rb +12 -0
- data/test/integration/test-debugger-stop.rb +7 -7
- data/test/integration/test-pc.rb +24 -0
- data/test/integration/test-trace.rb +1 -1
- data/test/unit/cmd-helper.rb +0 -1
- data/test/unit/test-app-brkpt.rb +21 -21
- data/test/unit/test-app-brkptmgr.rb +7 -8
- data/test/unit/test-app-display.rb +3 -4
- data/test/unit/test-app-frame.rb +4 -5
- data/test/unit/test-base-subsubcmd.rb +2 -2
- data/test/unit/test-cmd-break.rb +6 -6
- data/test/unit/test-cmd-endisable.rb +7 -6
- data/test/unit/test-cmd-parse_list_cmd.rb +24 -24
- data/test/unit/test-io-tcpserver.rb +39 -35
- data/test/unit/test-proc-default.rb +23 -22
- data/test/unit/test-proc-eval.rb +1 -2
- data/test/unit/test-proc-frame.rb +8 -9
- data/test/unit/test-proc-list.rb +1 -1
- data/test/unit/test-proc-location.rb +2 -2
- data/test/unit/test-proc-main.rb +10 -10
- data/test/unit/test-proc-validate.rb +11 -13
- data/test/unit/test-subcmd-help.rb +1 -2
- data/trepanning.gemspec +8 -13
- metadata +44 -95
- data/COPYING +0 -57
- data/data/custom_require.rb +0 -44
- data/data/perldb.bindings +0 -17
- data/data/prelude.rb +0 -38
- data/processor/command/info_subcmd/variables_subcmd/constant.rb +0 -41
- data/processor/command/raise.rb +0 -48
- data/processor/command/set_subcmd/pc.rb +0 -62
- data/processor/command/set_subcmd/sp.rb +0 -67
- data/processor/eventbuf.rb +0 -133
@@ -0,0 +1,77 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# Copyright (C) 2010-2011, 2015 Rocky Bernstein <rockyb@rubyforge.net>
|
3
|
+
require_relative '../../base/subsubcmd'
|
4
|
+
require_relative '../../../../app/util'
|
5
|
+
|
6
|
+
class Trepan::Subcommand::InfoVariablesConstants < Trepan::SubSubcommand
|
7
|
+
Trepan::Util.suppress_warnings {
|
8
|
+
Trepanning::Subcommand.set_name_prefix(__FILE__, self)
|
9
|
+
HELP = <<-EOH
|
10
|
+
#{CMD}
|
11
|
+
#{CMD}
|
12
|
+
|
13
|
+
Show class constants of the current stack frame.
|
14
|
+
Normally for each which show both the name and value. If you just
|
15
|
+
want a list of names add parameter 'names'.
|
16
|
+
EOH
|
17
|
+
SHORT_HELP = 'Show class constants via the current stack frame'
|
18
|
+
MIN_ABBREV = 'co'.size
|
19
|
+
MIN_ARGS = 0
|
20
|
+
MAX_ARGS = 1
|
21
|
+
NEED_STACK = true
|
22
|
+
}
|
23
|
+
|
24
|
+
def names
|
25
|
+
# FIXME: do less guess work. Decide based on other properties.
|
26
|
+
values = @proc.debug_eval_no_errmsg('self.class.constants')
|
27
|
+
if values.empty?
|
28
|
+
values = @proc.debug_eval_no_errmsg('self.constants')
|
29
|
+
end
|
30
|
+
return values ? values.sort.map{|c| c.to_s} || [] : []
|
31
|
+
end
|
32
|
+
|
33
|
+
def run_for_constant(args, klass=nil)
|
34
|
+
suffix = klass ? " for #{klass.to_s}" : '' rescue ''
|
35
|
+
if args.size == 2
|
36
|
+
last_arg = args[-1]
|
37
|
+
if names.member?(last_arg)
|
38
|
+
var_class =
|
39
|
+
@proc.safe_rep(@proc.debug_eval_no_errmsg(last_arg+'.class').inspect)
|
40
|
+
var_value =
|
41
|
+
@proc.safe_rep(@proc.debug_eval_no_errmsg(last_arg).inspect)
|
42
|
+
msg("#{last_arg} class: %s" % var_class)
|
43
|
+
msg("#{last_arg} value: %s" % var_value)
|
44
|
+
else
|
45
|
+
errmsg "No constant variable #{last_arg} defined#{suffix}."
|
46
|
+
end
|
47
|
+
elsif args.size == 1
|
48
|
+
if names.empty?
|
49
|
+
msg "No constant variables defined#{suffix}."
|
50
|
+
else
|
51
|
+
section "Constant variable names#{suffix}:"
|
52
|
+
width = settings[:maxwidth]
|
53
|
+
mess = Columnize::columnize(names,
|
54
|
+
@proc.settings[:maxwidth], ' ',
|
55
|
+
false, true, ' ' * 2).chomp
|
56
|
+
msg mess
|
57
|
+
end
|
58
|
+
else
|
59
|
+
errmsg("Wrong number of arguments #{args.size}")
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def run(args)
|
64
|
+
run_for_constant(args, @proc.debug_eval('self'))
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
# Demo it.
|
69
|
+
if __FILE__ == $0
|
70
|
+
require_relative '../../../mock'
|
71
|
+
require_relative '../variables'
|
72
|
+
# cmd =
|
73
|
+
# MockDebugger::subsub_setup(Trepan::Subcommand::InfoVariables,
|
74
|
+
# Trepan::Subcommand::InfoVariablesConstants)
|
75
|
+
# cmd.run(cmd.prefix)
|
76
|
+
# cmd.run(cmd.prefix + ['name'])
|
77
|
+
end
|
@@ -8,7 +8,7 @@ class Trepan::Subcommand::InfoVariablesGlobals <
|
|
8
8
|
Trepanning::Subcommand.set_name_prefix(__FILE__, self)
|
9
9
|
HELP = <<-EOH
|
10
10
|
#{CMD}
|
11
|
-
#{CMD} [names]
|
11
|
+
#{CMD} [--names]
|
12
12
|
|
13
13
|
Show global variables.
|
14
14
|
Normally for each which show both the name and value. If you just
|
@@ -20,7 +20,7 @@ EOH
|
|
20
20
|
NEED_STACK = true
|
21
21
|
}
|
22
22
|
|
23
|
-
def
|
23
|
+
def names
|
24
24
|
global_variables
|
25
25
|
end
|
26
26
|
|
@@ -33,7 +33,7 @@ EOH
|
|
33
33
|
else
|
34
34
|
section "Global variable names:"
|
35
35
|
width = settings[:maxwidth]
|
36
|
-
mess = Columnize::columnize(global_variables.sort,
|
36
|
+
mess = Columnize::columnize(global_variables.sort,
|
37
37
|
@proc.settings[:maxwidth], ' ',
|
38
38
|
false, true, ' ' * 2).chomp
|
39
39
|
msg mess
|
@@ -42,12 +42,12 @@ EOH
|
|
42
42
|
errmsg("unrecognized argument: #{args[-1]}")
|
43
43
|
end
|
44
44
|
elsif args.size == 1
|
45
|
-
names =
|
45
|
+
names = names
|
46
46
|
if names.empty?
|
47
47
|
msg "No global variables defined."
|
48
48
|
else
|
49
49
|
section "Global variables:"
|
50
|
-
names.sort.each do |var_name|
|
50
|
+
names.sort.each do |var_name|
|
51
51
|
s = @proc.debug_eval(var_name.to_s)
|
52
52
|
msg("#{var_name} = #{s.inspect}", :code=>true)
|
53
53
|
end
|
@@ -61,8 +61,8 @@ end
|
|
61
61
|
if __FILE__ == $0
|
62
62
|
# Demo it.
|
63
63
|
require_relative '../../../mock'
|
64
|
-
cmd = MockDebugger::subsub_setup(Trepan::Subcommand::InfoVariablesGlobals,
|
64
|
+
cmd = MockDebugger::subsub_setup(Trepan::Subcommand::InfoVariablesGlobals,
|
65
65
|
false)
|
66
66
|
cmd.run(cmd.prefix)
|
67
|
-
cmd.run(cmd.prefix + ['name'])
|
67
|
+
cmd.run(cmd.prefix + ['--name'])
|
68
68
|
end
|
@@ -1,14 +1,15 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
-
# Copyright (C) 2010,
|
3
|
-
require_relative 'locals'
|
2
|
+
# Copyright (C) 2010-2011, 2015 Rocky Bernstein <rockyb@rubyforge.net>
|
4
3
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
4
|
+
require_relative '../../base/subsubcmd'
|
5
|
+
require_relative '../../../../app/util'
|
6
|
+
|
7
|
+
class Trepan::Subcommand::InfoVariablesInstance < Trepan::SubSubcommand
|
8
|
+
Trepan::Util.suppress_warnings {
|
9
|
+
Trepanning::Subcommand.set_name_prefix(__FILE__, self)
|
10
|
+
HELP = <<-EOH
|
10
11
|
#{CMD}
|
11
|
-
#{CMD} [names]
|
12
|
+
#{CMD} [--names]
|
12
13
|
|
13
14
|
Show instance variables of the current stack frame.
|
14
15
|
Normally for each which show both the name and value. If you just
|
@@ -17,25 +18,70 @@ EOH
|
|
17
18
|
SHORT_HELP = 'Show instance variables of the current stack frame'
|
18
19
|
MIN_ARGS = 0
|
19
20
|
MAX_ARGS = 1
|
20
|
-
MIN_ABBREV = 'iv'.size
|
21
|
+
MIN_ABBREV = 'iv'.size
|
21
22
|
NEED_STACK = true
|
22
23
|
}
|
23
24
|
|
24
|
-
|
25
|
-
|
26
|
-
|
25
|
+
def names
|
26
|
+
@proc.debug_eval('self.instance_variables.sort').map{|n| n.to_s}
|
27
|
+
end
|
28
|
+
|
29
|
+
def run_for_type(args, type, klass=nil)
|
30
|
+
suffix = klass ? " for #{klass.to_s}" : '' rescue ''
|
31
|
+
if args.size == 2
|
32
|
+
last_arg = args[-1]
|
33
|
+
if 0 == '--names'.index(last_arg)
|
34
|
+
if names.empty?
|
35
|
+
msg "No #{type} variables defined."
|
36
|
+
else
|
37
|
+
section "#{type.capitalize} variable names#{suffix}:"
|
38
|
+
width = settings[:maxwidth]
|
39
|
+
mess = Columnize::columnize(names,
|
40
|
+
@proc.settings[:maxwidth], ' ',
|
41
|
+
false, true, ' ' * 2).chomp
|
42
|
+
msg mess
|
43
|
+
end
|
44
|
+
elsif 'CFUNC' == @proc.frame.type
|
45
|
+
msg "Can't show #{type} names in a C call"
|
46
|
+
return
|
47
|
+
else
|
48
|
+
p last_arg
|
49
|
+
if names.member?(last_arg)
|
50
|
+
var_value =
|
51
|
+
@proc.safe_rep(@proc.debug_eval_no_errmsg(last_arg).inspect)
|
52
|
+
msg("#{last_arg} = #{var_value}", :code => true)
|
53
|
+
else
|
54
|
+
errmsg "No #{type} variable #{last_arg} defined#{suffix}."
|
55
|
+
end
|
56
|
+
end
|
57
|
+
elsif args.size == 1
|
58
|
+
if names.empty?
|
59
|
+
msg "No #{type} variables defined#{suffix}."
|
60
|
+
else
|
61
|
+
section "#{type.capitalize} variables#{suffix}:"
|
62
|
+
names.each do |var_name|
|
63
|
+
var_value =
|
64
|
+
@proc.safe_rep(@proc.debug_eval_no_errmsg(var_name).inspect)
|
65
|
+
msg("#{var_name} = #{var_value}", :code => true)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
else
|
69
|
+
errmsg("Wrong number of arguments #{args.size}")
|
70
|
+
end
|
71
|
+
end
|
27
72
|
|
28
|
-
|
29
|
-
|
30
|
-
|
73
|
+
def run(args)
|
74
|
+
run_for_type(args, 'instance', @proc.debug_eval('self'))
|
75
|
+
end
|
31
76
|
end
|
32
77
|
|
78
|
+
# Demo it.
|
33
79
|
if __FILE__ == $0
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
MockDebugger::subsub_setup(Trepan::Subcommand::InfoVariables,
|
38
|
-
|
39
|
-
|
40
|
-
|
80
|
+
require_relative '../../../mock'
|
81
|
+
require_relative '../variables'
|
82
|
+
# cmd =
|
83
|
+
# MockDebugger::subsub_setup(Trepan::Subcommand::InfoVariables,
|
84
|
+
# Trepan::Subcommand::InfoVariablesInstance)
|
85
|
+
# cmd.run(cmd.prefix)
|
86
|
+
# cmd.run(cmd.prefix + ['name'])
|
41
87
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
-
# Copyright (C) 2010,
|
2
|
+
# Copyright (C) 2010-2011, 2015 Rocky Bernstein <rockyb@rubyforge.net>
|
3
3
|
require 'columnize'
|
4
4
|
require_relative '../../base/subsubcmd'
|
5
5
|
require_relative '../../../../app/frame'
|
@@ -9,91 +9,172 @@ class Trepan::Subcommand::InfoVariablesLocals < Trepan::SubSubcommand
|
|
9
9
|
Trepan::Util.suppress_warnings {
|
10
10
|
Trepanning::Subcommand.set_name_prefix(__FILE__, self)
|
11
11
|
HELP = <<-EOH
|
12
|
-
|
13
|
-
#{CMD} [names]
|
12
|
+
**#{CMD}** [ **--names** | *local-number* ]
|
14
13
|
|
15
14
|
Show local variables including parameters of the current stack frame.
|
16
|
-
Normally for each
|
17
|
-
want a list of names add parameter
|
15
|
+
Normally for each we show both the name and value. If you just
|
16
|
+
want a list of names add parameter `--names`. C functions don't
|
17
|
+
store parameter names, just the parameter positions starting from 0.
|
18
|
+
|
19
|
+
If you just want the value for a particular local number (and its name
|
20
|
+
if not in a C function), give that number. This is basically running
|
21
|
+
the VM command "getlocal *num*".
|
22
|
+
|
23
|
+
Examples:
|
24
|
+
---------
|
25
|
+
|
26
|
+
info variables local
|
27
|
+
info variables local 0
|
28
|
+
info variables local --names
|
29
|
+
|
30
|
+
See Also:
|
31
|
+
---------
|
32
|
+
|
33
|
+
`info variables`, `info globals`, `info variables constants`,
|
34
|
+
and `info variables class`
|
35
|
+
|
18
36
|
EOH
|
19
37
|
SHORT_HELP = 'Show local variables of the current stack frame'
|
20
38
|
MIN_ARGS = 0
|
21
39
|
MAX_ARGS = 1
|
22
|
-
MIN_ABBREV = 'lo'.size
|
40
|
+
MIN_ABBREV = 'lo'.size
|
23
41
|
NEED_STACK = true
|
24
42
|
}
|
25
43
|
|
26
|
-
|
27
|
-
|
28
|
-
|
44
|
+
def complete(prefix)
|
45
|
+
if @proc && @proc.frame
|
46
|
+
argc =
|
47
|
+
if 'CFUNC' == @proc.frame.type
|
48
|
+
@proc.frame.argc
|
49
|
+
else
|
50
|
+
iseq = @proc.frame.iseq
|
51
|
+
iseq.local_size - 2
|
52
|
+
end
|
53
|
+
ary = (0..argc).map{|i| i.to_s}
|
54
|
+
['--names'] + ary
|
55
|
+
else
|
56
|
+
[]
|
57
|
+
end
|
58
|
+
end
|
29
59
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|i|
|
34
|
-
iseq.local_name(i)
|
60
|
+
def names
|
61
|
+
iseq = @proc.frame.iseq
|
62
|
+
0.upto(iseq.local_size-2).map { |i| iseq.local_name(i) }
|
35
63
|
end
|
36
|
-
end
|
37
64
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
65
|
+
def run_for_locals(args)
|
66
|
+
suffix = klass ? " for #{klass.to_s}" : '' rescue ''
|
67
|
+
frame = @proc.frame
|
68
|
+
suffix =
|
69
|
+
if frame.klass
|
70
|
+
" for #{Trepan::Frame::format_stack_call(frame,{})}"
|
71
|
+
else
|
72
|
+
''
|
73
|
+
end
|
74
|
+
iseq = frame.iseq
|
75
|
+
c_frame = 'CFUNC' == frame.type
|
76
|
+
if args.size == 2
|
77
|
+
last_arg = args[-1]
|
78
|
+
argc =
|
79
|
+
if c_frame
|
80
|
+
frame.argc
|
81
|
+
else
|
82
|
+
iseq.local_size - 2
|
83
|
+
end
|
84
|
+
if 0 == '--names'.index(last_arg)
|
85
|
+
if c_frame
|
86
|
+
msg("Can't show parameter names in a C call")
|
87
|
+
return
|
88
|
+
end
|
89
|
+
if names.empty?
|
90
|
+
msg "No local variables defined."
|
91
|
+
else
|
92
|
+
section "Local variable names#{suffix}:"
|
93
|
+
width = settings[:maxwidth]
|
94
|
+
mess = Columnize::columnize(names,
|
95
|
+
@proc.settings[:maxwidth], ' ',
|
96
|
+
false, true, ' ' * 2).chomp
|
97
|
+
msg mess
|
98
|
+
end
|
99
|
+
else
|
100
|
+
if c_frame
|
101
|
+
num = @proc.get_an_int(last_arg,
|
102
|
+
:max_value => argc,
|
103
|
+
:min_value => 0,
|
104
|
+
)
|
105
|
+
return unless num
|
106
|
+
val = frame.getlocal(num)
|
107
|
+
msg("%d: %s (%s)" % [num, val.inspect, val.class],
|
108
|
+
:code => true)
|
109
|
+
return
|
110
|
+
elsif names.member?(last_arg)
|
111
|
+
val =
|
112
|
+
@proc.safe_rep(@proc.debug_eval_no_errmsg(last_arg))
|
113
|
+
msg("%s = %s (%s)" %
|
114
|
+
[last_arg, val.inspect, val.class], :code => true)
|
115
|
+
return
|
116
|
+
else
|
117
|
+
num = @proc.get_an_int(last_arg,
|
118
|
+
:max_value => iseq.local_size,
|
119
|
+
:min_value => 0,
|
120
|
+
)
|
121
|
+
return unless num
|
122
|
+
val = frame.getlocal(num)
|
123
|
+
if num >= 2
|
124
|
+
var_name = iseq.local_name(iseq.local_size-num)
|
125
|
+
mess = "%d: %s = %s (%s)" % [num, var_name,
|
126
|
+
val.inspect, val.class]
|
127
|
+
else
|
128
|
+
mess = "%d: %s (%s)" % [num, val.inspect, val.class]
|
129
|
+
end
|
130
|
+
|
131
|
+
msg(mess, :code => true)
|
132
|
+
return
|
133
|
+
end
|
134
|
+
end
|
135
|
+
elsif args.size == 1
|
136
|
+
if c_frame
|
137
|
+
argc = frame.argc
|
138
|
+
if argc > 0
|
139
|
+
1.upto(argc).each do |i|
|
140
|
+
msg "#{i}: #{@proc.frame.sp(argc-i+3).inspect}"
|
141
|
+
end
|
142
|
+
else
|
143
|
+
msg("No parameters in C call")
|
144
|
+
end
|
145
|
+
return
|
146
|
+
else
|
147
|
+
if names.empty?
|
148
|
+
msg "No local variables defined#{suffix}."
|
149
|
+
else
|
150
|
+
section "Local variables#{suffix}:"
|
151
|
+
last = iseq.local_size
|
152
|
+
2.upto(iseq.local_size) do |i|
|
153
|
+
name = iseq.local_name(last-i)
|
154
|
+
val = frame.getlocal(i)
|
155
|
+
msg("%d: %s = %s (%s)" %
|
156
|
+
[i, name, val.inspect, val.class],
|
157
|
+
:code => true)
|
158
|
+
end
|
159
|
+
end
|
160
|
+
end
|
72
161
|
else
|
73
|
-
|
74
|
-
names.each do |var_name|
|
75
|
-
var_value =
|
76
|
-
@proc.safe_rep(@proc.debug_eval_no_errmsg(var_name).inspect)
|
77
|
-
msg("#{var_name} = #{var_value}", :code => true)
|
78
|
-
end
|
162
|
+
errmsg("Wrong number of arguments #{args.size}")
|
79
163
|
end
|
80
|
-
end
|
81
|
-
else
|
82
|
-
errmsg("Wrong number of arguments #{args.size}")
|
83
164
|
end
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
165
|
+
|
166
|
+
def run(args)
|
167
|
+
run_for_locals(args)
|
168
|
+
end
|
88
169
|
end
|
89
170
|
|
90
171
|
if __FILE__ == $0
|
91
172
|
# Demo it.
|
92
173
|
require_relative '../../../mock'
|
93
174
|
require_relative '../variables'
|
94
|
-
cmd = MockDebugger::subsub_setup(Trepan::SubSubcommand::InfoVariables,
|
95
|
-
|
96
|
-
|
97
|
-
cmd.run([])
|
98
|
-
cmd.run(['name'])
|
175
|
+
# cmd = MockDebugger::subsub_setup(Trepan::SubSubcommand::InfoVariables,
|
176
|
+
# Trepan::SubSubcommand::InfoVariablesLocals
|
177
|
+
# )
|
178
|
+
# cmd.run([])
|
179
|
+
# cmd.run(['name'])
|
99
180
|
end
|