trepanning 0.0.6 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +214 -0
- data/NEWS +12 -0
- data/README.textile +1 -7
- data/Rakefile +13 -0
- data/app/default.rb +5 -4
- data/app/disassemble.rb +25 -3
- data/app/run.rb +0 -18
- data/bin/trepan +4 -6
- data/data/irbrc +3 -17
- data/io/base_io.rb +3 -1
- data/io/null_output.rb +41 -0
- data/lib/trepanning.rb +10 -13
- data/processor/command/backtrace.rb +7 -6
- data/processor/command/base/subcmd.rb +4 -0
- data/processor/command/base/submgr.rb +1 -1
- data/processor/command/base/subsubmgr.rb +1 -1
- data/processor/command/break.rb +12 -4
- data/processor/command/continue.rb +2 -2
- data/processor/command/delete.rb +1 -1
- data/processor/command/disable.rb +1 -1
- data/processor/command/disassemble.rb +1 -1
- data/processor/command/finish.rb +3 -3
- data/processor/command/info_subcmd/iseq.rb +9 -0
- data/processor/command/info_subcmd/registers_subcmd/dfp.rb +7 -16
- data/processor/command/info_subcmd/registers_subcmd/lfp.rb +5 -17
- data/processor/command/info_subcmd/registers_subcmd/pc.rb +6 -19
- data/processor/command/info_subcmd/registers_subcmd/sp.rb +14 -24
- data/processor/command/list.rb +34 -19
- data/processor/command/reload.rb +1 -1
- data/processor/command/restart.rb +8 -9
- data/processor/command/set_subcmd/auto.rb +1 -2
- data/processor/command/set_subcmd/auto_subcmd/eval.rb +6 -19
- data/processor/command/set_subcmd/auto_subcmd/irb.rb +7 -23
- data/processor/command/set_subcmd/auto_subcmd/list.rb +5 -22
- data/processor/command/set_subcmd/basename.rb +6 -20
- data/processor/command/set_subcmd/debug.rb +1 -1
- data/processor/command/set_subcmd/debug_subcmd/dbgr.rb +9 -22
- data/processor/command/set_subcmd/debug_subcmd/except.rb +8 -20
- data/processor/command/set_subcmd/debug_subcmd/macro.rb +7 -19
- data/processor/command/set_subcmd/debug_subcmd/skip.rb +5 -18
- data/processor/command/set_subcmd/debug_subcmd/stack.rb +5 -18
- data/processor/command/set_subcmd/hidelevel.rb +60 -0
- data/processor/command/set_subcmd/max.rb +1 -1
- data/processor/command/set_subcmd/max_subcmd/list.rb +12 -23
- data/processor/command/set_subcmd/max_subcmd/stack.rb +8 -31
- data/processor/command/set_subcmd/substitute.rb +1 -1
- data/processor/command/set_subcmd/substitute_subcmd/eval.rb +1 -1
- data/processor/command/set_subcmd/substitute_subcmd/path.rb +1 -1
- data/processor/command/set_subcmd/substitute_subcmd/string.rb +6 -18
- data/processor/command/set_subcmd/timer.rb +1 -1
- data/processor/command/set_subcmd/trace.rb +1 -1
- data/processor/command/set_subcmd/trace_subcmd/buffer.rb +1 -1
- data/processor/command/set_subcmd/trace_subcmd/print.rb +5 -21
- data/processor/command/set_subcmd/trace_subcmd/var.rb +1 -1
- data/processor/command/show_subcmd/args.rb +9 -27
- data/processor/command/show_subcmd/auto_subcmd/eval.rb +3 -15
- data/processor/command/show_subcmd/auto_subcmd/irb.rb +3 -15
- data/processor/command/show_subcmd/auto_subcmd/list.rb +3 -18
- data/processor/command/show_subcmd/basename.rb +3 -1
- data/processor/command/show_subcmd/hidelevel.rb +41 -0
- data/processor/command/show_subcmd/max.rb +1 -1
- data/processor/command/show_subcmd/trace_subcmd/buffer.rb +1 -1
- data/processor/command/show_subcmd/trace_subcmd/print.rb +1 -1
- data/processor/command/source.rb +6 -5
- data/processor/command/undisplay.rb +0 -1
- data/processor/default.rb +6 -2
- data/processor/frame.rb +2 -21
- data/processor/location.rb +44 -18
- data/processor/main.rb +0 -11
- data/processor/mock.rb +25 -0
- data/processor/validate.rb +34 -18
- data/test/functional/fn_helper.rb +14 -4
- data/test/functional/test-break.rb +35 -73
- data/test/functional/test-condition.rb +9 -10
- data/test/functional/test-delete.rb +5 -3
- data/test/unit/test-app-disassemble.rb +15 -3
- data/test/unit/test-app-run.rb +0 -4
- data/test/unit/test-cmd-break.rb +3 -0
- metadata +15 -11
@@ -32,7 +32,7 @@ module FnTestHelper
|
|
32
32
|
|
33
33
|
unless defined?(TREPAN_PROMPT)
|
34
34
|
TREPAN_PROMPT = /^\(trepan\): /
|
35
|
-
TREPAN_LOC = /.. \(.+:\d
|
35
|
+
TREPAN_LOC = /.. \(.+:\d+( @\d+)?\)/
|
36
36
|
end
|
37
37
|
|
38
38
|
# Return the caller's line number
|
@@ -79,7 +79,17 @@ module FnTestHelper
|
|
79
79
|
# becomes:
|
80
80
|
# --
|
81
81
|
a2 = a.map do |s|
|
82
|
-
s =~ TREPAN_LOC ? s.gsub(/\(.+:\d
|
82
|
+
s =~ TREPAN_LOC ? s.gsub(/\(.+:\d+( @\d+)?\)\n/, '').chomp : s.chomp
|
83
|
+
end
|
84
|
+
|
85
|
+
# Canonicalize breakpoint messages.
|
86
|
+
# For example:
|
87
|
+
# Set breakpoint 1: test/functional/test-tbreak.rb:10 (@0)
|
88
|
+
# becomes :
|
89
|
+
# Set breakpoint 1: foo.rb:55 (@3)
|
90
|
+
a3 = a2.map do |s|
|
91
|
+
s.gsub(/^Breakpoint (\d+) set at line (\d+) in file .+,/,
|
92
|
+
'Breakpoint \1 set at line 55 in file foo.rb,')
|
83
93
|
end
|
84
94
|
|
85
95
|
# Remove VM offset locations.
|
@@ -87,10 +97,10 @@ module FnTestHelper
|
|
87
97
|
# VM offset 2 of instruction sequence "block in compare_output".
|
88
98
|
# becomes
|
89
99
|
# VM offset 55 of instruction sequence "block in compare_output".
|
90
|
-
|
100
|
+
a4 = a3.map do |s|
|
91
101
|
s.gsub(/VM offset \d+/, 'VM offset 55')
|
92
102
|
end
|
93
|
-
return
|
103
|
+
return a4
|
94
104
|
end
|
95
105
|
|
96
106
|
end
|
@@ -1,87 +1,49 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require 'test/unit'
|
3
|
-
require 'trace'
|
4
3
|
require_relative 'fn_helper'
|
5
|
-
require_relative '../../app/breakpoint'
|
6
4
|
|
7
|
-
class
|
5
|
+
class TestBreak2 < Test::Unit::TestCase
|
8
6
|
|
9
7
|
include FnTestHelper
|
10
8
|
|
11
|
-
def
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
cmds = ['set basename on',
|
19
|
-
'break ' + (__LINE__ + 7).to_s,
|
20
|
-
'continue']
|
9
|
+
def test_line_only_break
|
10
|
+
# Check that we can set breakpoints in parent, sibling and children
|
11
|
+
# of sibling returns. We have one more 'continue' than we need
|
12
|
+
# just in case something goes wrong.
|
13
|
+
cmds_pat = ((['break %d'] * 3) + (%w(continue) * 4)).join("\n")
|
14
|
+
line = __LINE__
|
15
|
+
cmds = (cmds_pat % [line, line+11, line+14]).split(/\n/)
|
21
16
|
d = strarray_setup(cmds)
|
22
|
-
d.start
|
23
|
-
########### b1 ###############
|
24
|
-
x = 5
|
25
|
-
y = 6
|
26
|
-
z = 7
|
27
17
|
##############################
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
'break ' + (__LINE__ + 8).to_s,
|
41
|
-
'break ' + (__LINE__ + 8).to_s,
|
42
|
-
'disable 1',
|
43
|
-
'continue']
|
44
|
-
d = strarray_setup(cmds)
|
45
|
-
d.start
|
46
|
-
########### b2 ###############
|
47
|
-
x = 7
|
48
|
-
y = 8
|
49
|
-
z = 8+1
|
18
|
+
def foo # line + 4
|
19
|
+
a = 5 # line + 5
|
20
|
+
b = 6 # line + 6
|
21
|
+
end # line + 7
|
22
|
+
1.times do # line + 8
|
23
|
+
d.start # line + 9
|
24
|
+
1.times do # line + 10
|
25
|
+
x = 11 # line + 11
|
26
|
+
foo # line + 12
|
27
|
+
end # line + 13
|
28
|
+
c = 14 # line + 14
|
29
|
+
end
|
50
30
|
##############################
|
51
|
-
d.stop
|
52
|
-
out = [
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
"
|
57
|
-
|
58
|
-
"
|
59
|
-
|
60
|
-
|
61
|
-
|
31
|
+
d.stop # ({:remove => true})
|
32
|
+
out = ["-- ",
|
33
|
+
"1.times do # line + 10",
|
34
|
+
"Breakpoint 1 set at line 55 in file foo.rb,
|
35
|
+
\tVM offset 55 of instruction sequence \"test_line_only_break\".",
|
36
|
+
"Breakpoint 2 set at line 55 in file foo.rb,
|
37
|
+
\tVM offset 55 of instruction sequence \"block (2 levels) in test_line_only_break\".",
|
38
|
+
"Breakpoint 3 set at line 55 in file foo.rb,
|
39
|
+
\tVM offset 55 of instruction sequence \"block in test_line_only_break\".",
|
40
|
+
"xx ",
|
41
|
+
"x = 11 # line + 11",
|
42
|
+
"xx ",
|
43
|
+
"c = 14 # line + 14"]
|
62
44
|
compare_output(out, d, cmds)
|
63
|
-
|
64
|
-
# Stepping after a breakpoint should not stay at same location.
|
65
|
-
cmds = ['set basename on',
|
66
|
-
'continue ' + (__LINE__ + 8).to_s,
|
67
|
-
'continue']
|
68
|
-
dbg = strarray_setup(cmds)
|
69
|
-
dbg.start
|
70
|
-
########### b3 ###############
|
71
|
-
a = 1
|
72
|
-
b = 2
|
73
|
-
c = 3
|
74
|
-
d = 4
|
75
|
-
e = 5
|
76
|
-
##############################
|
77
|
-
dbg.stop
|
78
|
-
out = ['-- ',
|
79
|
-
'a = 1',
|
80
|
-
'basename is on.',
|
81
|
-
'xx ',
|
82
|
-
'd = 4' ]
|
83
|
-
compare_output(out, dbg, cmds)
|
84
45
|
end
|
85
|
-
|
46
|
+
|
86
47
|
end
|
87
48
|
|
49
|
+
|
@@ -27,9 +27,8 @@ class TestBreak < Test::Unit::TestCase
|
|
27
27
|
out = ['-- ',
|
28
28
|
'x = 6',
|
29
29
|
'basename is on.',
|
30
|
-
"Breakpoint 1 set at line
|
31
|
-
|
32
|
-
]
|
30
|
+
"Breakpoint 1 set at line 55 in file foo.rb,
|
31
|
+
\tVM offset 55 of instruction sequence \"test_condition\"."]
|
33
32
|
compare_output(out, d, cmds)
|
34
33
|
|
35
34
|
# Try a condition that fails
|
@@ -45,13 +44,13 @@ class TestBreak < Test::Unit::TestCase
|
|
45
44
|
z = 8
|
46
45
|
##############################
|
47
46
|
d.stop
|
48
|
-
out = [
|
49
|
-
|
50
|
-
|
51
|
-
"Breakpoint 1 set at line
|
52
|
-
|
53
|
-
|
54
|
-
|
47
|
+
out = ["-- ",
|
48
|
+
"x = 6",
|
49
|
+
"basename is on.",
|
50
|
+
"Breakpoint 1 set at line 55 in file foo.rb,
|
51
|
+
\tVM offset 55 of instruction sequence \"test_condition\".",
|
52
|
+
"xx ",
|
53
|
+
"y = 7"]
|
55
54
|
compare_output(out, d, cmds)
|
56
55
|
end
|
57
56
|
|
@@ -29,7 +29,7 @@ class TestDelete < Test::Unit::TestCase
|
|
29
29
|
out = ['-- ',
|
30
30
|
'va = 1',
|
31
31
|
'basename is on.',
|
32
|
-
"Breakpoint 1 set at line
|
32
|
+
"Breakpoint 1 set at line 55 in file foo.rb,\n\tVM offset 55 of instruction sequence \"test_delete\".",
|
33
33
|
"Deleted breakpoint 1."]
|
34
34
|
compare_output(out, d, cmds)
|
35
35
|
|
@@ -57,8 +57,10 @@ class TestDelete < Test::Unit::TestCase
|
|
57
57
|
"va = 1",
|
58
58
|
"basename is on.",
|
59
59
|
"Evaluation of unrecognized debugger commands is on.",
|
60
|
-
"Breakpoint 1 set at line
|
61
|
-
|
60
|
+
"Breakpoint 1 set at line 55 in file foo.rb,
|
61
|
+
\tVM offset 55 of instruction sequence \"test_delete\".",
|
62
|
+
"Breakpoint 2 set at line 55 in file foo.rb,
|
63
|
+
\tVM offset 55 of instruction sequence \"test_delete\".",
|
62
64
|
"Deleted breakpoint 1.",
|
63
65
|
"xx ",
|
64
66
|
"vd = 4",
|
@@ -50,11 +50,23 @@ local table (size: 6, argc: 1 [opts: 0, rest: -1, post: 0, block: -1] s1)
|
|
50
50
|
def test_disassemble_split
|
51
51
|
expect = {
|
52
52
|
0=>
|
53
|
-
|
53
|
+
'0000 trace 8 ( 26)',
|
54
54
|
2=>
|
55
|
-
|
56
|
-
4=>
|
55
|
+
'0002 trace 1 ( 27)',
|
56
|
+
4=>'0004 putnil '
|
57
57
|
}
|
58
58
|
assert_equal(expect, disassemble_split(@dis_string))
|
59
59
|
end
|
60
|
+
|
61
|
+
# Test shortening lines via setting the maxwidth parameter
|
62
|
+
def test_shorten_dissassembly
|
63
|
+
ary = mark_disassembly(@dis_string, false, 2, [], 70)
|
64
|
+
assert_equal([
|
65
|
+
' 0000 trace 8 ( 26)',
|
66
|
+
' 0002 trace 1 ( 27)',
|
67
|
+
' 0004 putnil '],
|
68
|
+
ary[3..-1])
|
69
|
+
end
|
70
|
+
|
71
|
+
|
60
72
|
end
|
data/test/unit/test-app-run.rb
CHANGED
@@ -10,10 +10,6 @@ class TestAppRun < Test::Unit::TestCase
|
|
10
10
|
assert_equal(true, File.executable?(ng) || ng == 'probably-does-not-exist')
|
11
11
|
rp = ruby_path
|
12
12
|
assert_equal(true, File.executable?(rp))
|
13
|
-
tup = explicit_restart_argv(ARGV)
|
14
|
-
assert_equal(rp, tup[0])
|
15
|
-
assert_equal(true, File.readable?(tup[1]))
|
16
|
-
assert_equal(ARGV.size + 2, tup.size)
|
17
13
|
end
|
18
14
|
|
19
15
|
end
|
data/test/unit/test-cmd-break.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require 'test/unit'
|
3
3
|
require 'thread_frame'
|
4
|
+
require 'fileutils' # To test FileUtils.cp
|
5
|
+
|
4
6
|
require_relative 'cmd-helper'
|
5
7
|
|
6
8
|
class TestCommandBreak < Test::Unit::TestCase
|
@@ -28,6 +30,7 @@ class TestCommandBreak < Test::Unit::TestCase
|
|
28
30
|
pc_offset = tf.pc_offset
|
29
31
|
[[@name],
|
30
32
|
[@name, "O#{pc_offset}"],
|
33
|
+
#[@name, 'FileUtils.cp']
|
31
34
|
].each_with_index do |args, i|
|
32
35
|
@my_cmd.run(args)
|
33
36
|
assert_equal(true, @cmdproc.errmsgs.empty?, @cmdproc.errmsgs)
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 8
|
9
|
+
version: 0.0.8
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- R. Bernstein
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-10
|
17
|
+
date: 2010-12-10 00:00:00 -05:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -27,8 +27,8 @@ dependencies:
|
|
27
27
|
- !ruby/object:Gem::Version
|
28
28
|
segments:
|
29
29
|
- 0
|
30
|
-
-
|
31
|
-
version: "0.
|
30
|
+
- 34
|
31
|
+
version: "0.34"
|
32
32
|
type: :runtime
|
33
33
|
version_requirements: *id001
|
34
34
|
- !ruby/object:Gem::Dependency
|
@@ -41,8 +41,8 @@ dependencies:
|
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
segments:
|
43
43
|
- 0
|
44
|
-
-
|
45
|
-
version: "0.
|
44
|
+
- 3
|
45
|
+
version: "0.3"
|
46
46
|
type: :runtime
|
47
47
|
version_requirements: *id002
|
48
48
|
- !ruby/object:Gem::Dependency
|
@@ -55,7 +55,8 @@ dependencies:
|
|
55
55
|
- !ruby/object:Gem::Version
|
56
56
|
segments:
|
57
57
|
- 0
|
58
|
-
|
58
|
+
- 45
|
59
|
+
version: "0.45"
|
59
60
|
type: :runtime
|
60
61
|
version_requirements: *id003
|
61
62
|
- !ruby/object:Gem::Dependency
|
@@ -130,6 +131,7 @@ files:
|
|
130
131
|
- interface/base_intf.rb
|
131
132
|
- interface/user.rb
|
132
133
|
- io/base_io.rb
|
134
|
+
- io/null_output.rb
|
133
135
|
- io/string_array.rb
|
134
136
|
- io/input.rb
|
135
137
|
- lib/trepanning.rb
|
@@ -160,6 +162,7 @@ files:
|
|
160
162
|
- processor/command/set_subcmd/substitute.rb
|
161
163
|
- processor/command/set_subcmd/return.rb
|
162
164
|
- processor/command/set_subcmd/debug.rb
|
165
|
+
- processor/command/set_subcmd/hidelevel.rb
|
163
166
|
- processor/command/set_subcmd/auto_subcmd/list.rb
|
164
167
|
- processor/command/set_subcmd/auto_subcmd/irb.rb
|
165
168
|
- processor/command/set_subcmd/auto_subcmd/eval.rb
|
@@ -242,6 +245,7 @@ files:
|
|
242
245
|
- processor/command/show_subcmd/debug_subcmd/macro.rb
|
243
246
|
- processor/command/show_subcmd/debug.rb
|
244
247
|
- processor/command/show_subcmd/args.rb
|
248
|
+
- processor/command/show_subcmd/hidelevel.rb
|
245
249
|
- processor/command/show_subcmd/auto_subcmd/list.rb
|
246
250
|
- processor/command/show_subcmd/auto_subcmd/irb.rb
|
247
251
|
- processor/command/show_subcmd/auto_subcmd/eval.rb
|
@@ -321,7 +325,7 @@ files:
|
|
321
325
|
- test/functional/test-debugger-call-bug.rb
|
322
326
|
- test/functional/test-delete.rb
|
323
327
|
has_rdoc: true
|
324
|
-
homepage: http://wiki.github.com/rocky/
|
328
|
+
homepage: http://wiki.github.com/rocky/rb-trepanning
|
325
329
|
licenses:
|
326
330
|
- MIT
|
327
331
|
post_install_message:
|
@@ -329,13 +333,13 @@ rdoc_options:
|
|
329
333
|
- --main
|
330
334
|
- README
|
331
335
|
- --title
|
332
|
-
- Trepan 0.0.
|
336
|
+
- Trepan 0.0.8 Documentation
|
333
337
|
require_paths:
|
334
338
|
- lib
|
335
339
|
required_ruby_version: !ruby/object:Gem::Requirement
|
336
340
|
none: false
|
337
341
|
requirements:
|
338
|
-
- -
|
342
|
+
- - ~>
|
339
343
|
- !ruby/object:Gem::Version
|
340
344
|
segments:
|
341
345
|
- 1
|