rbx-trepanning 0.0.5-universal-rubinius-1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +2002 -0
- data/LICENSE +25 -0
- data/NEWS +31 -0
- data/README.textile +34 -0
- data/Rakefile +165 -0
- data/THANKS +14 -0
- data/app/breakpoint.rb +219 -0
- data/app/breakpoint.rbc +3551 -0
- data/app/brkptmgr.rb +140 -0
- data/app/brkptmgr.rbc +2903 -0
- data/app/client.rb +61 -0
- data/app/client.rbc +1225 -0
- data/app/complete.rb +52 -0
- data/app/complete.rbc +1288 -0
- data/app/default.rb +71 -0
- data/app/default.rbc +1132 -0
- data/app/display.rb +148 -0
- data/app/display.rbc +2578 -0
- data/app/frame.rb +98 -0
- data/app/frame.rbc +1808 -0
- data/app/irb.rb +111 -0
- data/app/irb.rbc +2094 -0
- data/app/iseq.rb +117 -0
- data/app/iseq.rbc +2192 -0
- data/app/llvm.rbc +2478 -0
- data/app/method.rb +173 -0
- data/app/method.rbc +2492 -0
- data/app/method_name.rbc +2467 -0
- data/app/mock.rb +13 -0
- data/app/mock.rbc +398 -0
- data/app/options.rb +137 -0
- data/app/options.rbc +2898 -0
- data/app/rbx-llvm.rb +165 -0
- data/app/rbx-llvm.rbc +2478 -0
- data/app/run.rb +86 -0
- data/app/run.rbc +1244 -0
- data/app/util.rb +49 -0
- data/app/util.rbc +1146 -0
- data/app/validate.rb +30 -0
- data/app/validate.rbc +676 -0
- data/bin/trepan.compiled.rbc +1043 -0
- data/bin/trepanx +69 -0
- data/bin/trepanx.compiled.rbc +1049 -0
- data/data/irbrc +41 -0
- data/data/irbrc.compiled.rbc +640 -0
- data/interface/base_intf.rb +105 -0
- data/interface/base_intf.rbc +1899 -0
- data/interface/client.rb +80 -0
- data/interface/client.rbc +1072 -0
- data/interface/comcodes.rb +20 -0
- data/interface/comcodes.rbc +385 -0
- data/interface/script.rb +104 -0
- data/interface/script.rbc +1642 -0
- data/interface/server.rb +143 -0
- data/interface/server.rbc +2213 -0
- data/interface/user.rb +150 -0
- data/interface/user.rbc +2867 -0
- data/io/base_io.rb +148 -0
- data/io/base_io.rbc +2111 -0
- data/io/input.rb +135 -0
- data/io/input.rbc +2528 -0
- data/io/null_output.rb +42 -0
- data/io/null_output.rbc +730 -0
- data/io/string_array.rb +156 -0
- data/io/string_array.rbc +2466 -0
- data/io/tcpclient.rb +129 -0
- data/io/tcpclient.rbc +2419 -0
- data/io/tcpfns.rb +33 -0
- data/io/tcpfns.rbc +694 -0
- data/io/tcpserver.rb +141 -0
- data/io/tcpserver.rbc +2638 -0
- data/lib/trepanning.rb +474 -0
- data/lib/trepanning.rbc +7705 -0
- data/lib/trepanning2.rb +441 -0
- data/processor/breakpoint.rb +164 -0
- data/processor/command/alias.rb +55 -0
- data/processor/command/backtrace.rb +76 -0
- data/processor/command/base/cmd.rb +173 -0
- data/processor/command/base/subcmd.rb +229 -0
- data/processor/command/base/submgr.rb +182 -0
- data/processor/command/base/subsubcmd.rb +103 -0
- data/processor/command/base/subsubmgr.rb +195 -0
- data/processor/command/break.rb +100 -0
- data/processor/command/complete.rb +37 -0
- data/processor/command/continue.rb +91 -0
- data/processor/command/delete.rb +30 -0
- data/processor/command/directory.rb +51 -0
- data/processor/command/disassemble.rb +145 -0
- data/processor/command/display.rb +82 -0
- data/processor/command/down.rb +54 -0
- data/processor/command/eval.rb +51 -0
- data/processor/command/exit.rb +62 -0
- data/processor/command/finish.rb +80 -0
- data/processor/command/frame.rb +89 -0
- data/processor/command/help.rb +251 -0
- data/processor/command/info.rb +28 -0
- data/processor/command/info_subcmd/breakpoints.rb +73 -0
- data/processor/command/info_subcmd/files.rb +209 -0
- data/processor/command/info_subcmd/line.rb +86 -0
- data/processor/command/info_subcmd/method.rb +71 -0
- data/processor/command/info_subcmd/program.rb +49 -0
- data/processor/command/info_subcmd/ruby.rb +62 -0
- data/processor/command/info_subcmd/variables.rb +48 -0
- data/processor/command/irb.rb +128 -0
- data/processor/command/kill.rb +70 -0
- data/processor/command/list.rb +300 -0
- data/processor/command/macro.rb +76 -0
- data/processor/command/next.rb +66 -0
- data/processor/command/nexti.rb +59 -0
- data/processor/command/pr.rb +38 -0
- data/processor/command/ps.rb +40 -0
- data/processor/command/restart.rb +60 -0
- data/processor/command/server.rb +72 -0
- data/processor/command/set.rb +47 -0
- data/processor/command/set_subcmd/auto.rb +27 -0
- data/processor/command/set_subcmd/auto_subcmd/dis.rb +33 -0
- data/processor/command/set_subcmd/auto_subcmd/eval.rb +54 -0
- data/processor/command/set_subcmd/auto_subcmd/irb.rb +34 -0
- data/processor/command/set_subcmd/auto_subcmd/list.rb +34 -0
- data/processor/command/set_subcmd/basename.rb +25 -0
- data/processor/command/set_subcmd/confirm.rb +24 -0
- data/processor/command/set_subcmd/debug.rb +26 -0
- data/processor/command/set_subcmd/debug_subcmd/dbgr.rb +36 -0
- data/processor/command/set_subcmd/debug_subcmd/skip.rb +23 -0
- data/processor/command/set_subcmd/debug_subcmd/step.rb +23 -0
- data/processor/command/set_subcmd/different.rb +59 -0
- data/processor/command/set_subcmd/hidelevel.rb +62 -0
- data/processor/command/set_subcmd/highlight.rb +33 -0
- data/processor/command/set_subcmd/kernelstep.rb +60 -0
- data/processor/command/set_subcmd/max.rb +26 -0
- data/processor/command/set_subcmd/max_subcmd/list.rb +49 -0
- data/processor/command/set_subcmd/max_subcmd/stack.rb +50 -0
- data/processor/command/set_subcmd/max_subcmd/string.rb +76 -0
- data/processor/command/set_subcmd/max_subcmd/width.rb +49 -0
- data/processor/command/set_subcmd/substitute.rb +24 -0
- data/processor/command/set_subcmd/substitute_subcmd/path.rb +56 -0
- data/processor/command/set_subcmd/trace.rb +36 -0
- data/processor/command/set_subcmd/trace_subcmd/print.rb +57 -0
- data/processor/command/show.rb +38 -0
- data/processor/command/show_subcmd/alias.rb +42 -0
- data/processor/command/show_subcmd/args.rb +25 -0
- data/processor/command/show_subcmd/auto.rb +28 -0
- data/processor/command/show_subcmd/auto_subcmd/dis.rb +37 -0
- data/processor/command/show_subcmd/auto_subcmd/eval.rb +28 -0
- data/processor/command/show_subcmd/auto_subcmd/irb.rb +23 -0
- data/processor/command/show_subcmd/auto_subcmd/list.rb +22 -0
- data/processor/command/show_subcmd/basename.rb +20 -0
- data/processor/command/show_subcmd/confirm.rb +18 -0
- data/processor/command/show_subcmd/debug.rb +26 -0
- data/processor/command/show_subcmd/debug_subcmd/dbgr.rb +21 -0
- data/processor/command/show_subcmd/debug_subcmd/skip.rb +22 -0
- data/processor/command/show_subcmd/debug_subcmd/step.rb +22 -0
- data/processor/command/show_subcmd/different.rb +26 -0
- data/processor/command/show_subcmd/hidelevel.rb +41 -0
- data/processor/command/show_subcmd/highlight.rb +24 -0
- data/processor/command/show_subcmd/kernelstep.rb +34 -0
- data/processor/command/show_subcmd/max.rb +27 -0
- data/processor/command/show_subcmd/max_subcmd/list.rb +38 -0
- data/processor/command/show_subcmd/max_subcmd/stack.rb +36 -0
- data/processor/command/show_subcmd/max_subcmd/string.rb +42 -0
- data/processor/command/show_subcmd/max_subcmd/width.rb +37 -0
- data/processor/command/show_subcmd/trace.rb +27 -0
- data/processor/command/show_subcmd/trace_subcmd/print.rb +38 -0
- data/processor/command/show_subcmd/version.rb +23 -0
- data/processor/command/source.rb +126 -0
- data/processor/command/step.rb +84 -0
- data/processor/command/tbreak.rb +19 -0
- data/processor/command/unalias.rb +44 -0
- data/processor/command/undisplay.rb +59 -0
- data/processor/command/up.rb +86 -0
- data/processor/default.rb +58 -0
- data/processor/disassemble.rb +46 -0
- data/processor/display.rb +18 -0
- data/processor/eval.rb +96 -0
- data/processor/frame.rb +211 -0
- data/processor/help.rb +72 -0
- data/processor/hook.rb +133 -0
- data/processor/load_cmds.rb +185 -0
- data/processor/location.rb +137 -0
- data/processor/main.rb +412 -0
- data/processor/mock.rb +144 -0
- data/processor/msg.rb +43 -0
- data/processor/running.rb +234 -0
- data/processor/stepping.rb +114 -0
- data/processor/subcmd.rb +161 -0
- data/processor/validate.rb +355 -0
- data/sample/list-terminal-colors.rb +139 -0
- data/sample/list-terminal-colors.rbc +2318 -0
- data/sample/rocky-dot-trepanxrc +14 -0
- data/sample/rocky-trepanx-colors.rb +47 -0
- data/sample/rocky-trepanx-colors.rbc +530 -0
- data/test/data/enable.right +36 -0
- data/test/data/fname-with-blank.cmd +6 -0
- data/test/data/fname-with-blank.right +4 -0
- data/test/data/inline-call.cmd +6 -0
- data/test/data/inline-call.right +13 -0
- data/test/data/quit-Xdebug.right +3 -0
- data/test/data/quit.cmd +5 -0
- data/test/data/quit.right +2 -0
- data/test/data/quit2.cmd +6 -0
- data/test/data/quit2.right +3 -0
- data/test/data/step-bug.cmd +11 -0
- data/test/data/step-bug.right +3 -0
- data/test/example/fname with blank.rb +1 -0
- data/test/example/gcd-server.rb +22 -0
- data/test/example/gcd.rb +19 -0
- data/test/example/inline-call.rb +23 -0
- data/test/example/null.rb +1 -0
- data/test/example/step-bug.rb +14 -0
- data/test/example/thread1.rb +3 -0
- data/test/functional/fn_helper.rb +112 -0
- data/test/functional/test-break-name.rb +52 -0
- data/test/functional/test-break.rb +51 -0
- data/test/functional/test-finish.rb +70 -0
- data/test/functional/test-fn_helper.rb +43 -0
- data/test/functional/test-list.rb +55 -0
- data/test/functional/test-next-bug.rb +49 -0
- data/test/functional/test-next.rb +101 -0
- data/test/functional/test-step.rb +272 -0
- data/test/functional/test-step2.rb +35 -0
- data/test/functional/test-tbreak.rb +41 -0
- data/test/integration/file-diff.rb +89 -0
- data/test/integration/helper.rb +78 -0
- data/test/integration/skip-test-step-bug.rb +17 -0
- data/test/integration/test-fname-with-blank.rb +16 -0
- data/test/integration/test-inline-call.rb +20 -0
- data/test/integration/test-quit.rb +47 -0
- data/test/unit/cmd-helper.rb +50 -0
- data/test/unit/mock-helper.rb +10 -0
- data/test/unit/test-app-brkpt.rb +29 -0
- data/test/unit/test-app-brkptmgr.rb +51 -0
- data/test/unit/test-app-iseq.rb +64 -0
- data/test/unit/test-app-method.rb +54 -0
- data/test/unit/test-app-options.rb +82 -0
- data/test/unit/test-app-run.rb +16 -0
- data/test/unit/test-app-util.rb +27 -0
- data/test/unit/test-app-validate.rb +18 -0
- data/test/unit/test-base-cmd.rb +47 -0
- data/test/unit/test-base-subcmd.rb +61 -0
- data/test/unit/test-base-submgr.rb +24 -0
- data/test/unit/test-bin-trepanx.rb +48 -0
- data/test/unit/test-cmd-alias.rb +48 -0
- data/test/unit/test-cmd-break.rb +22 -0
- data/test/unit/test-cmd-exit.rb +27 -0
- data/test/unit/test-cmd-finish.rb +27 -0
- data/test/unit/test-cmd-help.rb +104 -0
- data/test/unit/test-cmd-kill.rb +47 -0
- data/test/unit/test-cmd-source.rb +34 -0
- data/test/unit/test-cmd-step.rb +29 -0
- data/test/unit/test-completion.rb +38 -0
- data/test/unit/test-intf-user.rb +46 -0
- data/test/unit/test-io-input.rb +27 -0
- data/test/unit/test-io-tcp.rb +33 -0
- data/test/unit/test-io-tcpclient.rb +54 -0
- data/test/unit/test-io-tcpfns.rb +17 -0
- data/test/unit/test-io-tcpserver.rb +50 -0
- data/test/unit/test-proc-eval.rb +36 -0
- data/test/unit/test-proc-frame.rb +79 -0
- data/test/unit/test-proc-help.rb +16 -0
- data/test/unit/test-proc-hook.rb +30 -0
- data/test/unit/test-proc-load_cmds.rb +50 -0
- data/test/unit/test-proc-location.rb +53 -0
- data/test/unit/test-proc-main.rb +99 -0
- data/test/unit/test-proc-validate.rb +91 -0
- data/test/unit/test-subcmd-help.rb +47 -0
- metadata +398 -0
@@ -0,0 +1,36 @@
|
|
1
|
+
gcd.rb:4
|
2
|
+
def gcd(a, b)
|
3
|
+
# # ********************************************************
|
4
|
+
# # This tests the enable command.
|
5
|
+
# # ********************************************************
|
6
|
+
# set debuggertesting on
|
7
|
+
Currently testing the debugger is on.
|
8
|
+
# set callstyle last
|
9
|
+
Frame call-display style is last.
|
10
|
+
# set autoeval off
|
11
|
+
autoeval is off.
|
12
|
+
# break Object.gcd
|
13
|
+
Breakpoint 1 at Object::gcd
|
14
|
+
# # Should have a breakpoint 1
|
15
|
+
# enable br 1
|
16
|
+
# # Get help on enable
|
17
|
+
# help enable
|
18
|
+
Enable some things.
|
19
|
+
This is used to cancel the effect of the "disable" command.
|
20
|
+
--
|
21
|
+
List of enable subcommands:
|
22
|
+
--
|
23
|
+
enable breakpoints -- Enable specified breakpoints
|
24
|
+
enable display -- Enable some expressions to be displayed when program stops
|
25
|
+
# # Get help on just enable break
|
26
|
+
# help enable break
|
27
|
+
Enable specified breakpoints.
|
28
|
+
Give breakpoint numbers (separated by spaces) as arguments.
|
29
|
+
This is used to cancel the effect of the "disable" command.
|
30
|
+
# # Plain enable should work
|
31
|
+
# enable
|
32
|
+
*** "enable" must be followed "display", "breakpoints" or breakpoint numbers.
|
33
|
+
# # An invalid enable command
|
34
|
+
# enable foo
|
35
|
+
Enable breakpoints argument 'foo' needs to be a number.
|
36
|
+
# quit
|
@@ -0,0 +1,13 @@
|
|
1
|
+
-- (inline-call.rb:11 @12)
|
2
|
+
if a > b
|
3
|
+
basename is off.
|
4
|
+
6 $dbgr = Trepan.new(:nx => true, :cmdfiles => [cmdfile])
|
5
|
+
7 # GCD. We assume positive numbers
|
6
|
+
8 def gcd(a, b)
|
7
|
+
9 $dbgr.debugger
|
8
|
+
10 # Make: a <= b
|
9
|
+
11 -> if a > b
|
10
|
+
12 a, b = [b, a]
|
11
|
+
13 end
|
12
|
+
14
|
13
|
+
15 return nil if a <= 0
|
data/test/data/quit.cmd
ADDED
data/test/data/quit2.cmd
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
# ***************************************************
|
2
|
+
# This tests a stepping bug where lines looks like:
|
3
|
+
# #<Rubinius::Tuple: 0, 6, 0, 5, 16, 6, ...
|
4
|
+
# Note that line 6 and line 5 both start on offset 0
|
5
|
+
# ***************************************************
|
6
|
+
pr "HI"
|
7
|
+
next
|
8
|
+
next
|
9
|
+
next
|
10
|
+
next
|
11
|
+
# quit!
|
@@ -0,0 +1 @@
|
|
1
|
+
puts "Ha!"
|
@@ -0,0 +1,22 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# GCD. We assume positive numbers
|
3
|
+
require 'rubygems'; require 'require_relative'
|
4
|
+
require_relative '../../lib/trepanning.rb'
|
5
|
+
$dbgr = Trepan.new(:server => true)
|
6
|
+
def gcd(a, b)
|
7
|
+
$dbgr.debugger
|
8
|
+
# Make: a <= b
|
9
|
+
if a > b
|
10
|
+
a, b = [b, a]
|
11
|
+
end
|
12
|
+
|
13
|
+
return nil if a <= 0
|
14
|
+
|
15
|
+
if a == 1 or b-a == 0
|
16
|
+
return a
|
17
|
+
end
|
18
|
+
return gcd(b-a, a)
|
19
|
+
end
|
20
|
+
|
21
|
+
a, b = ARGV[0..1].map {|arg| arg.to_i}
|
22
|
+
puts "The GCD of %d and %d is %d" % [a, b, gcd(a, b)]
|
data/test/example/gcd.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# GCD. We assume positive numbers
|
4
|
+
def gcd(a, b)
|
5
|
+
# Make: a <= b
|
6
|
+
if a > b
|
7
|
+
a, b = [b, a]
|
8
|
+
end
|
9
|
+
|
10
|
+
return nil if a <= 0
|
11
|
+
|
12
|
+
if a == 1 or b-a == 0
|
13
|
+
return a
|
14
|
+
end
|
15
|
+
return gcd(b-a, a)
|
16
|
+
end
|
17
|
+
|
18
|
+
a, b = ARGV[0..1].map {|arg| arg.to_i}
|
19
|
+
puts "The GCD of %d and %d is %d" % [a, b, gcd(a, b)]
|
@@ -0,0 +1,23 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'rubygems'; require 'require_relative'
|
3
|
+
require_relative '../../lib/trepanning.rb'
|
4
|
+
DATA_DIR = File.join(File.dirname(RequireRelative::abs_file), %w(.. data))
|
5
|
+
cmdfile = File.join(DATA_DIR, 'inline-call.cmd')
|
6
|
+
$dbgr = Trepan.new(:nx => true, :cmdfiles => [cmdfile])
|
7
|
+
# GCD. We assume positive numbers
|
8
|
+
def gcd(a, b)
|
9
|
+
$dbgr.debugger
|
10
|
+
# Make: a <= b
|
11
|
+
if a > b
|
12
|
+
a, b = [b, a]
|
13
|
+
end
|
14
|
+
|
15
|
+
return nil if a <= 0
|
16
|
+
|
17
|
+
if a == 1 or b-a == 0
|
18
|
+
return a
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
a, b = ARGV[0..1].map {|arg| arg.to_i}
|
23
|
+
puts "The GCD of %d and %d is %d" % [a, b, gcd(a, b)]
|
@@ -0,0 +1 @@
|
|
1
|
+
# Nothing here. Move along.
|
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
# -*- Ruby -*-
|
3
|
+
# Are we rubinius? We'll test by checking the specific function we need.
|
4
|
+
raise RuntimeError, 'This package is for rubinius only!' unless
|
5
|
+
Object.constants.include?('Rubinius') &&
|
6
|
+
Rubinius.constants.include?('VM') &&
|
7
|
+
Rubinius::VM.respond_to?(:backtrace)
|
8
|
+
|
9
|
+
begin
|
10
|
+
require_relative 'lib/version'
|
11
|
+
puts 'Looks like you already have require_relative!'
|
12
|
+
exit 5
|
13
|
+
rescue NameError
|
14
|
+
end
|
@@ -0,0 +1,112 @@
|
|
1
|
+
## require 'thread_frame'
|
2
|
+
## require 'trace'
|
3
|
+
require 'rubygems'; require 'require_relative'
|
4
|
+
require_relative '../../lib/trepanning'
|
5
|
+
require_relative '../../io/string_array'
|
6
|
+
|
7
|
+
module FnTestHelper
|
8
|
+
## include Trace
|
9
|
+
|
10
|
+
## # Synchronous events without C frames or instructions
|
11
|
+
# Common setup to create a debugger with String Array I/O attached
|
12
|
+
def strarray_setup(debugger_cmds, insn_stepping=false)
|
13
|
+
stringin = Trepan::StringArrayInput.open(debugger_cmds)
|
14
|
+
stringout = Trepan::StringArrayOutput.open
|
15
|
+
d_opts = {:input => stringin, :output => stringout,
|
16
|
+
:nx => true}
|
17
|
+
d = Trepan.new(d_opts)
|
18
|
+
|
19
|
+
d.settings[:basename] = true
|
20
|
+
d.settings[:different] = false
|
21
|
+
d.settings[:autoeval] = false
|
22
|
+
return d
|
23
|
+
end
|
24
|
+
|
25
|
+
unless defined?(TREPAN_PROMPT)
|
26
|
+
TREPAN_PROMPT = /^\(trepanx\): /
|
27
|
+
TREPAN_LOC = /.. \(.+:\d+( @\d+)?\)/
|
28
|
+
end
|
29
|
+
|
30
|
+
# Return the caller's line number
|
31
|
+
def get_lineno
|
32
|
+
Rubinius::VM.backtrace(0)[1].line
|
33
|
+
end
|
34
|
+
|
35
|
+
def compare_output(right, d, debugger_cmds)
|
36
|
+
# require_relative '../../lib/trepanning'
|
37
|
+
# Trepan.debug(:set_restart => true)
|
38
|
+
got = filter_line_cmd(d.intf[-1].output.output)
|
39
|
+
if got != right
|
40
|
+
got.each_with_index do |got_line, i|
|
41
|
+
if i < right.size and got_line != right[i]
|
42
|
+
# dbgr.debugger
|
43
|
+
puts "! #{got_line}"
|
44
|
+
else
|
45
|
+
puts " #{got_line}"
|
46
|
+
end
|
47
|
+
end
|
48
|
+
puts '-' * 10
|
49
|
+
right.each_with_index do |right_line, i|
|
50
|
+
if i < got.size and got[i] != right_line
|
51
|
+
# dbgr.debugger
|
52
|
+
puts "! #{right_line}"
|
53
|
+
else
|
54
|
+
puts " #{right_line}"
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
assert_equal(right, got, caller[0])
|
59
|
+
end
|
60
|
+
|
61
|
+
# Return output with source lines prompt and command removed
|
62
|
+
def filter_line_cmd(a, show_prompt=false)
|
63
|
+
# Remove debugger prompt
|
64
|
+
a = a.map do |s|
|
65
|
+
s =~ TREPAN_PROMPT ? nil : s
|
66
|
+
end.compact unless show_prompt
|
67
|
+
|
68
|
+
# Remove debugger location lines.
|
69
|
+
# For example:
|
70
|
+
# -- (/src/external-vcs/trepan/tmp/gcd.rb:4 @21)
|
71
|
+
# becomes:
|
72
|
+
# --
|
73
|
+
a2 = a.map do |s|
|
74
|
+
s =~ TREPAN_LOC ? s.gsub(/\(.+:\d+( @\d+)?\)\n/, '').chomp : s.chomp
|
75
|
+
end
|
76
|
+
|
77
|
+
# Canonicalize breakpoint messages.
|
78
|
+
# For example:
|
79
|
+
# Set breakpoint 1: test/functional/test-tbreak.rb:10 (@0)
|
80
|
+
# becomes :
|
81
|
+
# Set breakpoint 1: foo.rb:55 (@3)
|
82
|
+
a3 = a2.map do |s|
|
83
|
+
s.gsub(/^Set (temporary )?breakpoint (\d+): .+:(\d+) \(@\d+\)/,
|
84
|
+
'Set \1breakpoint \2: foo.rb:55 (@3)')
|
85
|
+
end
|
86
|
+
return a3
|
87
|
+
end
|
88
|
+
|
89
|
+
end
|
90
|
+
|
91
|
+
# Demo it
|
92
|
+
if __FILE__ == $0
|
93
|
+
include FnTestHelper
|
94
|
+
strarray_setup(%w(eh bee see))
|
95
|
+
puts get_lineno()
|
96
|
+
p '-- (/src/external-vcs/trepan/tmp/gcd.rb:4)' =~ TREPAN_LOC
|
97
|
+
p '(trepan): exit' =~ TREPAN_PROMPT
|
98
|
+
output='
|
99
|
+
-- (/src/external-vcs/trepan/tmp/gcd.rb:4)
|
100
|
+
(trepan): s
|
101
|
+
-- (/src/external-vcs/trepan/tmp/gcd.rb:18)
|
102
|
+
(trepan): s
|
103
|
+
-- (/src/external-vcs/trepan/tmp/gcd.rb:19)
|
104
|
+
(trepan): s
|
105
|
+
.. (/src/external-vcs/trepan/tmp/gcd.rb:0)
|
106
|
+
(trepan): s
|
107
|
+
-> (/src/external-vcs/trepan/tmp/gcd.rb:4)
|
108
|
+
'.split(/\n/)
|
109
|
+
puts filter_line_cmd(output)
|
110
|
+
puts '-' * 10
|
111
|
+
puts filter_line_cmd(output, true)
|
112
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'test/unit'
|
3
|
+
require 'rubygems'; require 'require_relative'
|
4
|
+
require_relative 'fn_helper'
|
5
|
+
|
6
|
+
def five
|
7
|
+
5
|
8
|
+
end
|
9
|
+
|
10
|
+
class TestNameBreak < Test::Unit::TestCase
|
11
|
+
|
12
|
+
include FnTestHelper
|
13
|
+
|
14
|
+
def self.six=(val)
|
15
|
+
@six = val
|
16
|
+
end
|
17
|
+
|
18
|
+
def five?(num) 5 == num; end
|
19
|
+
|
20
|
+
def test_basic
|
21
|
+
# Check that we can set breakpoints in parent, sibling and children
|
22
|
+
# of sibling returns. We have one more 'continue' than we need
|
23
|
+
# just in case something goes wrong.
|
24
|
+
cmds = ['break Object#five', 'break TestNameBreak#five?',
|
25
|
+
'break TestNameBreak.six=',
|
26
|
+
'continue', 'continue', 'continue', 'continue']
|
27
|
+
|
28
|
+
d = strarray_setup(cmds)
|
29
|
+
##############################
|
30
|
+
d.start
|
31
|
+
five
|
32
|
+
five?(5)
|
33
|
+
TestNameBreak::six=6
|
34
|
+
##############################
|
35
|
+
d.stop # ({:remove => true})
|
36
|
+
out = ["-- ",
|
37
|
+
"five ",
|
38
|
+
"Set breakpoint 1: foo.rb:55 (@3)",
|
39
|
+
"Set breakpoint 2: foo.rb:55 (@3)",
|
40
|
+
"Set breakpoint 3: foo.rb:55 (@3)",
|
41
|
+
"xx ",
|
42
|
+
"5",
|
43
|
+
"xx ",
|
44
|
+
"def five?(num) 5 == num; end",
|
45
|
+
"xx ",
|
46
|
+
"@six = val"]
|
47
|
+
compare_output(out, d, cmds)
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
|
@@ -0,0 +1,51 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'test/unit'
|
3
|
+
require 'rubygems'; require 'require_relative'
|
4
|
+
require_relative 'fn_helper'
|
5
|
+
|
6
|
+
class TestBreak < Test::Unit::TestCase
|
7
|
+
|
8
|
+
include FnTestHelper
|
9
|
+
|
10
|
+
def test_line_only_break
|
11
|
+
# Check that we can set breakpoints in parent, sibling and children
|
12
|
+
# of sibling returns. We have one more 'continue' than we need
|
13
|
+
# just in case something goes wrong.
|
14
|
+
cmds_pat = ((['break %d'] * 4) + (%w(continue) * 4)).join("\n")
|
15
|
+
line = __LINE__
|
16
|
+
cmds = (cmds_pat % [line, line+6, line+11, line+14]).split(/\n/)
|
17
|
+
d = strarray_setup(cmds)
|
18
|
+
##############################
|
19
|
+
def foo # line + 4
|
20
|
+
a = 5 # line + 5
|
21
|
+
b = 6 # line + 6
|
22
|
+
end # line + 7
|
23
|
+
1.times do # line + 8
|
24
|
+
d.start # line + 9
|
25
|
+
1.times do # line + 10
|
26
|
+
x = 11 # line + 11
|
27
|
+
foo # line + 12
|
28
|
+
end # line + 13
|
29
|
+
c = 14 # line + 14
|
30
|
+
end
|
31
|
+
##############################
|
32
|
+
d.stop # ({:remove => true})
|
33
|
+
out = ["-- ",
|
34
|
+
'1.times do # line + 10',
|
35
|
+
'Set breakpoint 1: foo.rb:55 (@3)',
|
36
|
+
'Set breakpoint 2: foo.rb:55 (@3)',
|
37
|
+
'Set breakpoint 3: foo.rb:55 (@3)',
|
38
|
+
'Set breakpoint 4: foo.rb:55 (@3)',
|
39
|
+
'xx ',
|
40
|
+
'x = 11 # line + 11',
|
41
|
+
'xx ',
|
42
|
+
'b = 6 # line + 6',
|
43
|
+
'xx ',
|
44
|
+
'c = 14 # line + 14'
|
45
|
+
]
|
46
|
+
compare_output(out, d, cmds)
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
|
@@ -0,0 +1,70 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'test/unit'
|
3
|
+
require 'rubygems'; require 'require_relative'
|
4
|
+
require_relative 'fn_helper'
|
5
|
+
|
6
|
+
class TestFinish < Test::Unit::TestCase
|
7
|
+
|
8
|
+
include FnTestHelper
|
9
|
+
|
10
|
+
def test_finish_between_fn
|
11
|
+
# "Finish" over a recursive function. We use a recursive function
|
12
|
+
# so that we check that the temporary breakpoint created in the
|
13
|
+
# implementation is specific to the frame. See Rubinius issue
|
14
|
+
# #558.
|
15
|
+
def fact(x)
|
16
|
+
return 1 if x <= 1
|
17
|
+
x = x * fact(x-1)
|
18
|
+
return x
|
19
|
+
end
|
20
|
+
# An extra 'continue' added in case something goes wrong.
|
21
|
+
cmds = %w(step finish) + ['pr x', 'continue', 'continue']
|
22
|
+
d = strarray_setup(cmds)
|
23
|
+
d.start
|
24
|
+
##############################
|
25
|
+
x = fact(4)
|
26
|
+
y = 5
|
27
|
+
##############################
|
28
|
+
d.stop # ({:remove => true})
|
29
|
+
out = ['-- ',
|
30
|
+
'x = fact(4)',
|
31
|
+
'-> ',
|
32
|
+
'return 1 if x <= 1',
|
33
|
+
'<- ',
|
34
|
+
'return x',
|
35
|
+
'24']
|
36
|
+
compare_output(out, d, cmds)
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_finish_between_fn_simple
|
40
|
+
|
41
|
+
# Finish over functions
|
42
|
+
def five; 5 end
|
43
|
+
def something(x)
|
44
|
+
return 1 if x <= 1
|
45
|
+
x =
|
46
|
+
if five > 5
|
47
|
+
24
|
48
|
+
else
|
49
|
+
22
|
50
|
+
end
|
51
|
+
end
|
52
|
+
cmds = %w(step finish) + ['pr x', 'continue']
|
53
|
+
d = strarray_setup(cmds)
|
54
|
+
d.start
|
55
|
+
##############################
|
56
|
+
x = something(4)
|
57
|
+
y = 5
|
58
|
+
##############################
|
59
|
+
d.stop # ({:remove => true})
|
60
|
+
out = [
|
61
|
+
'-- ',
|
62
|
+
'x = something(4)',
|
63
|
+
'-> ',
|
64
|
+
'return 1 if x <= 1',
|
65
|
+
'<- ',
|
66
|
+
'22', '22']
|
67
|
+
compare_output(out, d, cmds)
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|