rbx-trepanning 0.0.8-universal-rubinius-1.2 → 0.1.0-universal-rubinius-1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +762 -238
- data/NEWS +44 -0
- data/Rakefile +61 -32
- data/app/breakpoint.rb +2 -0
- data/app/brkptmgr.rb +9 -11
- data/app/client.rb +0 -1
- data/app/cmd_parse.kpeg +21 -4
- data/app/cmd_parse.rb +10 -10
- data/app/cmd_parser.rb +1029 -840
- data/app/complete.rb +1 -1
- data/app/display.rb +38 -0
- data/app/file.rb +24 -0
- data/app/frame.rb +11 -4
- data/app/irb.rb +41 -39
- data/app/iseq.rb +71 -0
- data/app/options.rb +55 -30
- data/app/rbx-llvm.rb +0 -2
- data/app/run.rb +13 -9
- data/app/util.rb +55 -5
- data/bin/trepanx +3 -3
- data/data/irbrc +13 -13
- data/{interface/base_intf.rb → interface.rb} +5 -1
- data/interface/client.rb +4 -0
- data/interface/script.rb +13 -5
- data/interface/server.rb +5 -1
- data/interface/user.rb +8 -1
- data/{io/base_io.rb → io.rb} +0 -0
- data/io/input.rb +1 -1
- data/io/null_output.rb +28 -24
- data/io/string_array.rb +2 -3
- data/io/tcpclient.rb +1 -1
- data/io/tcpserver.rb +1 -1
- data/lib/trepanning.rb +11 -13
- data/{processor/main.rb → processor.rb} +50 -54
- data/processor/breakpoint.rb +150 -137
- data/processor/{command/base/cmd.rb → command.rb} +1 -1
- data/processor/command/alias.rb +14 -3
- data/processor/command/backtrace.rb +2 -1
- data/processor/command/base/subcmd.rb +1 -5
- data/processor/command/base/submgr.rb +5 -2
- data/processor/command/base/subsubcmd.rb +1 -1
- data/processor/command/base/subsubmgr.rb +4 -4
- data/processor/command/break.rb +1 -1
- data/processor/command/complete.rb +2 -1
- data/processor/command/condition.rb +2 -2
- data/processor/command/continue.rb +4 -4
- data/processor/command/delete.rb +34 -20
- data/processor/command/directory.rb +4 -4
- data/processor/command/disable.rb +71 -0
- data/processor/command/disassemble.rb +55 -22
- data/processor/command/display.rb +3 -1
- data/processor/command/down.rb +8 -8
- data/processor/command/edit.rb +74 -0
- data/processor/command/enable.rb +43 -0
- data/processor/command/eval.rb +37 -15
- data/processor/command/exit.rb +25 -6
- data/processor/command/finish.rb +5 -5
- data/processor/command/frame.rb +2 -2
- data/processor/command/help.rb +7 -9
- data/processor/command/help/README +10 -0
- data/processor/command/help/command.txt +37 -27
- data/processor/command/help/examples.txt +16 -0
- data/processor/command/help/filename.txt +1 -1
- data/processor/command/help/suffixes.txt +17 -0
- data/processor/command/info.rb +3 -1
- data/processor/command/info_subcmd/files.rb +3 -2
- data/processor/command/info_subcmd/frame.rb +2 -1
- data/processor/command/info_subcmd/line.rb +17 -28
- data/processor/command/info_subcmd/locals.rb +22 -0
- data/processor/command/{show_subcmd → info_subcmd}/macro.rb +4 -4
- data/processor/command/info_subcmd/program.rb +2 -0
- data/processor/command/info_subcmd/ruby.rb +2 -0
- data/processor/command/info_subcmd/source.rb +75 -0
- data/processor/command/info_subcmd/stack.rb +25 -0
- data/processor/command/info_subcmd/variables.rb +23 -36
- data/processor/command/info_subcmd/variables_subcmd/.gitignore +2 -0
- data/processor/command/info_subcmd/variables_subcmd/class.rb +42 -0
- data/processor/command/info_subcmd/variables_subcmd/constant.rb +42 -0
- data/processor/command/info_subcmd/variables_subcmd/globals.rb +69 -0
- data/processor/command/info_subcmd/variables_subcmd/instance.rb +42 -0
- data/processor/command/info_subcmd/variables_subcmd/locals.rb +80 -0
- data/processor/command/kill.rb +8 -9
- data/processor/command/list.rb +101 -167
- data/processor/command/macro.rb +28 -10
- data/processor/command/next.rb +2 -1
- data/processor/command/nexti.rb +1 -1
- data/processor/command/parsetree.rb +51 -0
- data/processor/command/pr.rb +1 -2
- data/processor/command/ps.rb +1 -1
- data/processor/command/restart.rb +2 -2
- data/processor/command/save.rb +1 -1
- data/processor/command/server.rb +1 -1
- data/processor/command/set_subcmd/abbrev.rb +25 -0
- data/processor/command/set_subcmd/auto.rb +7 -1
- data/processor/command/set_subcmd/auto_subcmd/eval.rb +1 -2
- data/processor/command/set_subcmd/auto_subcmd/irb.rb +2 -3
- data/processor/command/set_subcmd/auto_subcmd/list.rb +2 -3
- data/processor/command/set_subcmd/different.rb +1 -1
- data/processor/command/set_subcmd/highlight.rb +7 -1
- data/processor/command/set_subcmd/reload.rb +42 -0
- data/processor/command/set_subcmd/timer.rb +58 -0
- data/processor/command/set_subcmd/trace.rb +4 -3
- data/processor/command/{irb.rb → shell.rb} +22 -19
- data/processor/command/show_subcmd/abbrev.rb +20 -0
- data/processor/command/show_subcmd/{alias.rb → aliases.rb} +2 -2
- data/processor/command/show_subcmd/auto_subcmd/eval.rb +2 -6
- data/processor/command/show_subcmd/directories.rb +22 -0
- data/processor/command/show_subcmd/hidelevel.rb +1 -1
- data/processor/command/show_subcmd/highlight.rb +2 -1
- data/processor/command/show_subcmd/reload.rb +18 -0
- data/processor/command/show_subcmd/timer.rb +18 -0
- data/processor/command/source.rb +9 -9
- data/processor/command/step.rb +1 -1
- data/processor/command/tbreak.rb +3 -2
- data/processor/command/unalias.rb +11 -6
- data/processor/command/undisplay.rb +13 -9
- data/processor/command/up.rb +13 -14
- data/processor/default.rb +47 -44
- data/processor/disassemble.rb +48 -35
- data/processor/display.rb +38 -3
- data/processor/eval.rb +54 -53
- data/processor/eventbuf.rb +69 -69
- data/processor/frame.rb +186 -187
- data/processor/help.rb +6 -4
- data/processor/hook.rb +103 -102
- data/processor/list.rb +123 -0
- data/processor/load_cmds.rb +9 -1
- data/processor/location.rb +193 -188
- data/processor/mock.rb +1 -7
- data/processor/msg.rb +56 -42
- data/processor/running.rb +26 -15
- data/processor/stepping.rb +2 -1
- data/processor/subcmd.rb +18 -43
- data/processor/validate.rb +41 -30
- data/processor/virtual.rb +33 -0
- data/rbx-trepanning.gemspec +7 -8
- data/sample/rocky-trepanx-colors.rb +0 -1
- data/test/data/fname-with-blank.right +2 -0
- data/test/data/inline-call.right +11 -10
- data/test/data/quit.right +1 -0
- data/test/example/debugger-stop.rb +1 -1
- data/test/example/goto2goto.rb +11 -0
- data/test/functional/fn_helper.rb +2 -2
- data/test/functional/test-list.rb +7 -6
- data/test/integration/helper.rb +5 -5
- data/test/unit/cmd-helper.rb +2 -6
- data/test/unit/test-app-cmd_parser.rb +3 -2
- data/test/unit/test-app-display.rb +22 -0
- data/test/unit/test-app-options.rb +14 -10
- data/test/unit/test-app-run.rb +0 -2
- data/test/unit/test-app-util.rb +21 -4
- data/test/unit/test-base-cmd.rb +5 -7
- data/test/unit/test-base-subcmd.rb +1 -5
- data/test/unit/test-base-submgr.rb +1 -1
- data/test/unit/test-base-subsubcmd.rb +0 -4
- data/test/unit/test-bin-trepanx.rb +2 -2
- data/test/unit/test-cmd-break.rb +2 -0
- data/test/unit/test-cmd-edit.rb +34 -0
- data/test/unit/test-cmd-kill.rb +11 -4
- data/test/unit/test-cmd-parse_list_cmd.rb +36 -0
- data/test/unit/test-command.rb +45 -0
- data/test/unit/test-completion.rb +1 -1
- data/test/unit/test-proc-eval.rb +1 -2
- data/test/unit/test-proc-frame.rb +5 -3
- data/test/unit/test-proc-list.rb +55 -0
- data/test/unit/test-proc-load_cmds.rb +4 -3
- data/test/unit/test-proc-location.rb +32 -29
- data/test/unit/test-proc-main.rb +1 -5
- data/test/unit/test-proc-validate.rb +14 -4
- data/test/unit/test-subcmd-help.rb +1 -5
- metadata +73 -107
data/processor/command/macro.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
3
3
|
require 'rubygems'; require 'require_relative'
|
4
|
-
require_relative '
|
4
|
+
require_relative '../command'
|
5
5
|
require_relative '../eval'
|
6
6
|
class Trepan::Command::MacroCommand < Trepan::Command
|
7
7
|
|
@@ -11,26 +11,44 @@ class Trepan::Command::MacroCommand < Trepan::Command
|
|
11
11
|
#{NAME} MACRO-NAME PROC-OBJECT
|
12
12
|
|
13
13
|
Define MACRO-NAME as a debugger macro. Debugger macros get a list of
|
14
|
-
arguments.
|
14
|
+
arguments. Debugger macros get a list of arguments which you supply
|
15
|
+
without parenthesis or commas. See below for an example.
|
15
16
|
|
16
|
-
The macro should return either a String or an
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
The macro (really a Ruby Proc) should return either a String or an
|
18
|
+
Array of Strings. The string in both cases are strings of debugger
|
19
|
+
commands. If the return is a String, that gets tokenized by a simple
|
20
|
+
String#split . Note that macro processing is done right after
|
21
|
+
splitting on ;; so if the macro returns a string containing ;; this
|
22
|
+
will not be handled on the string returned.
|
21
23
|
|
22
24
|
If instead, Array of Strings is returned, then the first string is
|
23
|
-
|
25
|
+
shifted from the array and executed. The remaining strings are pushed
|
24
26
|
onto the command queue. In contrast to the first string, subsequent
|
25
27
|
strings can contain other macros, and ;; in those strings will be
|
26
28
|
split into separate commands.
|
27
29
|
|
28
|
-
Here is an example. The below creates a macro called
|
30
|
+
Here is an example. The below creates a macro called fin+ which
|
29
31
|
issues two commands 'finish' followed by 'step':
|
30
32
|
|
31
33
|
macro fin+ Proc.new{|*args| %w(finish step)}
|
32
34
|
|
33
|
-
|
35
|
+
If you wanted to parameterize the argument of the 'finish' command
|
36
|
+
you could do that this way:
|
37
|
+
|
38
|
+
macro fin+ Proc.new{|*args| ['finish \#{args[0]}' 'step']}
|
39
|
+
|
40
|
+
Invoking with
|
41
|
+
fin+ 3
|
42
|
+
|
43
|
+
would expand to ["finish 3", "step"]
|
44
|
+
|
45
|
+
If you were to add another parameter for 'step', the note that the
|
46
|
+
invocation might be
|
47
|
+
fin+ 3 2
|
48
|
+
|
49
|
+
rather than 'fin+(3,2)' or 'fin+ 3, 2'.
|
50
|
+
|
51
|
+
See also 'info macro'.
|
34
52
|
HELP
|
35
53
|
|
36
54
|
CATEGORY = 'support'
|
data/processor/command/next.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'rubygems'; require 'require_relative'
|
2
|
-
require_relative '
|
2
|
+
require_relative '../command'
|
3
3
|
require_relative '../stepping'
|
4
4
|
require_relative '../../app/breakpoint'
|
5
5
|
|
@@ -42,6 +42,7 @@ See also 'step' and 'nexti'.
|
|
42
42
|
end
|
43
43
|
|
44
44
|
@proc.step('next', step_count)
|
45
|
+
# @proc.next(step_count)
|
45
46
|
end
|
46
47
|
|
47
48
|
end
|
data/processor/command/nexti.rb
CHANGED
@@ -0,0 +1,51 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# Copyright (C) 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
3
|
+
require 'rubygems'; require 'require_relative'
|
4
|
+
require 'pp'
|
5
|
+
require_relative '../command'
|
6
|
+
require_relative '../../app/cmd_parse'
|
7
|
+
class Trepan::Command::ParseTreeCommand < Trepan::Command
|
8
|
+
|
9
|
+
unless defined?(HELP)
|
10
|
+
NAME = File.basename(__FILE__, '.rb')
|
11
|
+
HELP = <<-HELP
|
12
|
+
#{NAME} [FILE]
|
13
|
+
#{NAME}
|
14
|
+
|
15
|
+
In the first form, print a ParseTree S-expression of the current file
|
16
|
+
or FILE.
|
17
|
+
HELP
|
18
|
+
|
19
|
+
# ALIASES = %w(p)
|
20
|
+
MAX_ARGS = 1
|
21
|
+
CATEGORY = 'data'
|
22
|
+
SHORT_HELP = 'PrettyPrint a ParseTree S-expression for a file'
|
23
|
+
end
|
24
|
+
|
25
|
+
def run(args)
|
26
|
+
meth = nil
|
27
|
+
case args.size
|
28
|
+
when 1
|
29
|
+
file = @proc.frame.file
|
30
|
+
when 2
|
31
|
+
file = args[1]
|
32
|
+
else
|
33
|
+
errmsg 'Expecting a file name'
|
34
|
+
end
|
35
|
+
expanded_file = @proc.canonic_file(file)
|
36
|
+
if File.readable?(expanded_file)
|
37
|
+
section "ParseTree for file: #{expanded_file}"
|
38
|
+
msg File.to_sexp(expanded_file).pretty_inspect
|
39
|
+
else
|
40
|
+
errmsg "File #{expanded_file} is not readable."
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
if __FILE__ == $0
|
45
|
+
require 'pp'
|
46
|
+
require_relative '../mock'
|
47
|
+
dbgr, cmd = MockDebugger::setup
|
48
|
+
cmd.run([cmd.name, __FILE__])
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
data/processor/command/pr.rb
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
3
3
|
require 'rubygems'; require 'require_relative'
|
4
|
-
require_relative '
|
5
|
-
require_relative '../eval'
|
4
|
+
require_relative '../command'
|
6
5
|
class Trepan::Command::PrCommand < Trepan::Command
|
7
6
|
|
8
7
|
unless defined?(HELP)
|
data/processor/command/ps.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
3
3
|
require 'rubygems'; require 'require_relative'
|
4
|
-
require_relative '
|
4
|
+
require_relative '../command'
|
5
5
|
require_relative '../eval'
|
6
6
|
class Trepan::Command::PsCommand < Trepan::Command
|
7
7
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
-
# Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
|
2
|
+
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
3
3
|
require 'rubygems'; require 'require_relative'
|
4
|
-
require_relative '
|
4
|
+
require_relative '../command'
|
5
5
|
require_relative '../../app/run'
|
6
6
|
class Trepan::Command::RestartCommand < Trepan::Command
|
7
7
|
|
data/processor/command/save.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
3
3
|
require 'rubygems'; require 'require_relative'
|
4
|
-
require_relative '
|
4
|
+
require_relative '../command'
|
5
5
|
class Trepan::Command::SaveCommand < Trepan::Command
|
6
6
|
|
7
7
|
unless defined?(HELP)
|
data/processor/command/server.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
# Copyright (C) 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
3
3
|
require 'optparse'
|
4
4
|
require 'rubygems'; require 'require_relative'
|
5
|
-
require_relative '
|
5
|
+
require_relative '../command'
|
6
6
|
require_relative '../../app/default'
|
7
7
|
require_relative '../../interface/server' # server interface (remote debugging)
|
8
8
|
class Trepan::Command::ServerCommand < Trepan::Command
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
3
|
+
require 'rubygems'; require 'require_relative'
|
4
|
+
require_relative '../base/subcmd'
|
5
|
+
|
6
|
+
class Trepan::Subcommand::SetAbbrev < Trepan::SetBoolSubcommand
|
7
|
+
unless defined?(HELP)
|
8
|
+
HELP = "Set to allow unique abbreviations of commands"
|
9
|
+
IN_LIST = true
|
10
|
+
MIN_ABBREV = 'ab'.size
|
11
|
+
Trepanning::Subcommand.set_name_prefix(__FILE__, self)
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
|
16
|
+
if __FILE__ == $0
|
17
|
+
# Demo it.
|
18
|
+
$0 = __FILE__ + 'notagain' # So we don't run this again
|
19
|
+
require_relative '../../mock'
|
20
|
+
cmd = MockDebugger::sub_setup(Trepan::Subcommand::SetAbbrev, false)
|
21
|
+
cmd.run(cmd.prefix + ['off'])
|
22
|
+
cmd.run(cmd.prefix + ['ofn'])
|
23
|
+
cmd.run(cmd.prefix)
|
24
|
+
puts cmd.save_command
|
25
|
+
end
|
@@ -6,8 +6,14 @@ require_relative '../base/subsubmgr'
|
|
6
6
|
|
7
7
|
class Trepan::SubSubcommand::SetAuto < Trepan::SubSubcommandMgr
|
8
8
|
unless defined?(HELP)
|
9
|
-
HELP = 'Set controls for things with some sort of "automatic" default behavior'
|
10
9
|
Trepanning::Subcommand.set_name_prefix(__FILE__, self)
|
10
|
+
HELP = <<-EOH
|
11
|
+
Set controls for things with some sort of "automatic" default behavior.
|
12
|
+
|
13
|
+
See "#{PREFIX.join(' ')} *" for a list of subcommands or "#{PREFIX.join(' ')} <name>"
|
14
|
+
for help on a particular trace subcommand.
|
15
|
+
EOH
|
16
|
+
SHORT_HELP = 'Set controls for some "automatic" default behaviors';
|
11
17
|
end
|
12
18
|
end
|
13
19
|
|
@@ -5,6 +5,7 @@ require_relative '../../base/subsubcmd'
|
|
5
5
|
|
6
6
|
class Trepan::SubSubcommand::SetAutoEval < Trepan::SetBoolSubSubcommand
|
7
7
|
unless defined?(HELP)
|
8
|
+
Trepanning::Subcommand.set_name_prefix(__FILE__, self)
|
8
9
|
HELP = "Evaluate unrecognized debugger commands.
|
9
10
|
|
10
11
|
Often inside the debugger, one would like to be able to run arbitrary
|
@@ -36,8 +37,6 @@ problem. Another possibility is to go into a real Ruby shell via the
|
|
36
37
|
'irb' command.
|
37
38
|
"
|
38
39
|
MIN_ABBREV = 'ev'.size
|
39
|
-
NAME = File.basename(__FILE__, '.rb')
|
40
|
-
PREFIX = %W(set auto #{NAME})
|
41
40
|
SHORT_HELP = "Set evaluation of unrecognized debugger commands"
|
42
41
|
end
|
43
42
|
|
@@ -1,14 +1,13 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
-
# Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
|
2
|
+
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
3
3
|
require 'rubygems'; require 'require_relative'
|
4
4
|
require_relative '../../base/subsubcmd'
|
5
5
|
|
6
6
|
class Trepan::Subcommand::SetAutoIrb < Trepan::SetBoolSubSubcommand
|
7
7
|
unless defined?(HELP)
|
8
|
+
Trepanning::Subcommand.set_name_prefix(__FILE__, self)
|
8
9
|
HELP = "Set to automatically go into irb each time we enter the debugger"
|
9
10
|
MIN_ABBREV = 'ir'.size
|
10
|
-
NAME = File.basename(__FILE__, '.rb')
|
11
|
-
PREFIX = %w(set auto irb)
|
12
11
|
end
|
13
12
|
|
14
13
|
def run(args)
|
@@ -1,14 +1,13 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
-
# Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
|
2
|
+
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
3
3
|
require 'rubygems'; require 'require_relative'
|
4
4
|
require_relative '../../base/subsubcmd'
|
5
5
|
|
6
6
|
class Trepan::Subcommand::SetAutoList < Trepan::SetBoolSubSubcommand
|
7
7
|
unless defined?(HELP)
|
8
|
+
Trepanning::Subcommand.set_name_prefix(__FILE__, self)
|
8
9
|
HELP = "Set to run a 'list' command each time we enter the debugger"
|
9
10
|
MIN_ABBREV = 'l'.size
|
10
|
-
NAME = File.basename(__FILE__, '.rb')
|
11
|
-
PREFIX = %w(set auto list)
|
12
11
|
SHORT_HELP = "Set running a 'list' command each time we enter the debugger"
|
13
12
|
end
|
14
13
|
|
@@ -9,7 +9,7 @@ class Trepan::Subcommand::SetDifferent < Trepan::SetBoolSubcommand
|
|
9
9
|
HELP = <<-EOH
|
10
10
|
#{PREFIX.join(' ')} [on|off|nostack]
|
11
11
|
|
12
|
-
Set to make sure 'next
|
12
|
+
Set to make sure 'next' or 'step' moves to a new position.
|
13
13
|
|
14
14
|
Due to the interpretive, expression-oriented nature of the Ruby
|
15
15
|
Language and implementation, each line often may contain many possible
|
@@ -8,11 +8,17 @@ class Trepan::Subcommand::SetHighlight < Trepan::SetBoolSubcommand
|
|
8
8
|
Trepanning::Subcommand.set_name_prefix(__FILE__, self)
|
9
9
|
HELP = 'Set whether we use terminal highlighting'
|
10
10
|
IN_LIST = true
|
11
|
-
MIN_ABBREV = '
|
11
|
+
MIN_ABBREV = 'hi'.size
|
12
12
|
end
|
13
|
+
|
14
|
+
def complete(prefix)
|
15
|
+
Trepan::Complete.complete_token(%w(on off reset), prefix)
|
16
|
+
end
|
17
|
+
|
13
18
|
def run(args)
|
14
19
|
if args.size == 3 && 'reset' == args[2]
|
15
20
|
LineCache::clear_file_format_cache
|
21
|
+
@proc.settings[:highlight] = :term
|
16
22
|
else
|
17
23
|
super
|
18
24
|
@proc.settings[:highlight] = :term if @proc.settings[:highlight]
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# Copyright (C) 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
3
|
+
require 'rubygems'; require 'require_relative'
|
4
|
+
require_relative '../base/subcmd'
|
5
|
+
|
6
|
+
class Trepan::Subcommand::SetReload < Trepan::SetBoolSubcommand
|
7
|
+
unless defined?(HELP)
|
8
|
+
Trepanning::Subcommand.set_name_prefix(__FILE__, self)
|
9
|
+
SHORT_HELP = "Set whether to reread source text when it changes."
|
10
|
+
IN_LIST = true
|
11
|
+
MIN_ABBREV = 're'.size
|
12
|
+
HELP = <<-EOH
|
13
|
+
#{CMD} {on|off}
|
14
|
+
|
15
|
+
Source text is cached on the first read. This ensures that if you
|
16
|
+
change the source text after the debugged program is runnning you will
|
17
|
+
still see the source code as pertains to the running program rather
|
18
|
+
than what is in the filesystem.
|
19
|
+
|
20
|
+
However sometimes this may not be what you want. In particular in running
|
21
|
+
Ruby on Rails in development, Rails will also detect file changes and
|
22
|
+
will reload the source code. So here the debugger will be out of sync.
|
23
|
+
|
24
|
+
Set this to true, and the debugger will notice such changes and reread
|
25
|
+
the source text when it discovers it has changed.
|
26
|
+
|
27
|
+
See also "info source" and "info files" and note the SHA1
|
28
|
+
and file modification time.
|
29
|
+
EOH
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
if __FILE__ == $0
|
34
|
+
# Demo it.
|
35
|
+
$0 = __FILE__ + 'notagain' # So we don't run this agin
|
36
|
+
require_relative '../../mock'
|
37
|
+
cmd = MockDebugger::sub_setup(Trepan::Subcommand::SetReload, false)
|
38
|
+
cmd.run(cmd.prefix + ['off'])
|
39
|
+
cmd.run(cmd.prefix + ['ofn'])
|
40
|
+
cmd.run(cmd.prefix)
|
41
|
+
puts cmd.save_command
|
42
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
3
|
+
require 'rubygems'; require 'require_relative'
|
4
|
+
require_relative '../base/subsubcmd'
|
5
|
+
|
6
|
+
class Trepan::Subcommand::SetTimer < Trepan::SetBoolSubcommand
|
7
|
+
unless defined?(HELP)
|
8
|
+
Trepanning::Subcommand.set_name_prefix(__FILE__, self)
|
9
|
+
HELP = <<-EOH
|
10
|
+
#{PREFIX.join(' ')} [on|off]
|
11
|
+
|
12
|
+
Tracks and shows elapsed time between debugger events.
|
13
|
+
|
14
|
+
Since debugger overhead can be large depending on what you are doing,
|
15
|
+
there are many ways to customize the debugger to take less time (and
|
16
|
+
do less).
|
17
|
+
|
18
|
+
Stepping is slow, running to a breakpoint without stepping is
|
19
|
+
relatively fast compared to previous versions of the debugger and
|
20
|
+
compared to stepping.
|
21
|
+
|
22
|
+
Stopping at fewer events can also speed things up. Trace event
|
23
|
+
buffering slows things down.
|
24
|
+
|
25
|
+
Buy turning this setting on, you may be able to get a feel for what
|
26
|
+
how expensive the various settings.
|
27
|
+
|
28
|
+
See also: 'set events', 'set trace buffer', 'step', and 'break'.
|
29
|
+
EOH
|
30
|
+
|
31
|
+
MIN_ABBREV = 'ti'.size
|
32
|
+
SHORT_HELP = "Set to show elapsed time between debugger events"
|
33
|
+
end
|
34
|
+
|
35
|
+
def run(args)
|
36
|
+
super
|
37
|
+
if @proc.settings[:timer]
|
38
|
+
@proc.cmdloop_posthooks.insert_if_new(-1, 'timer', @proc.timer_hook[1])
|
39
|
+
@proc.cmdloop_prehooks.insert_if_new(-1, 'timer', @proc.timer_hook[1])
|
40
|
+
else
|
41
|
+
@proc.cmdloop_posthooks.delete_by_name('timer')
|
42
|
+
@proc.cmdloop_prehooks.delete_by_name('timer')
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
if __FILE__ == $0
|
49
|
+
# Demo it.
|
50
|
+
require_relative '../../mock'
|
51
|
+
require_relative '../../hook'
|
52
|
+
|
53
|
+
cmd = MockDebugger::sub_setup(Trepan::Subcommand::SetTimer)
|
54
|
+
cmd.run(cmd.prefix)
|
55
|
+
%w(off on).each do |arg|
|
56
|
+
cmd.run(cmd.prefix + [arg])
|
57
|
+
end
|
58
|
+
end
|
@@ -7,14 +7,15 @@ require_relative '../base/subsubmgr'
|
|
7
7
|
class Trepan::SubSubcommand::SetTrace < Trepan::SubSubcommandMgr
|
8
8
|
unless defined?(HELP)
|
9
9
|
Trepanning::Subcommand.set_name_prefix(__FILE__, self)
|
10
|
-
HELP =
|
10
|
+
HELP = <<-EOH
|
11
|
+
Set tracing of various sorts.
|
11
12
|
|
12
13
|
The types of tracing include global variables, events from the trace
|
13
14
|
buffer, or printing those events.
|
14
15
|
|
15
16
|
See 'help #{PREFIX.join(' ')} *' for a list of subcommands or 'help set trace
|
16
|
-
<name>' for help on a particular trace subcommand.
|
17
|
-
|
17
|
+
<name>' for help on a particular trace subcommand.
|
18
|
+
EOH
|
18
19
|
IN_LIST = true
|
19
20
|
MIN_ABBREV = 'tr'.size
|
20
21
|
SHORT_HELP = 'Set tracing of various sorts.'
|
@@ -1,17 +1,19 @@
|
|
1
|
-
# Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
|
1
|
+
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
2
2
|
require 'irb'
|
3
3
|
require 'rubygems'; require 'require_relative'
|
4
|
-
require_relative '
|
5
|
-
require_relative '../../app/irb'
|
4
|
+
require_relative '../command'
|
6
5
|
class Trepan::Command::IRBCommand < Trepan::Command
|
7
6
|
|
8
7
|
unless defined?(HELP)
|
8
|
+
require_relative '../../app/irb'
|
9
9
|
NAME = File.basename(__FILE__, '.rb')
|
10
|
-
HELP = <<-HELP
|
11
|
-
#{NAME} [-d]
|
10
|
+
HELP = <<-HELP
|
11
|
+
#{NAME} [-d]
|
12
|
+
|
13
|
+
starts an Interactive Ruby (IRB) session.
|
12
14
|
|
13
15
|
If -d is added you can get access to debugger frame the global variables
|
14
|
-
$
|
16
|
+
$trepan_frame and $trepan_cmdproc.
|
15
17
|
|
16
18
|
#{NAME} is extended with methods 'cont', 'ne', and, 'q', 'step' which
|
17
19
|
run the corresponding debugger commands 'continue', 'next', 'exit' and 'step'.
|
@@ -33,9 +35,10 @@ Here then is a loop to query VM stack values:
|
|
33
35
|
(-1..1).each {|i| dbgr(\"info reg sp \#{i}\")}
|
34
36
|
HELP
|
35
37
|
|
36
|
-
|
37
|
-
|
38
|
-
|
38
|
+
ALIASES = %w(irb)
|
39
|
+
CATEGORY = 'support'
|
40
|
+
MAX_ARGS = 1 # Need at most this many
|
41
|
+
SHORT_HELP = "Run #{NAME} as a command subshell"
|
39
42
|
end
|
40
43
|
|
41
44
|
# This method runs the command
|
@@ -53,17 +56,17 @@ Here then is a loop to query VM stack values:
|
|
53
56
|
# end
|
54
57
|
|
55
58
|
save_trap = trap('SIGINT') do
|
56
|
-
throw :IRB_EXIT, :cont if $
|
59
|
+
throw :IRB_EXIT, :cont if $trepan_in_irb
|
57
60
|
end
|
58
61
|
|
59
|
-
$
|
62
|
+
$trepan = @proc.dbgr
|
60
63
|
if add_debugging
|
61
|
-
$
|
62
|
-
$
|
64
|
+
$trepan_cmdproc = @proc
|
65
|
+
$trepan_frame = @proc.frame
|
63
66
|
end
|
64
|
-
$
|
65
|
-
$
|
66
|
-
$
|
67
|
+
$trepan_in_irb = true
|
68
|
+
$trepan_irb_statements = nil
|
69
|
+
$trepan_command = nil
|
67
70
|
|
68
71
|
conf = {:BACK_TRACE_LIMIT => settings[:maxstack],
|
69
72
|
:RC => true}
|
@@ -105,16 +108,16 @@ Here then is a loop to query VM stack values:
|
|
105
108
|
when :finish
|
106
109
|
@proc.finish
|
107
110
|
when :next
|
108
|
-
@proc.next
|
111
|
+
@proc.step ('next', 1, {})
|
109
112
|
when :quit
|
110
113
|
@proc.quit
|
111
114
|
when :step
|
112
|
-
@proc.step
|
115
|
+
@proc.step ('step', 1, {})
|
113
116
|
else
|
114
117
|
@proc.print_location
|
115
118
|
end
|
116
119
|
ensure
|
117
|
-
$
|
120
|
+
$trepan_in_irb = false
|
118
121
|
# restore old trap if any
|
119
122
|
trap('SIGINT', save_trap) if save_trap
|
120
123
|
end
|