rb8-trepanning 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +10 -0
- data/ChangeLog +276 -0
- data/Makefile +13 -0
- data/Rakefile +1 -2
- data/app/display.rb +41 -1
- data/app/irb.rb +55 -49
- data/app/options.rb +3 -2
- data/app/run.rb +25 -7
- data/app/util.rb +19 -1
- data/bin/trepan8 +0 -2
- data/data/perldb.bindings +17 -0
- data/interface/script.rb +1 -1
- data/interface/server.rb +1 -1
- data/interface/user.rb +3 -1
- data/{interface/base_intf.rb → interface.rb} +1 -1
- data/io/input.rb +1 -1
- data/io/null_output.rb +1 -1
- data/io/string_array.rb +2 -2
- data/io/tcpclient.rb +1 -1
- data/io/tcpserver.rb +1 -1
- data/{io/base_io.rb → io.rb} +0 -0
- data/lib/debugger.rb +0 -1
- data/lib/trepanning.rb +3 -1
- data/processor/command/alias.rb +13 -2
- data/processor/command/backtrace.rb +2 -1
- data/processor/command/base/subcmd.rb +1 -5
- data/processor/command/base/submgr.rb +1 -1
- data/processor/command/base/subsubcmd.rb +1 -1
- data/processor/command/base/subsubmgr.rb +4 -4
- data/processor/command/break.rb +19 -11
- data/processor/command/catch.rb +1 -1
- data/processor/command/complete.rb +1 -1
- data/processor/command/continue.rb +7 -1
- data/processor/command/directory.rb +2 -2
- data/processor/command/disable.rb +13 -14
- data/processor/command/display.rb +3 -1
- data/processor/command/down.rb +8 -8
- data/processor/command/edit.rb +1 -1
- data/processor/command/enable.rb +21 -22
- data/processor/command/eval.rb +1 -2
- data/processor/command/exit.rb +25 -8
- data/processor/command/finish.rb +7 -2
- data/processor/command/frame.rb +1 -1
- data/processor/command/help.rb +3 -4
- data/processor/command/info.rb +2 -0
- data/processor/command/info_subcmd/files.rb +2 -2
- data/processor/command/info_subcmd/locals.rb +6 -53
- data/processor/command/info_subcmd/source.rb +10 -4
- data/processor/command/info_subcmd/variables.rb +35 -0
- data/processor/command/info_subcmd/variables_subcmd/.gitignore +1 -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/{globals.rb → variables_subcmd/globals.rb} +22 -17
- 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 -7
- data/processor/command/list.rb +2 -2
- data/processor/command/macro.rb +27 -9
- data/processor/command/next.rb +1 -1
- data/processor/command/parsetree.rb +1 -1
- data/processor/command/pp.rb +1 -1
- data/processor/command/pr.rb +1 -1
- data/processor/command/ps.rb +1 -1
- data/processor/command/restart.rb +1 -1
- data/processor/command/save.rb +1 -1
- data/processor/command/set_subcmd/auto.rb +7 -1
- data/processor/command/set_subcmd/different.rb +1 -1
- data/processor/command/set_subcmd/trace.rb +5 -4
- data/processor/command/set_subcmd/trace_subcmd/print.rb +4 -3
- data/processor/command/shell.rb +5 -4
- data/processor/command/show_subcmd/{alias.rb → aliases.rb} +2 -2
- data/processor/command/source.rb +1 -1
- data/processor/command/step.rb +2 -5
- data/processor/command/tbreak.rb +1 -1
- data/processor/command/unalias.rb +13 -8
- data/processor/command/undisplay.rb +13 -9
- data/processor/command/up.rb +12 -14
- data/processor/command.rb +138 -230
- data/processor/display.rb +46 -10
- data/processor/help.rb +5 -3
- data/processor/hook.rb +2 -2
- data/processor/location.rb +25 -0
- data/processor/mock.rb +3 -2
- data/processor/msg.rb +55 -42
- data/processor/old-command.rb +270 -0
- data/processor/{processor.rb → old-processor.rb} +7 -8
- data/processor/running.rb +7 -12
- data/processor/subcmd.rb +15 -41
- data/processor/validate.rb +240 -238
- data/{processor/main.rb → processor.rb} +20 -42
- data/test/data/trace.cmd +6 -0
- data/test/data/trace.right +46 -0
- data/test/integration/helper.rb +2 -0
- data/test/integration/test-trace.rb +29 -0
- data/test/unit/cmd-helper.rb +2 -3
- data/test/unit/test-app-options.rb +13 -11
- data/test/unit/test-app-run.rb +7 -1
- data/test/unit/test-base-cmd.rb +1 -1
- data/test/unit/test-cmd-kill.rb +11 -4
- data/test/unit/test-io-tcpserver.rb +9 -4
- data/test/unit/test-proc-eval.rb +1 -2
- data/test/unit/test-proc-location.rb +26 -32
- data/test/unit/test-subcmd-help.rb +1 -1
- data/trepan8.gemspec +9 -1
- metadata +60 -17
- data/processor/command/base/cmd.rb +0 -177
data/interface/script.rb
CHANGED
data/interface/server.rb
CHANGED
data/interface/user.rb
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
# Our local modules
|
7
7
|
|
8
8
|
require 'rubygems'; require 'require_relative'
|
9
|
-
require_relative '
|
9
|
+
require_relative '../interface'
|
10
10
|
require_relative '../io/input'
|
11
11
|
|
12
12
|
# Interface when communicating with the user.
|
@@ -162,4 +162,6 @@ if __FILE__ == $0
|
|
162
162
|
end
|
163
163
|
end
|
164
164
|
puts "User interface closed?: #{intf.closed?}"
|
165
|
+
intf.close
|
166
|
+
STDERR.puts "User interface closed?: #{intf.closed?}"
|
165
167
|
end
|
@@ -16,7 +16,7 @@ module Trepan
|
|
16
16
|
# - another interface in another process or computer
|
17
17
|
class Interface
|
18
18
|
|
19
|
-
attr_accessor :
|
19
|
+
attr_accessor :history_io, :history_save, :interactive, :input, :output
|
20
20
|
|
21
21
|
unless defined?(YES)
|
22
22
|
YES = %w(y yes oui si yep ja)
|
data/io/input.rb
CHANGED
data/io/null_output.rb
CHANGED
data/io/string_array.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
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
|
|
4
4
|
# Simulate I/O using lists of strings.
|
5
5
|
|
6
6
|
require 'rubygems'; require 'require_relative'
|
7
|
-
require_relative '
|
7
|
+
require_relative '../io'
|
8
8
|
|
9
9
|
# Simulate I/O using an array of strings. Sort of like StringIO, but
|
10
10
|
# even simplier.
|
data/io/tcpclient.rb
CHANGED
data/io/tcpserver.rb
CHANGED
data/{io/base_io.rb → io.rb}
RENAMED
File without changes
|
data/lib/debugger.rb
CHANGED
data/lib/trepanning.rb
CHANGED
@@ -7,7 +7,8 @@ require 'ruby-debug-base'
|
|
7
7
|
require 'require_relative'
|
8
8
|
require_relative '../interface/script'
|
9
9
|
require_relative '../interface/user'
|
10
|
-
require_relative '../processor/processor'
|
10
|
+
require_relative '../processor/old-processor'
|
11
|
+
require_relative '../processor'
|
11
12
|
|
12
13
|
module Trepan
|
13
14
|
|
@@ -58,6 +59,7 @@ module Trepan
|
|
58
59
|
@@intf = [Trepan::UserInterface.new(nil, nil, opts)]
|
59
60
|
|
60
61
|
attr_accessor :handler
|
62
|
+
|
61
63
|
Trepan.handler = Debugger.handler = CommandProcessor.new(@@intf)
|
62
64
|
|
63
65
|
# gdb-style annotation mode. Used in GNU Emacs interface
|
data/processor/command/alias.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
2
2
|
require 'rubygems'; require 'require_relative'
|
3
|
-
require_relative '
|
3
|
+
require_relative '../command'
|
4
4
|
|
5
5
|
class Trepan::Command::AliasCommand < Trepan::Command
|
6
6
|
|
@@ -9,7 +9,18 @@ class Trepan::Command::AliasCommand < Trepan::Command
|
|
9
9
|
HELP = <<-HELP
|
10
10
|
#{NAME} ALIAS COMMAND
|
11
11
|
|
12
|
-
Add
|
12
|
+
Add alias ALIAS for a debugger command COMMAND.
|
13
|
+
|
14
|
+
Add an alias when you want to use a command abbreviation for a command
|
15
|
+
that would otherwise be ambigous. For example, by default we make 's'
|
16
|
+
be an alias of 'step' to force it to be used. Without the alias, "s"
|
17
|
+
might be "step", "show", or "set" among others
|
18
|
+
|
19
|
+
Example:
|
20
|
+
|
21
|
+
alias cat list # "cat rubyfile.rb" is the same as "list rubyfile.rb"
|
22
|
+
alias s step # "s" is now an alias for "step".
|
23
|
+
# The above examples done by default.
|
13
24
|
|
14
25
|
See also 'unalias' and 'show #{NAME}'.
|
15
26
|
HELP
|
@@ -10,7 +10,7 @@
|
|
10
10
|
# functions for command from module cmdfns.
|
11
11
|
|
12
12
|
require 'rubygems'; require 'require_relative'
|
13
|
-
require_relative '
|
13
|
+
require_relative '../../command'
|
14
14
|
|
15
15
|
module Trepan
|
16
16
|
|
@@ -131,10 +131,6 @@ module Trepan
|
|
131
131
|
["#{subcmd_prefix_string} #{settings[subcmd_setting_key]}"]
|
132
132
|
end
|
133
133
|
|
134
|
-
def settings
|
135
|
-
@proc.settings
|
136
|
-
end
|
137
|
-
|
138
134
|
def subcmd_prefix_string
|
139
135
|
self.class.const_get(:PREFIX).join(' ')
|
140
136
|
end
|
@@ -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 '../../subcmd'
|
6
6
|
require_relative '../../help'
|
7
7
|
require_relative '../../../app/complete'
|
@@ -163,19 +163,19 @@ class Trepan::SubSubcommandMgr < Trepan::Subcommand
|
|
163
163
|
|
164
164
|
def run(args)
|
165
165
|
args = @parent.last_args if args.size == 0
|
166
|
-
if args.size < 3 || args.size == 3 && args[
|
166
|
+
if args.size < 3 || args.size == 3 && args[2] == '*'
|
167
167
|
summary_list(obj_const(self, :NAME), @subcmds)
|
168
168
|
return false
|
169
169
|
end
|
170
170
|
|
171
|
-
subcmd_prefix =
|
171
|
+
subcmd_prefix = obj_const(self, :PREFIX).join('')
|
172
172
|
# We were given: cmd subcmd ...
|
173
173
|
# Run that.
|
174
|
-
subcmd = @subcmds.lookup(subcmd_prefix)
|
174
|
+
subcmd = @subcmds.lookup(subcmd_prefix + args[2])
|
175
175
|
if subcmd
|
176
176
|
subcmd.run(args[2..-1])
|
177
177
|
else
|
178
|
-
undefined_subcmd(obj_const(self, :PREFIX).join(' '), args[
|
178
|
+
undefined_subcmd(obj_const(self, :PREFIX).join(' '), args[2])
|
179
179
|
end
|
180
180
|
end
|
181
181
|
|
data/processor/command/break.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
2
2
|
require 'rubygems'; require 'require_relative'
|
3
|
-
require_relative '
|
3
|
+
require_relative '../command'
|
4
4
|
|
5
5
|
class Trepan::Command::BreakCommand < Trepan::Command
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
6
|
+
Trepan::Util::suppress_warnings {
|
7
|
+
ALIASES = %w(b)
|
8
|
+
CATEGORY = 'breakpoints'
|
9
|
+
NAME = File.basename(__FILE__, '.rb')
|
10
|
+
HELP = <<-HELP
|
11
11
|
#{NAME} LOCATION [ {if|unless} CONDITION ]
|
12
12
|
|
13
13
|
Set a breakpoint. In the second form where CONDITIOn is given, the
|
@@ -25,7 +25,8 @@ Examples:
|
|
25
25
|
|
26
26
|
See also condition, continue and "help location".
|
27
27
|
HELP
|
28
|
-
|
28
|
+
SHORT_HELP = 'Set a breakpoint at a point in a method'
|
29
|
+
}
|
29
30
|
|
30
31
|
# This method runs the command
|
31
32
|
def run(args, temp=false)
|
@@ -53,10 +54,17 @@ See also condition, continue and "help location".
|
|
53
54
|
@proc.canonic_file(file)])
|
54
55
|
return
|
55
56
|
end
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
57
|
+
syntax_errors = Trepan::ruby_syntax_errors(file)
|
58
|
+
if syntax_errors
|
59
|
+
msg ["File #{file} is not a syntactically correct Ruby program.",
|
60
|
+
"Therefore we can't check line numbers."]
|
61
|
+
return unless confirm('Set breakpoint anyway?', false)
|
62
|
+
else
|
63
|
+
unless LineCache.trace_line_numbers(file).member?(line)
|
64
|
+
errmsg('Line %d is not a stopping point in file "%s".' %
|
65
|
+
[line, @proc.canonic_file(file)])
|
66
|
+
return
|
67
|
+
end
|
60
68
|
end
|
61
69
|
else
|
62
70
|
errmsg('No source file named %s' % @proc.canonic_file(file))
|
data/processor/command/catch.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
2
2
|
require 'rubygems'; require 'require_relative'
|
3
|
-
require_relative '
|
3
|
+
require_relative '../command'
|
4
4
|
require_relative '../stepping'
|
5
5
|
|
6
6
|
class Trepan::Command::ContinueCommand < Trepan::Command
|
@@ -38,6 +38,12 @@ See also 'step', 'next', 'finish', 'nexti' commands and "help location".
|
|
38
38
|
filename = @proc.frame.file
|
39
39
|
line_number = @proc.get_an_int(args[1])
|
40
40
|
return unless line_number
|
41
|
+
syntax_errors = Trepan::ruby_syntax_errors(filename)
|
42
|
+
if syntax_errors
|
43
|
+
msg ["File #{filename} is not a syntactically correct Ruby program.",
|
44
|
+
"Therefore we can't check line numbers."]
|
45
|
+
return unless confirm('Set breakpoint anyway?', false)
|
46
|
+
end
|
41
47
|
unless LineCache.trace_line_numbers(filename).member?(line_number)
|
42
48
|
errmsg("Line %d is not a stopping point in file \"%s\".\n" %
|
43
49
|
[line_number, filename])
|
@@ -1,6 +1,6 @@
|
|
1
|
-
# Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
|
1
|
+
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
2
2
|
require 'rubygems'; require 'require_relative'
|
3
|
-
require_relative '
|
3
|
+
require_relative '../command'
|
4
4
|
class Trepan::Command::DirectoryCommand < Trepan::Command
|
5
5
|
|
6
6
|
unless defined?(HELP)
|
@@ -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 '../breakpoint'
|
6
6
|
# require_relative '../../app/breakpoint'
|
7
7
|
|
@@ -12,21 +12,20 @@ require_relative 'base/cmd'
|
|
12
12
|
# NOTE: The enable command subclasses this, so beware when changing!
|
13
13
|
class Trepan::Command::DisableCommand < Trepan::Command
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
HELP = <<-HELP
|
20
|
-
#{NAME} bpnumber [bpnumber ...]
|
15
|
+
Trepan::Util.suppress_warnings {
|
16
|
+
NAME = File.basename(__FILE__, '.rb')
|
17
|
+
HELP = <<-HELP
|
18
|
+
#{NAME} NUM1 [NUM2 ...]
|
21
19
|
|
22
|
-
Disables the breakpoints given as a space
|
23
|
-
numbers.
|
24
|
-
HELP
|
20
|
+
Disables the breakpoints given as a space-separated list of
|
21
|
+
numbers.
|
25
22
|
|
26
|
-
|
27
|
-
|
23
|
+
See also "enable" and "info break".
|
24
|
+
HELP
|
28
25
|
|
29
|
-
|
26
|
+
CATEGORY = 'breakpoints'
|
27
|
+
SHORT_HELP = 'Disable some breakpoints'
|
28
|
+
}
|
30
29
|
|
31
30
|
def initialize(proc)
|
32
31
|
super
|
@@ -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
|
|
6
6
|
class Trepan::Command::DisplayCommand < Trepan::Command
|
7
7
|
|
@@ -23,6 +23,8 @@ case or not.
|
|
23
23
|
With no argument, evaluate and display all currently requested
|
24
24
|
auto-display expressions. Use "undisplay" to cancel display
|
25
25
|
requests previously made.
|
26
|
+
|
27
|
+
See also "undisplay", "enable", and "disable".
|
26
28
|
HELP
|
27
29
|
|
28
30
|
CATEGORY = 'data'
|
data/processor/command/down.rb
CHANGED
@@ -7,10 +7,10 @@ require_relative 'up'
|
|
7
7
|
# direction (set by DIRECTION) reversed.
|
8
8
|
class Trepan::Command::DownCommand < Trepan::Command::UpCommand
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
10
|
+
Trepan::Util.suppress_warnings {
|
11
|
+
old_verbose = $VERBOSE
|
12
|
+
$VERBOSE = nil
|
13
|
+
HELP = <<-HELP
|
14
14
|
#{NAME} [count]
|
15
15
|
|
16
16
|
Move the current frame down in the stack trace (to a newer frame). 0
|
@@ -19,10 +19,10 @@ is the most recent frame. If no count is given, move down 1.
|
|
19
19
|
See also 'up' and 'frame'.
|
20
20
|
HELP
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
22
|
+
ALIASES = %w(d)
|
23
|
+
NAME = File.basename(__FILE__, '.rb')
|
24
|
+
SHORT_HELP = 'Move frame in the direction of the caller of the last-selected frame'
|
25
|
+
}
|
26
26
|
|
27
27
|
def initialize(proc)
|
28
28
|
super
|
data/processor/command/edit.rb
CHANGED
data/processor/command/enable.rb
CHANGED
@@ -8,29 +8,24 @@ require_relative 'disable'
|
|
8
8
|
# ENABLE_PARM below).
|
9
9
|
class Trepan::Command::EnableCommand < Trepan::Command::DisableCommand
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
HELP = <<-HELP
|
16
|
-
#{NAME} BPNUM1 [BPNUM2 ...]
|
11
|
+
Trepan::Util.suppress_warnings {
|
12
|
+
NAME = File.basename(__FILE__, '.rb')
|
13
|
+
HELP = <<-HELP
|
14
|
+
#{NAME} NUM1 [NUM2 ...]
|
17
15
|
|
18
|
-
Enables breakpoints
|
19
|
-
separated list numbers.
|
16
|
+
Enables breakpoints NUM1... Breakpoints numbers are given as
|
17
|
+
a space-separated list numbers.
|
20
18
|
|
21
|
-
See also "info break"
|
19
|
+
See also "disable" and "info break".
|
22
20
|
HELP
|
21
|
+
|
22
|
+
ALIASES = %w(en)
|
23
|
+
SHORT_HELP = 'Enable some breakpoints'
|
24
|
+
}
|
23
25
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
def run(args)
|
29
|
-
if args.size == 1
|
30
|
-
errmsg('No breakpoint number given.')
|
31
|
-
return
|
32
|
-
end
|
33
|
-
enable_disable_breakpoints("Disable", args[1..-1])
|
26
|
+
def initialize(proc)
|
27
|
+
super
|
28
|
+
@enable_parm = true # true if enable
|
34
29
|
end
|
35
30
|
|
36
31
|
end
|
@@ -40,9 +35,13 @@ if __FILE__ == $0
|
|
40
35
|
dbgr, cmd = MockDebugger::setup
|
41
36
|
cmd.run([cmd.name])
|
42
37
|
cmd.run([cmd.name, '1'])
|
43
|
-
|
38
|
+
cmdproc = cmd.proc
|
39
|
+
cmds = cmdproc.commands
|
44
40
|
break_cmd = cmds['break']
|
45
41
|
puts "To be continued..."
|
46
|
-
|
47
|
-
|
42
|
+
require 'ruby-debug-base';
|
43
|
+
cmdproc.frame_setup(Debugger.current_context, nil)
|
44
|
+
cmdproc.frame.instance_variable_set('@binding', TOPLEVEL_BINDING)
|
45
|
+
break_cmd.run(['break', __LINE__.to_s])
|
46
|
+
cmd.run([cmd.name, '1'])
|
48
47
|
end
|
data/processor/command/eval.rb
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
# Copyright (C) 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
3
3
|
require 'rubygems'; require 'require_relative'
|
4
|
-
require_relative '
|
5
|
-
require_relative '../../app/util'
|
4
|
+
require_relative '../command'
|
6
5
|
|
7
6
|
class Trepan::Command::EvalCommand < Trepan::Command
|
8
7
|
|
data/processor/command/exit.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
|
-
# Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
|
1
|
+
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
2
2
|
require 'rubygems'; require 'require_relative'
|
3
|
-
require_relative '
|
3
|
+
require_relative '../command'
|
4
4
|
class Trepan::Command::ExitCommand < Trepan::Command
|
5
5
|
|
6
6
|
unless defined?(HELP)
|
7
7
|
NAME = File.basename(__FILE__, '.rb')
|
8
8
|
ALIASES = %w(quit q q! quit! exit!)
|
9
9
|
HELP = <<-HELP
|
10
|
-
#{NAME} [exitcode] - hard exit of the debugged program.
|
10
|
+
#{NAME} [exitcode] [unconditionally] - hard exit of the debugged program.
|
11
11
|
|
12
12
|
The program being debugged is exited via exit!() which does not run
|
13
13
|
the Kernel at_exit finalizers. If a return code is given, that is the
|
@@ -18,6 +18,13 @@ If you are in interactive mode, and confirm is not set off, you are
|
|
18
18
|
prompted to confirm quitting. However if you do not want to be
|
19
19
|
prompted, add ! the end. (vim/vi/ed users can use alias q!).
|
20
20
|
|
21
|
+
Examples:
|
22
|
+
#{NAME} # quit prompting if we are interactive
|
23
|
+
#{NAME} unconditionally # quit without prompting
|
24
|
+
#{NAME}! # same as above
|
25
|
+
#{NAME} 0 # same as "quit"
|
26
|
+
#{NAME}! 1 # unconditional quit setting exit code 1
|
27
|
+
|
21
28
|
See also "kill" and "set confirm".'
|
22
29
|
HELP
|
23
30
|
|
@@ -32,7 +39,7 @@ See also "kill" and "set confirm".'
|
|
32
39
|
# This method runs the command
|
33
40
|
def run(args) # :nodoc
|
34
41
|
unconditional =
|
35
|
-
if args.size > 1 && args[1] == 'unconditionally'
|
42
|
+
if args.size > 1 && args[-1] == 'unconditionally'
|
36
43
|
args.shift
|
37
44
|
true
|
38
45
|
elsif args[0][-1..-1] == '!'
|
@@ -44,7 +51,17 @@ See also "kill" and "set confirm".'
|
|
44
51
|
msg('Quit not confirmed.')
|
45
52
|
return
|
46
53
|
end
|
47
|
-
|
54
|
+
|
55
|
+
if (args.size > 1)
|
56
|
+
if args[1] =~ /\d+/
|
57
|
+
exitrc = args[1].to_i;
|
58
|
+
else
|
59
|
+
errmsg "Bad an Integer return type \"#{args[1]}\"";
|
60
|
+
return;
|
61
|
+
end
|
62
|
+
else
|
63
|
+
exitrc = 0
|
64
|
+
end
|
48
65
|
|
49
66
|
# FIXME: Is this the best/most general way?
|
50
67
|
## @proc.finalize
|
@@ -59,8 +76,8 @@ end
|
|
59
76
|
if __FILE__ == $0
|
60
77
|
require_relative '../mock'
|
61
78
|
dbgr, cmd = MockDebugger::setup
|
62
|
-
|
63
|
-
|
64
|
-
|
79
|
+
Process.fork { cmd.run([cmd.name]) } if
|
80
|
+
Process.respond_to?(:fork)
|
81
|
+
cmd.run([cmd.name, 'foo'])
|
65
82
|
cmd.run([cmd.name, '10'])
|
66
83
|
end
|
data/processor/command/finish.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
1
2
|
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
2
3
|
require 'rubygems'; require 'require_relative'
|
3
|
-
require_relative '
|
4
|
+
require_relative '../command'
|
4
5
|
|
5
6
|
class Trepan::Command::FinishCommand < Trepan::Command
|
6
7
|
|
@@ -11,13 +12,17 @@ class Trepan::Command::FinishCommand < Trepan::Command
|
|
11
12
|
HELP = <<-HELP
|
12
13
|
#{NAME} [FRAME_NUM]
|
13
14
|
|
14
|
-
|
15
|
+
Continue execution until leaving the current method. Sometimes this
|
16
|
+
is called 'step out'.
|
15
17
|
|
16
18
|
If no frame number is given, we run until the currently selected frame
|
17
19
|
returns. The currently selected frame starts out the most-recent
|
18
20
|
frame or 0 if no frame positioning (e.g "up", "down" or "frame") has
|
19
21
|
been performed. If a frame number is given we run until that frame
|
20
22
|
returns.
|
23
|
+
|
24
|
+
See also commands:
|
25
|
+
'continue', 'break', 'next', 'nexti', 'step' for other ways to continue.
|
21
26
|
HELP
|
22
27
|
NEED_RUNNING = true
|
23
28
|
SHORT_HELP = 'Step into next method call or to next line'
|
data/processor/command/frame.rb
CHANGED
data/processor/command/help.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
2
2
|
require 'rubygems'; require 'require_relative'
|
3
|
-
require_relative '
|
3
|
+
require_relative '../command'
|
4
4
|
require_relative '../../app/complete'
|
5
5
|
class Trepan::Command::HelpCommand < Trepan::Command
|
6
6
|
unless defined?(HELP)
|
@@ -21,8 +21,6 @@ Some commands like 'info', 'set', and 'show' can accept an
|
|
21
21
|
additional subcommand to give help just about that particular
|
22
22
|
subcommand. For example 'help info line' give help about the
|
23
23
|
info line command.
|
24
|
-
|
25
|
-
See also 'examine' and 'whatis'.
|
26
24
|
HELP
|
27
25
|
|
28
26
|
ALIASES = %w(?)
|
@@ -155,7 +153,8 @@ Type "help" followed by command name for full documentation.
|
|
155
153
|
category == @proc.commands[cmd_name].category
|
156
154
|
end.sort
|
157
155
|
width = settings[:maxwidth]
|
158
|
-
|
156
|
+
msg columnize_commands(cmds)
|
157
|
+
return
|
159
158
|
end
|
160
159
|
|
161
160
|
msg('')
|