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
data/processor/breakpoint.rb
CHANGED
@@ -1,113 +1,115 @@
|
|
1
|
-
# Copyright (C) 2010,
|
1
|
+
# Copyright (C) 2010-2011, 2015 Rocky Bernstein <rockyb@rubyforge.net>
|
2
|
+
require 'rubyvm-frame'
|
2
3
|
require_relative 'virtual'
|
3
4
|
class Trepan
|
4
5
|
|
5
|
-
|
6
|
+
class CmdProcessor < VirtualCmdProcessor
|
6
7
|
|
7
|
-
|
8
|
+
attr_reader :brkpts # BreakpointManager.
|
8
9
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
10
|
+
attr_reader :brkpt # Breakpoint. If we are stopped at a
|
11
|
+
# breakpoint this is the one we
|
12
|
+
# found. (There may be other
|
13
|
+
# breakpoints that would have caused a stop
|
14
|
+
# as well; this is just one of them).
|
15
|
+
# If no breakpoint stop this is nil.
|
15
16
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
def breakpoint_initialize
|
18
|
+
@brkpts = BreakpointMgr.new
|
19
|
+
@brkpt = nil
|
20
|
+
end
|
20
21
|
|
21
|
-
|
22
|
-
|
23
|
-
|
22
|
+
def breakpoint_finalize
|
23
|
+
@brkpts.finalize
|
24
|
+
end
|
24
25
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
26
|
+
def breakpoint?
|
27
|
+
return nil unless @frame && @frame.iseq
|
28
|
+
@brkpt = @brkpts.find(@frame.iseq, @frame.pc_offset, @frame.binding)
|
29
|
+
@brkpts.delete_by_brkpt(@brkpt) if @brkpt && @brkpt.temp?
|
30
|
+
return !!@brkpt
|
31
|
+
end
|
30
32
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
33
|
+
def breakpoint_find(bpnum, show_errmsg = true)
|
34
|
+
if 0 == @brkpts.size
|
35
|
+
errmsg('No breakpoints set.') if show_errmsg
|
36
|
+
return nil
|
37
|
+
elsif bpnum > @brkpts.max || bpnum < 1
|
38
|
+
errmsg('Breakpoint number %d is out of range 1..%d' %
|
39
|
+
[bpnum, @brkpts.max]) if show_errmsg
|
40
|
+
return nil
|
41
|
+
end
|
42
|
+
bp = @brkpts[bpnum]
|
43
|
+
if bp
|
44
|
+
return bp
|
45
|
+
else
|
46
|
+
errmsg('Breakpoint number %d previously deleted.' %
|
47
|
+
bpnum) if show_errmsg
|
48
|
+
return nil
|
49
|
+
end
|
50
|
+
end
|
49
51
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
52
|
+
# Does whatever needs to be done to set a breakpoint
|
53
|
+
def breakpoint_line(line_number, initial_iseq, temp=false)
|
54
|
+
# FIXME: handle breakpoint conditions.
|
55
|
+
found_iseq = initial_iseq.child_iseqs.detect do |iseq|
|
56
|
+
iseq.lineoffsets.keys.member?(line_number)
|
57
|
+
end
|
58
|
+
unless found_iseq
|
59
|
+
found_iseq = initial_iseq.parent
|
60
|
+
while found_iseq do
|
61
|
+
break if found_iseq.lineoffsets.keys.member?(line_number)
|
62
|
+
found_iseq = found_iseq.parent
|
63
|
+
end
|
64
|
+
end
|
65
|
+
offset =
|
66
|
+
if found_iseq
|
67
|
+
# FIXME
|
68
|
+
found_iseq.line2offsets(line_number)[1] ||
|
69
|
+
found_iseq.line2offsets(line_number)[0]
|
70
|
+
else
|
71
|
+
nil
|
72
|
+
end
|
73
|
+
unless offset
|
74
|
+
place = "in #{iseq.source_container.join(' ')} " if found_iseq
|
75
|
+
errmsg("No line #{line_number} found #{place}for breakpoint.")
|
76
|
+
return nil
|
77
|
+
end
|
78
|
+
@brkpts.add(found_iseq, offset, :temp => temp)
|
61
79
|
end
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
80
|
+
|
81
|
+
def breakpoint_offset(offset, iseq, condition, negate, temp=false)
|
82
|
+
# FIXME: handle breakpoint conditions.
|
83
|
+
unless iseq.offsetlines.keys.member?(offset)
|
84
|
+
errmsg("Offset #{offset} not found in #{iseq.label} for breakpoint.")
|
85
|
+
return nil
|
86
|
+
end
|
87
|
+
@brkpts.add(iseq, offset, :temp => temp, :condition => condition,
|
88
|
+
:negate => negate, :type => 'offset')
|
70
89
|
end
|
71
|
-
unless offset
|
72
|
-
place = "in #{iseq.source_container.join(' ')} " if found_iseq
|
73
|
-
errmsg("No line #{line_number} found #{place}for breakpoint.")
|
74
|
-
return nil
|
75
|
-
end
|
76
|
-
@brkpts.add(found_iseq, offset, :temp => temp)
|
77
|
-
end
|
78
90
|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
return nil
|
84
|
-
end
|
85
|
-
@brkpts.add(iseq, offset, :temp => temp, :condition => condition,
|
86
|
-
:negate => negate, :type => 'offset')
|
87
|
-
end
|
91
|
+
# Delete a breakpoint given its breakpoint number.
|
92
|
+
def delete_breakpoint_by_number(bpnum, do_enable=true)
|
93
|
+
bp = breakpoint_find(bpnum)
|
94
|
+
return false unless bp
|
88
95
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
96
|
+
@brkpts.delete_by_brkpt(bp)
|
97
|
+
return true
|
98
|
+
end
|
99
|
+
|
100
|
+
# Enable or disable a breakpoint given its breakpoint number.
|
101
|
+
def en_disable_breakpoint_by_number(bpnum, do_enable=true)
|
102
|
+
bp = breakpoint_find(bpnum)
|
103
|
+
return false unless bp
|
97
104
|
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
return false
|
108
|
-
end
|
109
|
-
bp.enabled = do_enable
|
110
|
-
return true
|
105
|
+
enable_disable = do_enable ? 'en' : 'dis'
|
106
|
+
if bp.enabled? == do_enable
|
107
|
+
errmsg('Breakpoint %d previously %sabled.' %
|
108
|
+
[bpnum, enable_disable])
|
109
|
+
return false
|
110
|
+
end
|
111
|
+
bp.enabled = do_enable
|
112
|
+
return true
|
113
|
+
end
|
111
114
|
end
|
112
|
-
end
|
113
115
|
end
|
@@ -13,7 +13,7 @@ class Trepan::SubcommandMgr < Trepan::Command
|
|
13
13
|
CATEGORY = 'status'
|
14
14
|
MIN_ARGS = 0
|
15
15
|
MAX_ARGS = nil
|
16
|
-
NAME = '?' # FIXME: Need to define this, but should
|
16
|
+
NAME = '?' # FIXME: Need to define this, but should
|
17
17
|
# pick this up from class/file name.
|
18
18
|
NEED_STACK = false
|
19
19
|
end
|
@@ -48,7 +48,7 @@ class Trepan::SubcommandMgr < Trepan::Command
|
|
48
48
|
cmd_dir = File.dirname(__FILE__)
|
49
49
|
subcmd_dir = File.join(cmd_dir, '..', name + '_subcmd')
|
50
50
|
files = Dir.glob(File.join(subcmd_dir, '*.rb'))
|
51
|
-
files.each do |rb|
|
51
|
+
files.each do |rb|
|
52
52
|
basename = File.basename(rb, '.rb')
|
53
53
|
if File.directory?(File.join(File.dirname(rb), basename + '_subcmd'))
|
54
54
|
subcmd_names << name.capitalize + basename.capitalize
|
@@ -92,7 +92,7 @@ class Trepan::SubcommandMgr < Trepan::Command
|
|
92
92
|
# help cmd subcmd
|
93
93
|
# help cmd commands
|
94
94
|
#
|
95
|
-
# Our shtick is to give help for the overall command only if
|
95
|
+
# Our shtick is to give help for the overall command only if
|
96
96
|
# subcommand or 'commands' is not given. If a subcommand is given and
|
97
97
|
# found, then specific help for that is given. If 'commands' is given
|
98
98
|
# we will list the all the subcommands.
|
@@ -103,8 +103,8 @@ class Trepan::SubcommandMgr < Trepan::Command
|
|
103
103
|
if doc
|
104
104
|
return doc
|
105
105
|
else
|
106
|
-
errmsg('Sorry - author mess up. ' +
|
107
|
-
'No help registered for command' +
|
106
|
+
errmsg('Sorry - author mess up. ' +
|
107
|
+
'No help registered for command' +
|
108
108
|
@name)
|
109
109
|
return nil
|
110
110
|
end
|
@@ -128,9 +128,9 @@ class Trepan::SubcommandMgr < Trepan::Command
|
|
128
128
|
if doc
|
129
129
|
return doc
|
130
130
|
else
|
131
|
-
errmsg('Sorry - author mess up. ' +
|
132
|
-
'No help registered for subcommand: ' +
|
133
|
-
subcmd_name + ', of command: ' +
|
131
|
+
errmsg('Sorry - author mess up. ' +
|
132
|
+
'No help registered for subcommand: ' +
|
133
|
+
subcmd_name + ', of command: ' +
|
134
134
|
@name)
|
135
135
|
return nil
|
136
136
|
end
|
@@ -153,7 +153,7 @@ class Trepan::SubcommandMgr < Trepan::Command
|
|
153
153
|
|
154
154
|
# Return an Array of subcommands that can start with +arg+. If none
|
155
155
|
# found we just return +arg+.
|
156
|
-
# FIXME: Not used any more?
|
156
|
+
# FIXME: Not used any more?
|
157
157
|
def complete(prefix)
|
158
158
|
Trepan::Complete.complete_token(@subcmds.subcmds.keys, prefix)
|
159
159
|
end
|
data/processor/command/break.rb
CHANGED
@@ -30,51 +30,53 @@ See also:
|
|
30
30
|
`condition`, `continue`, `help syntax location`, and `tbreak`
|
31
31
|
HELP
|
32
32
|
|
33
|
-
|
34
|
-
|
35
|
-
|
33
|
+
ALIASES = %w(b)
|
34
|
+
CATEGORY = 'breakpoints'
|
35
|
+
SHORT_HELP = 'Set a breakpoint'
|
36
36
|
end
|
37
37
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
38
|
+
# This method runs the command
|
39
|
+
def run(args, temp=false)
|
40
|
+
# FIXME: handle more conditions
|
41
|
+
# a line number
|
42
|
+
if args.size == 1
|
43
|
+
# usage is "break" which means break right here
|
44
|
+
# FIXME: should handle condition
|
45
|
+
frame = @proc.frame
|
46
|
+
iseq = frame.iseq
|
47
|
+
start_insn = iseq.start_insn(frame.pc_offset)
|
48
|
+
bp = @proc.breakpoint_offset(start_insn, iseq, 'true', false)
|
49
|
+
else
|
50
|
+
iseq, line_number, vm_offset, condition, negate =
|
51
|
+
@proc.breakpoint_position(@proc.cmd_argstr, true)
|
52
|
+
return false unless iseq && vm_offset
|
53
|
+
bp = @proc.breakpoint_offset(vm_offset, iseq, condition, negate, temp)
|
54
|
+
end
|
55
|
+
if bp
|
56
|
+
bp.condition = condition
|
55
57
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
58
|
+
if temp
|
59
|
+
mess = "Temporary breakpoint %d set at " % bp.id
|
60
|
+
else
|
61
|
+
mess = "Breakpoint %d set at " % bp.id
|
62
|
+
end
|
61
63
|
|
62
|
-
|
63
|
-
|
64
|
-
|
64
|
+
line_loc = "line %s in %s" %
|
65
|
+
[bp.source_location.join(', '),
|
66
|
+
@proc.canonic_container(bp.iseq.source_container).join(' ')]
|
65
67
|
|
66
|
-
|
67
|
-
|
68
|
+
vm_loc = "VM offset %d of instruction sequence \"%s\"" %
|
69
|
+
[bp.offset, bp.iseq.label]
|
68
70
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
71
|
+
loc, other_loc =
|
72
|
+
if 'line' == bp.type
|
73
|
+
[line_loc, vm_loc]
|
74
|
+
else # 'offset' == bp.type
|
75
|
+
[vm_loc, line_loc]
|
76
|
+
end
|
77
|
+
msg(mess + loc + ",\n\t" + other_loc + ".")
|
74
78
|
end
|
75
|
-
msg(mess + loc + ",\n\t" + other_loc + ".")
|
76
79
|
end
|
77
|
-
end
|
78
80
|
end
|
79
81
|
|
80
82
|
if __FILE__ == $0
|
@@ -89,7 +91,7 @@ if __FILE__ == $0
|
|
89
91
|
run_cmd(cmd, [cmd.name])
|
90
92
|
run_cmd(cmd, [cmd.name, __LINE__.to_s])
|
91
93
|
require 'thread_frame'
|
92
|
-
tf = RubyVM::Frame.
|
94
|
+
tf = RubyVM::Frame.get
|
93
95
|
pc_offset = tf.pc_offset
|
94
96
|
run_cmd(cmd, [cmd.name, "@#{pc_offset}"])
|
95
97
|
def foo
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2010,
|
1
|
+
# Copyright (C) 2010-2011, 2015 Rocky Bernstein <rockyb@rubyforge.net>
|
2
2
|
require_relative '../command'
|
3
3
|
require_relative '../running'
|
4
4
|
require_relative '../../app/breakpoint' # FIXME: possibly temporary
|
@@ -7,24 +7,29 @@ class Trepan::Command::ContinueCommand < Trepan::Command
|
|
7
7
|
unless defined?(HELP)
|
8
8
|
NAME = File.basename(__FILE__, '.rb')
|
9
9
|
HELP = <<-HELP
|
10
|
-
|
10
|
+
**#{NAME}** [*location*]
|
11
11
|
|
12
12
|
Leave the debugger loop and continue execution. Subsequent entry to
|
13
13
|
the debugger however may occur via breakpoints or explicit calls, or
|
14
14
|
exceptions.
|
15
15
|
|
16
16
|
If a parameter is given, a temporary breakpoint is set at that position
|
17
|
-
before continuing. Offset are numbers prefixed with an "O" otherwise
|
17
|
+
before continuing. Offset are numbers prefixed with an "O"; otherwise
|
18
18
|
the parameter is taken as a line number.
|
19
19
|
|
20
20
|
Examples:
|
21
|
-
|
22
|
-
#{NAME} 10 # continue to line 10
|
23
|
-
#{NAME} o20 # continue to VM Instruction Sequence offset 20
|
24
|
-
#{NAME} gcd # continue to first instruction of method gcd
|
25
|
-
#{NAME} IRB.start o7 # continue to IRB.start offset 7
|
21
|
+
---------
|
26
22
|
|
27
|
-
|
23
|
+
#{NAME}
|
24
|
+
#{NAME} 10 # continue to line 10
|
25
|
+
#{NAME} o20 # continue to VM Instruction Sequence offset 20
|
26
|
+
#{NAME} gcd # continue to first instruction of method gcd
|
27
|
+
#{NAME} IRB.start o7 # continue to IRB.start offset 7
|
28
|
+
|
29
|
+
See also:
|
30
|
+
---------
|
31
|
+
|
32
|
+
`step`, `next`, `finish`, `nexti` `help syntax location`.
|
28
33
|
HELP
|
29
34
|
|
30
35
|
ALIASES = %w(c cont)
|
@@ -40,7 +45,7 @@ See also 'step', 'next', 'finish', 'nexti' commands and "help location".
|
|
40
45
|
# Form is: "continue"
|
41
46
|
@proc.continue
|
42
47
|
else
|
43
|
-
iseq, line_number, vm_offset, condition, negate =
|
48
|
+
iseq, line_number, vm_offset, condition, negate =
|
44
49
|
@proc.breakpoint_position(@proc.cmd_argstr, false)
|
45
50
|
return false unless iseq && vm_offset
|
46
51
|
bp = @proc.breakpoint_offset(vm_offset, iseq, condition, negate, true)
|
data/processor/command/debug.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
# Copyright (C) 2010, 2012, 2015 Rocky Bernstein <rockyb@rubyforge.net>
|
3
|
-
require 'thread_frame'
|
4
3
|
require_relative '../command'
|
5
4
|
|
6
5
|
class Trepan::Command::DebugCommand < Trepan::Command
|
@@ -27,46 +26,28 @@ Enter the debugger recursively on *ruby-code*.
|
|
27
26
|
arg_str = args[1..-1].join(' ')
|
28
27
|
hidelevels = @proc.hidelevels[th]
|
29
28
|
|
30
|
-
stack_diff = RubyVM::Frame.
|
31
|
-
|
32
|
-
# Ignore tracing in support routines:
|
33
|
-
# FIXME remvoe 1.9.3 hack
|
34
|
-
if '1.9.3' != RUBY_VERSION
|
35
|
-
tf = @proc.dbgr.trace_filter
|
36
|
-
[self.method(:run), @proc.method(:debug_eval),
|
37
|
-
@proc.method(:debug_eval_with_exception),
|
38
|
-
@proc.method(:get_binding_and_filename),
|
39
|
-
@proc.method(:fake_eval_filename)].each do |m|
|
40
|
-
tf << m unless tf.member?(m)
|
41
|
-
end
|
42
|
-
end
|
29
|
+
stack_diff = RubyVM::Frame.stack_size - frame.stack_size
|
43
30
|
|
44
31
|
@proc.hidelevels[th] += stack_diff + EXTRA_DEBUG_SETUP_CALLS
|
45
32
|
|
46
33
|
# Values we need to save before munging them
|
47
|
-
old_tracing = th.tracing?
|
48
|
-
old_exec_event_tracing = th.exec_event_tracing?
|
49
34
|
old_mutex = @proc.core.mutex
|
50
35
|
old_next_level = @proc.next_level
|
51
36
|
old_step_count = @proc.core.step_count
|
52
37
|
|
53
|
-
section 'ENTERING NESTED DEBUGGER'
|
54
38
|
|
55
39
|
# Things we need to do to allow entering the debugger again
|
56
40
|
@proc.debug_nest += 1
|
57
41
|
@proc.core.mutex = Mutex.new
|
58
|
-
th.tracing = false
|
59
|
-
th.exec_event_tracing = false
|
60
42
|
@proc.next_level = 32000
|
61
43
|
|
62
|
-
RubyVM::Frame.current.trace_off = false
|
63
44
|
@proc.core.step_count = 0
|
64
|
-
|
65
|
-
|
45
|
+
section 'ENTERING NESTED DEBUGGER'
|
46
|
+
old_trace_arg = RubyVM::TraceArg.save
|
47
|
+
retval = @proc.debug_eval(arg_str, 15)
|
66
48
|
|
67
49
|
# Restore munged values
|
68
|
-
|
69
|
-
th.tracing = old_tracing
|
50
|
+
RubyVM::TraceArg.restore(old_trace_arg)
|
70
51
|
@proc.core.mutex = old_mutex
|
71
52
|
@proc.frame_setup(frame)
|
72
53
|
@proc.hidelevels[th] = hidelevels
|
@@ -83,6 +64,6 @@ if __FILE__ == $0
|
|
83
64
|
require_relative '../mock'
|
84
65
|
dbgr, cmd = MockDebugger::setup
|
85
66
|
cmd.proc.hidelevels[Thread.current] = 0
|
86
|
-
cmd.proc.frame_setup(RubyVM::Frame
|
67
|
+
cmd.proc.frame_setup(RubyVM::Frame.get)
|
87
68
|
cmd.run([cmd.name, 'x = 1; y = 2'])
|
88
69
|
end
|