trepanning 0.1.4 → 0.1.6
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/ChangeLog +188 -0
- data/Makefile +7 -0
- data/NEWS +9 -0
- data/README.textile +3 -3
- data/Rakefile +3 -3
- data/app/breakpoint.rb +1 -1
- data/app/brkptmgr.rb +1 -1
- data/app/client.rb +15 -4
- data/app/core.rb +4 -4
- data/app/default.rb +1 -0
- data/app/display.rb +1 -1
- data/app/frame.rb +38 -19
- data/app/options.rb +4 -1
- data/app/run.rb +12 -2
- data/bin/trepan +2 -1
- data/check-filter.rb +18 -0
- data/interface/client.rb +1 -1
- data/interface/comcodes.rb +9 -8
- data/interface/server.rb +38 -2
- data/interface/user.rb +2 -2
- data/io/input.rb +11 -3
- data/io/tcpclient.rb +0 -2
- data/io/tcpserver.rb +3 -2
- data/lib/trepanning.rb +8 -8
- data/processor.rb +4 -4
- data/processor/command/backtrace.rb +1 -1
- data/processor/command/base/subcmd.rb +4 -1
- data/processor/command/break.rb +1 -1
- data/processor/command/condition.rb +1 -1
- data/processor/command/debug.rb +19 -15
- data/processor/command/delete.rb +2 -1
- data/processor/command/disassemble.rb +2 -2
- data/processor/command/display.rb +1 -1
- data/processor/command/down.rb +1 -2
- data/processor/command/finish.rb +8 -4
- data/processor/command/frame.rb +1 -1
- data/processor/command/help.rb +1 -1
- data/processor/command/info_subcmd/breakpoints.rb +1 -1
- data/processor/command/info_subcmd/registers.rb +1 -1
- data/processor/command/info_subcmd/source.rb +1 -1
- data/processor/command/info_subcmd/thread.rb +2 -2
- data/processor/command/list.rb +1 -1
- data/processor/command/set_subcmd/auto_subcmd/eval.rb +10 -6
- data/processor/command/set_subcmd/auto_subcmd/irb.rb +2 -2
- data/processor/command/set_subcmd/auto_subcmd/list.rb +2 -2
- data/processor/command/set_subcmd/substitute_subcmd/eval.rb +1 -1
- data/processor/command/show_subcmd/abbrev.rb +2 -2
- data/processor/command/undisplay.rb +1 -1
- data/processor/command/up.rb +1 -2
- data/processor/eval.rb +9 -5
- data/processor/frame.rb +1 -1
- data/processor/list.rb +1 -1
- data/processor/location.rb +3 -2
- data/processor/mock.rb +3 -3
- data/processor/running.rb +1 -1
- data/processor/validate.rb +1 -1
- data/test/example/factorial.rb +10 -0
- data/test/example/gcd1.rb +1 -1
- data/test/functional/fn_helper.rb +1 -1
- data/test/functional/test-recursive-bt.rb +103 -0
- data/test/functional/test-remap.rb +50 -0
- data/test/integration/test-remote.rb +23 -0
- data/test/unit/test-app-brkpt.rb +1 -1
- data/test/unit/test-app-brkptmgr.rb +2 -2
- data/test/unit/test-app-display.rb +1 -1
- data/test/unit/test-app-frame.rb +3 -3
- data/test/unit/test-app-options.rb +1 -1
- data/test/unit/test-cmd-break.rb +2 -2
- data/test/unit/test-cmd-endisable.rb +1 -1
- data/test/unit/test-cmd-parse_list_cmd.rb +1 -1
- data/test/unit/test-cmd-quit.rb +1 -0
- data/test/unit/test-cmd-set-auto-eval.rb.try +19 -0
- data/test/unit/test-proc-eval.rb +1 -1
- data/test/unit/test-proc-frame.rb +2 -2
- data/test/unit/test-proc-list.rb +1 -1
- data/test/unit/test-proc-location.rb +1 -1
- data/test/unit/test-proc-validate.rb +3 -3
- data/trepanning.gemspec +5 -5
- metadata +101 -104
data/processor/running.rb
CHANGED
data/processor/validate.rb
CHANGED
@@ -366,7 +366,7 @@ if __FILE__ == $0
|
|
366
366
|
cmdproc.frame_initialize
|
367
367
|
cmdproc.instance_variable_set('@settings',
|
368
368
|
Trepan::CmdProcessor::DEFAULT_SETTINGS)
|
369
|
-
cmdproc.frame_setup(RubyVM::
|
369
|
+
cmdproc.frame_setup(RubyVM::Frame.current)
|
370
370
|
onoff = %w(1 0 on off)
|
371
371
|
onoff.each { |val| puts "onoff(#{val}) = #{cmdproc.get_onoff(val)}" }
|
372
372
|
%w(1 1E bad 1+1 -5).each do |val|
|
data/test/example/gcd1.rb
CHANGED
@@ -0,0 +1,103 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'test/unit'
|
3
|
+
require 'trace'
|
4
|
+
require_relative 'fn_helper'
|
5
|
+
|
6
|
+
class TestRecursiveBt < Test::Unit::TestCase
|
7
|
+
|
8
|
+
include FnTestHelper
|
9
|
+
|
10
|
+
def test_recursive_backtrace
|
11
|
+
|
12
|
+
cmds = [
|
13
|
+
'set events line',
|
14
|
+
'set basename on',
|
15
|
+
'step',
|
16
|
+
'bt 1',
|
17
|
+
'step',
|
18
|
+
'step',
|
19
|
+
'bt 2',
|
20
|
+
'step',
|
21
|
+
'step',
|
22
|
+
'bt 3',
|
23
|
+
'step',
|
24
|
+
'step',
|
25
|
+
'step',
|
26
|
+
'bt 5',
|
27
|
+
'step',
|
28
|
+
'step',
|
29
|
+
'step',
|
30
|
+
'bt 7',
|
31
|
+
]
|
32
|
+
d = strarray_setup(cmds)
|
33
|
+
d.start
|
34
|
+
##############################
|
35
|
+
def factorial(n)
|
36
|
+
if n > 0
|
37
|
+
return n * factorial(n-1)
|
38
|
+
else
|
39
|
+
return 1
|
40
|
+
end
|
41
|
+
end
|
42
|
+
z = factorial(5)
|
43
|
+
##############################
|
44
|
+
d.stop
|
45
|
+
out =
|
46
|
+
["-- ",
|
47
|
+
"def factorial(n)",
|
48
|
+
"Trace events we may stop on:",
|
49
|
+
"\tbrkpt, line",
|
50
|
+
"basename is on.",
|
51
|
+
"-- ",
|
52
|
+
"z = factorial(5)",
|
53
|
+
"--> #0 METHOD TestRecursiveBt#test_recursive_backtrace() in file test-recursive-bt.rb at line 42",
|
54
|
+
"(More stack frames follow...)",
|
55
|
+
"-- ",
|
56
|
+
"if n > 0",
|
57
|
+
"-- ",
|
58
|
+
"return n * factorial(n-1)",
|
59
|
+
"--> #0 METHOD TestRecursiveBt#factorial(n) in file test-recursive-bt.rb at line 37",
|
60
|
+
" #1 METHOD TestRecursiveBt#test_recursive_backtrace() in file test-recursive-bt.rb at line 42",
|
61
|
+
"(More stack frames follow...)",
|
62
|
+
"-- ",
|
63
|
+
"if n > 0",
|
64
|
+
"-- ",
|
65
|
+
"return n * factorial(n-1)",
|
66
|
+
"--> #0 METHOD TestRecursiveBt#factorial(n) in file test-recursive-bt.rb at line 37",
|
67
|
+
" #1 METHOD TestRecursiveBt#factorial(n) in file test-recursive-bt.rb at line 37",
|
68
|
+
" #2 METHOD TestRecursiveBt#test_recursive_backtrace() in file test-recursive-bt.rb at line 42",
|
69
|
+
"(More stack frames follow...)",
|
70
|
+
"-- ",
|
71
|
+
"if n > 0",
|
72
|
+
"-- ",
|
73
|
+
"return n * factorial(n-1)",
|
74
|
+
"-- ",
|
75
|
+
"if n > 0",
|
76
|
+
"--> #0 METHOD TestRecursiveBt#factorial(n) in file test-recursive-bt.rb at line 36",
|
77
|
+
" #1 METHOD TestRecursiveBt#factorial(n) in file test-recursive-bt.rb at line 37",
|
78
|
+
"... above line repeated 2 times",
|
79
|
+
" #4 METHOD TestRecursiveBt#test_recursive_backtrace() in file test-recursive-bt.rb at line 42",
|
80
|
+
"(More stack frames follow...)",
|
81
|
+
"-- ",
|
82
|
+
"return n * factorial(n-1)",
|
83
|
+
"-- ",
|
84
|
+
"if n > 0",
|
85
|
+
"-- ",
|
86
|
+
"return n * factorial(n-1)",
|
87
|
+
"--> #0 METHOD TestRecursiveBt#factorial(n) in file test-recursive-bt.rb at line 37",
|
88
|
+
" #1 METHOD TestRecursiveBt#factorial(n) in file test-recursive-bt.rb at line 37",
|
89
|
+
"... above line repeated 3 times",
|
90
|
+
" #5 METHOD TestRecursiveBt#test_recursive_backtrace() in file test-recursive-bt.rb at line 42",
|
91
|
+
" #6 METHOD TestRecursiveBt#run(runner) in file unit.rb at line xxx",
|
92
|
+
"(More stack frames follow...)",
|
93
|
+
"-- ",
|
94
|
+
"if n > 0",
|
95
|
+
"-- ",
|
96
|
+
"return 1",
|
97
|
+
"-- ",
|
98
|
+
"d.stop"]
|
99
|
+
d.intf[-1].output.output[-8].sub!(/at line \d+$/, 'at line xxx')
|
100
|
+
compare_output(out, d, cmds)
|
101
|
+
|
102
|
+
end
|
103
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'test/unit'
|
3
|
+
require 'trace'
|
4
|
+
require_relative 'fn_helper'
|
5
|
+
|
6
|
+
class TestRemap < Test::Unit::TestCase
|
7
|
+
|
8
|
+
include FnTestHelper
|
9
|
+
|
10
|
+
def test_remap
|
11
|
+
skip "Not sure what this one was supposed to test - Investigate."
|
12
|
+
cmds = [
|
13
|
+
'step',
|
14
|
+
'list',
|
15
|
+
]
|
16
|
+
d = strarray_setup(cmds)
|
17
|
+
d.start
|
18
|
+
##############################
|
19
|
+
require 'date'
|
20
|
+
##############################
|
21
|
+
d.stop
|
22
|
+
out = [
|
23
|
+
'-- ',
|
24
|
+
"require 'date'",
|
25
|
+
'METHOD TestRemap#require(path)',
|
26
|
+
'-> ',
|
27
|
+
'def require(path) # :doc:',
|
28
|
+
' 20 # is.',
|
29
|
+
' 21 # * Otherwise, installed gems are searched for a file that matches.',
|
30
|
+
" 22 # If it's found in gem 'y', that gem is activated (added to the",
|
31
|
+
' 23 # loadpath).',
|
32
|
+
' 24 #',
|
33
|
+
' 25 # The normal <tt>require</tt> functionality of returning false if',
|
34
|
+
' 26 # that file has already been loaded is preserved.',
|
35
|
+
' 27 ',
|
36
|
+
' 28 -> def require(path) # :doc:',
|
37
|
+
' 29 gem_original_require path',
|
38
|
+
'-- ',
|
39
|
+
'gem_original_require path',
|
40
|
+
'<- ',
|
41
|
+
'R=> false',
|
42
|
+
'end',
|
43
|
+
'-- ',
|
44
|
+
'd.stop'
|
45
|
+
]
|
46
|
+
compare_output(out, d, cmds)
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'test/unit'
|
3
|
+
require_relative 'helper'
|
4
|
+
|
5
|
+
class TestQuit < Test::Unit::TestCase
|
6
|
+
@@NAME = File.basename(__FILE__, '.rb')[5..-1]
|
7
|
+
|
8
|
+
def test_trepan_call
|
9
|
+
skip('need a usable fork to run this') unless Process.respond_to?(:fork)
|
10
|
+
skip('Not ready for prime time yet')
|
11
|
+
cmdfile = File.join(File.dirname(__FILE__), '../data/quit.cmd')
|
12
|
+
child = fork
|
13
|
+
if child
|
14
|
+
## FIXME: client doesn't work with cmdfile yet.
|
15
|
+
serveropts = {:dbgr => '--client', :cmdfile => cmdfile}
|
16
|
+
run_debugger(@@NAME, 'gcd.rb', serveropts)
|
17
|
+
Process.wait
|
18
|
+
else
|
19
|
+
clientopts = {:dbgr => '--server', :nocommand => true}
|
20
|
+
run_debugger(@@NAME, 'gcd.rb', clientopts)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/test/unit/test-app-brkpt.rb
CHANGED
@@ -11,7 +11,7 @@ class TestLibAppBrkptMgr < Test::Unit::TestCase
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def test_basic
|
14
|
-
tf = RubyVM::
|
14
|
+
tf = RubyVM::Frame.current
|
15
15
|
iseq = tf.iseq
|
16
16
|
offsets = iseq.offsetlines.keys
|
17
17
|
offset = offsets[0]
|
@@ -32,7 +32,7 @@ class TestLibAppBrkptMgr < Test::Unit::TestCase
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def test_multiple_brkpt_per_offset
|
35
|
-
tf = RubyVM::
|
35
|
+
tf = RubyVM::Frame.current
|
36
36
|
iseq = tf.iseq
|
37
37
|
offsets = iseq.offsetlines.keys
|
38
38
|
offset = offsets[0]
|
data/test/unit/test-app-frame.rb
CHANGED
@@ -8,19 +8,19 @@ class TestAppFrame < Test::Unit::TestCase
|
|
8
8
|
include Trepan::Frame
|
9
9
|
|
10
10
|
def test_app_frame
|
11
|
-
frame = RubyVM::
|
11
|
+
frame = RubyVM::Frame.current
|
12
12
|
base_count = frame.stack_size
|
13
13
|
s = format_stack_entry(frame)
|
14
14
|
pat = /^METHOD .*#test_app_frame\(\) in file .*test-app-frame.rb at line \d+/
|
15
15
|
assert(s =~ pat, "got #{s}, expected pat #{pat}")
|
16
16
|
1.times do
|
17
|
-
assert_equal(base_count+2, RubyVM::
|
17
|
+
assert_equal(base_count+2, RubyVM::Frame.current.stack_size)
|
18
18
|
s = format_stack_entry(frame)
|
19
19
|
assert(s =~ pat, "got #{s}, expected pat #{pat}")
|
20
20
|
end
|
21
21
|
|
22
22
|
def inner_test(count)
|
23
|
-
frame = RubyVM::
|
23
|
+
frame = RubyVM::Frame.current
|
24
24
|
assert_equal(count, frame.stack_size)
|
25
25
|
|
26
26
|
s = format_stack_entry(frame)
|
data/test/unit/test-cmd-break.rb
CHANGED
@@ -18,7 +18,7 @@ class TestCommandBreak < Test::Unit::TestCase
|
|
18
18
|
|
19
19
|
# require_relative '../../lib/trepanning'
|
20
20
|
def test_basic
|
21
|
-
tf = RubyVM::
|
21
|
+
tf = RubyVM::Frame.current
|
22
22
|
@cmdproc.frame_setup(tf)
|
23
23
|
[
|
24
24
|
[@name, __LINE__.to_s],
|
@@ -66,7 +66,7 @@ class TestCommandBreak < Test::Unit::TestCase
|
|
66
66
|
# require_relative '../../lib/trepanning'
|
67
67
|
line = __LINE__ # This is the line we set the breakpoint for.
|
68
68
|
1.times do
|
69
|
-
tf = RubyVM::
|
69
|
+
tf = RubyVM::Frame.current
|
70
70
|
@cmdproc.frame_setup(tf)
|
71
71
|
run_cmd(@my_cmd, [@name, line.to_s])
|
72
72
|
assert_equal(true, @cmdproc.errmsgs.empty?, @cmdproc.errmsgs)
|
data/test/unit/test-cmd-quit.rb
CHANGED
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'test/unit'
|
3
|
+
require_relative '../../processor/command/set_subcmd/auto'
|
4
|
+
require_relative '../../processor/mock'
|
5
|
+
|
6
|
+
class TestCommandStep < Test::Unit::TestCase
|
7
|
+
|
8
|
+
include MockDebugger
|
9
|
+
def test_set_autoeval_save
|
10
|
+
dbgr, cmd = Trepan::MockDebugger::setup('set', false)
|
11
|
+
cmds = dbgr.core.processor.commands
|
12
|
+
set_cmd = cmds['set']
|
13
|
+
auto_cmd = Trepan::SubSubcommand::SetAuto.new(dbgr.core.processor,
|
14
|
+
set_cmd)
|
15
|
+
eval_cmd = Trepan::SubSubcommand::SetAutoEval.new(cmd, auto_cmd, 'eval');
|
16
|
+
eval_cmd.run([eval_cmd.name, 'on'])
|
17
|
+
assert_equal(["set auto eval on"], eval_cmd.save_command)
|
18
|
+
end
|
19
|
+
end
|
data/test/unit/test-proc-eval.rb
CHANGED
@@ -15,7 +15,7 @@ class TestProcEval < Test::Unit::TestCase
|
|
15
15
|
cmdp.fake_eval_filename('x = 1; y = 2', 7))
|
16
16
|
x = 1
|
17
17
|
require 'thread_frame'
|
18
|
-
cmdp.instance_variable_set('@frame', RubyVM::
|
18
|
+
cmdp.instance_variable_set('@frame', RubyVM::Frame.current)
|
19
19
|
cmdp.instance_variable_set('@settings', {:stack_trace_on_error => true})
|
20
20
|
assert_equal('1', cmdp.debug_eval('x = "#{x}"'))
|
21
21
|
x = 2
|
@@ -34,7 +34,7 @@ class TestCmdProcessorFrame < Test::Unit::TestCase
|
|
34
34
|
|
35
35
|
# See that we have can load up commands
|
36
36
|
def test_basic
|
37
|
-
@proc.frame_setup(RubyVM::
|
37
|
+
@proc.frame_setup(RubyVM::Frame.current)
|
38
38
|
|
39
39
|
# Test absolute positioning. Should all be okay
|
40
40
|
0.upto(@proc.top_frame.stack_size-1) do |i|
|
@@ -53,7 +53,7 @@ class TestCmdProcessorFrame < Test::Unit::TestCase
|
|
53
53
|
assert_equal(frame_index, @proc.frame_index)
|
54
54
|
|
55
55
|
setup
|
56
|
-
@proc.top_frame = @proc.frame = RubyVM::
|
56
|
+
@proc.top_frame = @proc.frame = RubyVM::Frame.current
|
57
57
|
@proc.adjust_frame(0, true)
|
58
58
|
|
59
59
|
@proc.top_frame.stack_size-1.times do
|
data/test/unit/test-proc-list.rb
CHANGED
@@ -22,7 +22,7 @@ class TestCmdProcessorLocation < Test::Unit::TestCase
|
|
22
22
|
assert_equal File.basename(__FILE__), @cmdproc.canonic_file(__FILE__)
|
23
23
|
eval <<-EOE
|
24
24
|
@cmdproc.frame_initialize
|
25
|
-
@cmdproc.frame_setup(RubyVM::
|
25
|
+
@cmdproc.frame_setup(RubyVM::Frame.current)
|
26
26
|
assert @cmdproc.current_source_text
|
27
27
|
EOE
|
28
28
|
end
|
@@ -44,7 +44,7 @@ class TestValidate < Test::Unit::TestCase
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def test_parse_position
|
47
|
-
tf = RubyVM::
|
47
|
+
tf = RubyVM::Frame.current
|
48
48
|
@cmdproc.frame_setup(tf)
|
49
49
|
file = File.basename(__FILE__)
|
50
50
|
[[__FILE__, [true, file, nil, nil]],
|
@@ -71,7 +71,7 @@ class TestValidate < Test::Unit::TestCase
|
|
71
71
|
end
|
72
72
|
|
73
73
|
# def test_breakpoint_position
|
74
|
-
# tf = RubyVM::
|
74
|
+
# tf = RubyVM::Frame.current
|
75
75
|
# @cmdproc.frame_setup(tf)
|
76
76
|
|
77
77
|
# def munge(args)
|
@@ -97,7 +97,7 @@ class TestValidate < Test::Unit::TestCase
|
|
97
97
|
def test_method?
|
98
98
|
def foo; 5 end
|
99
99
|
require 'irb'
|
100
|
-
tf = RubyVM::
|
100
|
+
tf = RubyVM::Frame.current
|
101
101
|
@cmdproc.frame_setup(tf)
|
102
102
|
@cmdproc.method?('@cmdproc.errmsg')
|
103
103
|
%w(Array.map @cmdproc.errmsg foo Trepan::CmdProcessor.new IRB.start
|
data/trepanning.gemspec
CHANGED
@@ -14,12 +14,12 @@ A modular, testable, Ruby debugger using some of the best ideas from ruby-debug,
|
|
14
14
|
|
15
15
|
Some of the core debugger concepts have been rethought. As a result, some of this may be experimental.
|
16
16
|
|
17
|
-
This version works only with a patched version of Ruby 1.9.2 and rb-threadframe.
|
17
|
+
This version works only with a patched version of Ruby 1.9.2 or Ruby 1.9.3 and rb-threadframe.
|
18
18
|
|
19
19
|
See also rbx-trepanning for a version that works with Rubinius.
|
20
20
|
EOF
|
21
|
-
spec.add_dependency('rb-threadframe', '>= 0.
|
22
|
-
spec.add_dependency('rb-trace', '>= 0.5')
|
21
|
+
spec.add_dependency('rb-threadframe', '>= 0.39.9')
|
22
|
+
spec.add_dependency('rb-trace', '>= 0.5.9')
|
23
23
|
spec.add_dependency('linecache-tf', '>= 1.0')
|
24
24
|
spec.add_dependency('columnize')
|
25
25
|
spec.add_development_dependency('diff-lcs') # For testing only
|
@@ -34,8 +34,8 @@ EOF
|
|
34
34
|
spec.license = 'MIT'
|
35
35
|
spec.platform = Gem::Platform::RUBY
|
36
36
|
spec.require_path = 'lib'
|
37
|
-
spec.required_ruby_version = '~> 1.9.2frame'
|
38
|
-
spec.summary = 'Modular Ruby 1.9.2 Debugger'
|
37
|
+
# spec.required_ruby_version = '~> 1.9.2frame'
|
38
|
+
spec.summary = 'Modular Ruby 1.9.2 or 1.9.3 Debugger'
|
39
39
|
spec.version = Trepan::VERSION
|
40
40
|
|
41
41
|
# Make the readme file the start page for the generated html
|