debugger 1.0.1 → 1.1.0
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.md +5 -0
- data/README.md +18 -15
- data/bin/rdebug +5 -5
- data/debugger.gemspec +2 -2
- data/ext/ruby_debug/extconf.rb +2 -2
- data/lib/debugger/version.rb +1 -1
- data/lib/ruby-debug.rb +18 -18
- data/lib/ruby-debug/command.rb +1 -1
- data/lib/ruby-debug/processor.rb +53 -53
- data/{doc → man}/rdebug.1 +0 -0
- data/{Makefile.am → old_scripts/Makefile.am} +0 -0
- data/old_scripts/README.md +2 -0
- data/{autogen.sh → old_scripts/autogen.sh} +0 -0
- data/{configure.ac → old_scripts/configure.ac} +0 -0
- data/{rdbg.rb → old_scripts/rdbg.rb} +0 -0
- data/{runner.sh → old_scripts/runner.sh} +0 -0
- data/{svn2cl_usermap → old_scripts/svn2cl_usermap} +0 -0
- data/test/base/base.rb +10 -13
- data/test/base/binding.rb +1 -8
- data/test/base/catchpoint.rb +3 -7
- data/test/base/load.rb +1 -5
- data/test/gcd-dbg-nox.rb +1 -2
- data/test/gcd-dbg.rb +1 -2
- data/test/pm-base.rb +0 -5
- data/test/tdebug.rb +0 -1
- data/test/test-ctrl.rb +0 -3
- data/test/test-help.rb +0 -5
- data/test/trunc-call.rb +1 -2
- metadata +25 -50
- data/lib/ChangeLog +0 -1065
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -14,15 +14,15 @@ For Windows install instructions, see OLD\_README.
|
|
14
14
|
|
15
15
|
## Usage
|
16
16
|
|
17
|
-
To use in your Rails app, drop in your Gemfile:
|
18
|
-
|
19
|
-
gem 'debugger'
|
20
|
-
|
21
17
|
Wherever you need a debugger, simply:
|
22
18
|
```ruby
|
23
19
|
require 'debugger'; debugger
|
24
20
|
```
|
25
21
|
|
22
|
+
To use in your Rails app, drop in your Gemfile:
|
23
|
+
|
24
|
+
gem 'debugger'
|
25
|
+
|
26
26
|
## Reason for Fork
|
27
27
|
|
28
28
|
* ruby-debug19 maintainer isn't maintaining:
|
@@ -37,16 +37,20 @@ require 'debugger'; debugger
|
|
37
37
|
|
38
38
|
## What's different from ruby-debug19
|
39
39
|
|
40
|
-
*
|
41
|
-
* 1.9.2
|
42
|
-
|
43
|
-
*
|
44
|
-
*
|
45
|
-
*
|
46
|
-
*
|
47
|
-
*
|
48
|
-
*
|
49
|
-
*
|
40
|
+
* Major
|
41
|
+
* Works on 1.9.2 and 1.9.3
|
42
|
+
* 1.9.2 points to ruby-debug-base19-0.11.25 headers
|
43
|
+
* 1.9.3 points to ruby-debug-base19-0.11.26 headers
|
44
|
+
* Install painlessly for rvm and rbenv rubies i.e. no compiler flags needed
|
45
|
+
* No downloading ruby source during install - was behavior of old ruby_core_source dependency
|
46
|
+
* Fix LocalJumpError caused by using proc in extconf.rb
|
47
|
+
* Passing tests are up on travis-ci
|
48
|
+
* Minor
|
49
|
+
* The gem name matches the module namespace, Debugger, and main required file, debugger.
|
50
|
+
* ruby-debug-base19 and ruby-debug19 are released as one gem
|
51
|
+
* Rake tasks have been updated
|
52
|
+
* No more $LOAD_PATH manipulation or runtime code outside of lib
|
53
|
+
* man page available via gem-man
|
50
54
|
|
51
55
|
## Issues
|
52
56
|
Please report them [on github](http://github.com/cldwalker/debugger/issues).
|
@@ -65,4 +69,3 @@ Let's keep this working for the ruby community!
|
|
65
69
|
|
66
70
|
* Fix test/test-*.rb
|
67
71
|
* Work with others willing to tackle jruby, rubinius or windows support
|
68
|
-
* Clean up (merge) lib + cli as separate runtime paths for ruby-debug-base19 and ruby-debug19
|
data/bin/rdebug
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
#=== Summary
|
4
4
|
#
|
5
|
-
#A command-line front-end to the Ruby debugger, <tt>
|
5
|
+
#A command-line front-end to the Ruby debugger, <tt>debugger</tt>, the
|
6
6
|
#Fast Ruby Debugger.
|
7
7
|
#
|
8
8
|
#Command invocation:
|
@@ -104,7 +104,7 @@
|
|
104
104
|
|
105
105
|
require 'optparse'
|
106
106
|
require 'ostruct'
|
107
|
-
require '
|
107
|
+
require 'debugger'
|
108
108
|
|
109
109
|
def debug_program(options)
|
110
110
|
# Make sure Ruby script syntax checks okay.
|
@@ -225,7 +225,7 @@ EOB
|
|
225
225
|
opts.on('-r', '--require SCRIPT', String,
|
226
226
|
'Require the library, before executing your script') do |name|
|
227
227
|
if name == 'debug'
|
228
|
-
puts "
|
228
|
+
puts "debugger is not compatible with Ruby's 'debug' library. This option is ignored."
|
229
229
|
else
|
230
230
|
require name
|
231
231
|
end
|
@@ -262,7 +262,7 @@ EOB
|
|
262
262
|
end
|
263
263
|
opts.on_tail('--version',
|
264
264
|
'Print the version') do
|
265
|
-
puts "
|
265
|
+
puts "debugger #{Debugger::VERSION}"
|
266
266
|
exit
|
267
267
|
end
|
268
268
|
opts.on('--verbose', 'Turn on verbose mode') do
|
@@ -271,7 +271,7 @@ EOB
|
|
271
271
|
end
|
272
272
|
opts.on_tail('-v',
|
273
273
|
'Print version number, then turn on verbose mode') do
|
274
|
-
puts "
|
274
|
+
puts "debugger #{Debugger::VERSION}"
|
275
275
|
$VERBOSE = true
|
276
276
|
end
|
277
277
|
end
|
data/debugger.gemspec
CHANGED
@@ -20,8 +20,8 @@ handling, bindings for stack frames among other things.
|
|
20
20
|
s.extensions << "ext/ruby_debug/extconf.rb"
|
21
21
|
s.executables = ["rdebug"]
|
22
22
|
s.add_dependency "columnize", ">= 0.3.1"
|
23
|
-
s.add_dependency "debugger-ruby_core_source"
|
24
|
-
s.add_dependency "debugger-linecache"
|
23
|
+
s.add_dependency "debugger-ruby_core_source", '~> 1.1'
|
24
|
+
s.add_dependency "debugger-linecache", '~> 1.1'
|
25
25
|
s.add_development_dependency 'rake', '~> 0.9.2.2'
|
26
26
|
s.add_development_dependency 'rake-compiler', '~> 0.8.0'
|
27
27
|
end
|
data/ext/ruby_debug/extconf.rb
CHANGED
@@ -10,7 +10,7 @@ elsif bindir =~ %r{(^.*/\.rvm/rubies)/([^/]+)/bin$}
|
|
10
10
|
end
|
11
11
|
|
12
12
|
require "mkmf"
|
13
|
-
require "ruby_core_source"
|
13
|
+
require "debugger/ruby_core_source"
|
14
14
|
require 'fileutils'
|
15
15
|
|
16
16
|
if RUBY_VERSION < "1.9"
|
@@ -55,7 +55,7 @@ current_dir = File.dirname(__FILE__)
|
|
55
55
|
end
|
56
56
|
|
57
57
|
dir_config("ruby")
|
58
|
-
if !
|
58
|
+
if !Debugger::RubyCoreSource.create_makefile_with_core(hdrs, "ruby_debug")
|
59
59
|
STDERR.print("Makefile creation failed\n")
|
60
60
|
STDERR.print("*************************************************************\n\n")
|
61
61
|
STDERR.print(" NOTE: If your headers were not found, try passing\n")
|
data/lib/debugger/version.rb
CHANGED
data/lib/ruby-debug.rb
CHANGED
@@ -3,11 +3,11 @@ require 'stringio'
|
|
3
3
|
require 'socket'
|
4
4
|
require 'thread'
|
5
5
|
require 'ruby-debug-base'
|
6
|
-
|
6
|
+
require 'ruby-debug/processor'
|
7
7
|
|
8
8
|
module Debugger
|
9
9
|
self.handler = CommandProcessor.new
|
10
|
-
|
10
|
+
|
11
11
|
# the port number used for remote debugging
|
12
12
|
PORT = 8989 unless defined?(PORT)
|
13
13
|
|
@@ -16,31 +16,31 @@ module Debugger
|
|
16
16
|
if RUBY_PLATFORM =~ /mswin/
|
17
17
|
# Of course MS Windows has to be different
|
18
18
|
INITFILE = 'rdebug.ini'
|
19
|
-
HOME_DIR = (ENV['HOME'] ||
|
19
|
+
HOME_DIR = (ENV['HOME'] ||
|
20
20
|
ENV['HOMEDRIVE'].to_s + ENV['HOMEPATH'].to_s).to_s
|
21
21
|
else
|
22
22
|
INITFILE = '.rdebugrc'
|
23
23
|
HOME_DIR = ENV['HOME'].to_s
|
24
24
|
end
|
25
25
|
end
|
26
|
-
|
26
|
+
|
27
27
|
class << self
|
28
28
|
# gdb-style annotation mode. Used in GNU Emacs interface
|
29
29
|
attr_accessor :annotate
|
30
30
|
|
31
|
-
# in remote mode, wait for the remote connection
|
31
|
+
# in remote mode, wait for the remote connection
|
32
32
|
attr_accessor :wait_connection
|
33
33
|
|
34
34
|
# If set, a string to look for in caller() and is used to see
|
35
35
|
# if the call stack is truncated.
|
36
|
-
attr_accessor :start_sentinal
|
37
|
-
|
36
|
+
attr_accessor :start_sentinal
|
37
|
+
|
38
38
|
attr_reader :thread, :control_thread
|
39
39
|
|
40
40
|
def interface=(value) # :nodoc:
|
41
41
|
handler.interface = value
|
42
42
|
end
|
43
|
-
|
43
|
+
|
44
44
|
#
|
45
45
|
# Starts a remote debugger.
|
46
46
|
#
|
@@ -57,12 +57,12 @@ module Debugger
|
|
57
57
|
end
|
58
58
|
|
59
59
|
start_control(host, ctrl_port)
|
60
|
-
|
60
|
+
|
61
61
|
yield if block_given?
|
62
|
-
|
62
|
+
|
63
63
|
mutex = Mutex.new
|
64
64
|
proceed = ConditionVariable.new
|
65
|
-
|
65
|
+
|
66
66
|
@thread = DebugThread.new do
|
67
67
|
server = TCPServer.new(host, cmd_port)
|
68
68
|
while (session = server.accept)
|
@@ -77,11 +77,11 @@ module Debugger
|
|
77
77
|
if wait_connection
|
78
78
|
mutex.synchronize do
|
79
79
|
proceed.wait(mutex)
|
80
|
-
end
|
80
|
+
end
|
81
81
|
end
|
82
82
|
end
|
83
83
|
alias start_server start_remote
|
84
|
-
|
84
|
+
|
85
85
|
def start_control(host = nil, ctrl_port = PORT + 1) # :nodoc:
|
86
86
|
return if defined?(@control_thread) && @control_thread
|
87
87
|
@control_thread = DebugThread.new do
|
@@ -93,7 +93,7 @@ module Debugger
|
|
93
93
|
end
|
94
94
|
end
|
95
95
|
end
|
96
|
-
|
96
|
+
|
97
97
|
#
|
98
98
|
# Connects to the remote debugger
|
99
99
|
#
|
@@ -102,10 +102,10 @@ module Debugger
|
|
102
102
|
interface = Debugger::LocalInterface.new
|
103
103
|
socket = TCPSocket.new(host, port)
|
104
104
|
puts "Connected."
|
105
|
-
|
105
|
+
|
106
106
|
catch(:exit) do
|
107
107
|
while (line = socket.gets)
|
108
|
-
case line
|
108
|
+
case line
|
109
109
|
when /^PROMPT (.*)$/
|
110
110
|
input = interface.read_command($1)
|
111
111
|
throw :exit unless input
|
@@ -121,7 +121,7 @@ module Debugger
|
|
121
121
|
end
|
122
122
|
socket.close
|
123
123
|
end
|
124
|
-
|
124
|
+
|
125
125
|
# Runs normal debugger initialization scripts
|
126
126
|
# Reads and executes the commands from init file (if any) in the
|
127
127
|
# current working directory. This is only done if the current
|
@@ -134,7 +134,7 @@ module Debugger
|
|
134
134
|
run_script(cwd_script_file, out) if File.exists?(cwd_script_file)
|
135
135
|
|
136
136
|
home_script_file = File.expand_path(File.join(HOME_DIR, INITFILE))
|
137
|
-
run_script(home_script_file, out) if File.exists?(home_script_file) and
|
137
|
+
run_script(home_script_file, out) if File.exists?(home_script_file) and
|
138
138
|
cwd_script_file != home_script_file
|
139
139
|
end
|
140
140
|
|
data/lib/ruby-debug/command.rb
CHANGED
data/lib/ruby-debug/processor.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
require 'ruby-debug/interface'
|
2
|
+
require 'ruby-debug/command'
|
3
3
|
|
4
4
|
module Debugger
|
5
5
|
|
@@ -11,12 +11,12 @@ module Debugger
|
|
11
11
|
def afmt(msg, newline="\n")
|
12
12
|
"\032\032#{msg}#{newline}"
|
13
13
|
end
|
14
|
-
|
14
|
+
|
15
15
|
def aprint(msg)
|
16
16
|
print afmt(msg) if Debugger.annotate.to_i > 2
|
17
17
|
end
|
18
18
|
|
19
|
-
# FIXME: use delegate?
|
19
|
+
# FIXME: use delegate?
|
20
20
|
def errmsg(*args)
|
21
21
|
@interface.errmsg(*args)
|
22
22
|
end
|
@@ -30,7 +30,7 @@ module Debugger
|
|
30
30
|
def print(*args)
|
31
31
|
@interface.print(*args)
|
32
32
|
end
|
33
|
-
|
33
|
+
|
34
34
|
end
|
35
35
|
|
36
36
|
class CommandProcessor < Processor # :nodoc:
|
@@ -38,12 +38,12 @@ module Debugger
|
|
38
38
|
|
39
39
|
# FIXME: get from Command regexp method.
|
40
40
|
@@Show_breakpoints_postcmd = [
|
41
|
-
/^\s*b(?:reak)?/,
|
41
|
+
/^\s*b(?:reak)?/,
|
42
42
|
/^\s* cond(?:ition)? (?:\s+(\d+)\s*(.*))?$/ix,
|
43
43
|
/^\s*del(?:ete)?(?:\s+(.*))?$/ix,
|
44
44
|
/^\s* dis(?:able)? (?:\s+(.*))?$/ix,
|
45
45
|
/^\s* en(?:able)? (?:\s+(.*))?$/ix,
|
46
|
-
# "tbreak", "clear",
|
46
|
+
# "tbreak", "clear",
|
47
47
|
]
|
48
48
|
@@Show_annotations_run = [
|
49
49
|
/^\s*c(?:ont(?:inue)?)?(?:\s+(.*))?$/,
|
@@ -57,11 +57,11 @@ module Debugger
|
|
57
57
|
/^\s* f(?:rame)? (?:\s+ (.*))? \s*$/x,
|
58
58
|
/^\s* u(?:p)? (?:\s+(.*))?$/x
|
59
59
|
]
|
60
|
-
|
60
|
+
|
61
61
|
def initialize(interface = LocalInterface.new)
|
62
62
|
@interface = interface
|
63
63
|
@display = []
|
64
|
-
|
64
|
+
|
65
65
|
@mutex = Mutex.new
|
66
66
|
@last_cmd = nil
|
67
67
|
@last_file = nil # Filename the last time we stopped
|
@@ -70,22 +70,22 @@ module Debugger
|
|
70
70
|
@debugger_displays_were_empty = true # No display 1st time
|
71
71
|
@debugger_context_was_dead = true # Assume we haven't started.
|
72
72
|
end
|
73
|
-
|
73
|
+
|
74
74
|
def interface=(interface)
|
75
75
|
@mutex.synchronize do
|
76
76
|
@interface.close if @interface
|
77
77
|
@interface = interface
|
78
78
|
end
|
79
79
|
end
|
80
|
-
|
80
|
+
|
81
81
|
require 'pathname' # For cleanpath
|
82
|
-
|
83
|
-
# Regularize file name.
|
84
|
-
# This is also used as a common funnel place if basename is
|
85
|
-
# desired or if we are working remotely and want to change the
|
82
|
+
|
83
|
+
# Regularize file name.
|
84
|
+
# This is also used as a common funnel place if basename is
|
85
|
+
# desired or if we are working remotely and want to change the
|
86
86
|
# basename. Or we are eliding filenames.
|
87
87
|
def self.canonic_file(filename)
|
88
|
-
# For now we want resolved filenames
|
88
|
+
# For now we want resolved filenames
|
89
89
|
if Command.settings[:basename]
|
90
90
|
File.basename(filename)
|
91
91
|
else
|
@@ -95,7 +95,7 @@ module Debugger
|
|
95
95
|
end
|
96
96
|
|
97
97
|
def self.print_location_and_text(file, line)
|
98
|
-
file_line = "%s:%s\n%s" % [canonic_file(file), line,
|
98
|
+
file_line = "%s:%s\n%s" % [canonic_file(file), line,
|
99
99
|
Debugger.line_at(file, line)]
|
100
100
|
# FIXME: use annotations routines
|
101
101
|
if Debugger.annotate.to_i > 2
|
@@ -105,7 +105,7 @@ module Debugger
|
|
105
105
|
end
|
106
106
|
print file_line
|
107
107
|
end
|
108
|
-
|
108
|
+
|
109
109
|
def self.protect(mname)
|
110
110
|
alias_method "__#{mname}", mname
|
111
111
|
module_eval %{
|
@@ -124,7 +124,7 @@ module Debugger
|
|
124
124
|
end
|
125
125
|
}
|
126
126
|
end
|
127
|
-
|
127
|
+
|
128
128
|
def at_breakpoint(context, breakpoint)
|
129
129
|
aprint 'stopped' if Debugger.annotate.to_i > 2
|
130
130
|
n = Debugger.breakpoints.index(breakpoint) + 1
|
@@ -136,7 +136,7 @@ module Debugger
|
|
136
136
|
print "Breakpoint %d at %s:%s\n", n, file, line
|
137
137
|
end
|
138
138
|
protect :at_breakpoint
|
139
|
-
|
139
|
+
|
140
140
|
def at_catchpoint(context, excpt)
|
141
141
|
aprint 'stopped' if Debugger.annotate.to_i > 2
|
142
142
|
file = CommandProcessor.canonic_file(context.frame_file(0))
|
@@ -152,13 +152,13 @@ module Debugger
|
|
152
152
|
end
|
153
153
|
end
|
154
154
|
protect :at_catchpoint
|
155
|
-
|
155
|
+
|
156
156
|
def at_tracing(context, file, line)
|
157
|
-
return if defined?(Debugger::RDEBUG_FILE) &&
|
157
|
+
return if defined?(Debugger::RDEBUG_FILE) &&
|
158
158
|
Debugger::RDEBUG_FILE == file # Don't trace ourself
|
159
159
|
@last_file = CommandProcessor.canonic_file(file)
|
160
160
|
file = CommandProcessor.canonic_file(file)
|
161
|
-
unless file == @last_file and @last_line == line and
|
161
|
+
unless file == @last_file and @last_line == line and
|
162
162
|
Command.settings[:tracing_plus]
|
163
163
|
print "Tracing(%d):%s:%s %s",
|
164
164
|
context.thnum, file, line, Debugger.line_at(file, line)
|
@@ -173,18 +173,18 @@ module Debugger
|
|
173
173
|
process_commands(context, file, line)
|
174
174
|
end
|
175
175
|
protect :at_line
|
176
|
-
|
176
|
+
|
177
177
|
def at_return(context, file, line)
|
178
178
|
context.stop_frame = -1
|
179
179
|
process_commands(context, file, line)
|
180
180
|
end
|
181
|
-
|
181
|
+
|
182
182
|
private
|
183
183
|
|
184
184
|
# The prompt shown before reading a command.
|
185
185
|
def prompt(context)
|
186
186
|
p = '(rdb:%s) ' % (context.dead? ? 'post-mortem' : context.thnum)
|
187
|
-
p = afmt("pre-prompt")+p+"\n"+afmt("prompt") if
|
187
|
+
p = afmt("pre-prompt")+p+"\n"+afmt("prompt") if
|
188
188
|
Debugger.annotate.to_i > 2
|
189
189
|
return p
|
190
190
|
end
|
@@ -197,7 +197,7 @@ module Debugger
|
|
197
197
|
event_cmds = Command.commands.select{|cmd| cmd.event }
|
198
198
|
|
199
199
|
# Remove some commands in post-mortem
|
200
|
-
event_cmds = event_cmds.find_all do |cmd|
|
200
|
+
event_cmds = event_cmds.find_all do |cmd|
|
201
201
|
cmd.allow_in_post_mortem
|
202
202
|
end if context.dead?
|
203
203
|
|
@@ -211,11 +211,11 @@ module Debugger
|
|
211
211
|
s.commands = event_cmds
|
212
212
|
end
|
213
213
|
@interface.state = state if @interface.respond_to?('state=')
|
214
|
-
|
214
|
+
|
215
215
|
# Bind commands to the current state.
|
216
216
|
commands = event_cmds.map{|cmd| cmd.new(state)}
|
217
217
|
|
218
|
-
commands.select do |cmd|
|
218
|
+
commands.select do |cmd|
|
219
219
|
cmd.class.always_run >= run_level
|
220
220
|
end.each {|cmd| cmd.execute}
|
221
221
|
return state, commands
|
@@ -240,10 +240,10 @@ module Debugger
|
|
240
240
|
m
|
241
241
|
end
|
242
242
|
end
|
243
|
-
|
243
|
+
|
244
244
|
preloop(commands, context)
|
245
245
|
CommandProcessor.print_location_and_text(file, line)
|
246
|
-
while !state.proceed?
|
246
|
+
while !state.proceed?
|
247
247
|
input = if @interface.command_queue.empty?
|
248
248
|
@interface.read_command(prompt(context))
|
249
249
|
else
|
@@ -265,7 +265,7 @@ module Debugger
|
|
265
265
|
end
|
266
266
|
postloop(commands, context)
|
267
267
|
end # process_commands
|
268
|
-
|
268
|
+
|
269
269
|
def one_cmd(commands, context, input)
|
270
270
|
if cmd = commands.find{ |c| c.match(input) }
|
271
271
|
if context.dead? && cmd.class.need_context
|
@@ -283,14 +283,14 @@ module Debugger
|
|
283
283
|
end
|
284
284
|
end
|
285
285
|
end
|
286
|
-
|
286
|
+
|
287
287
|
def preloop(commands, context)
|
288
288
|
aprint('stopped') if Debugger.annotate.to_i > 2
|
289
289
|
if context.dead?
|
290
290
|
unless @debugger_context_was_dead
|
291
291
|
if Debugger.annotate.to_i > 2
|
292
|
-
aprint('exited')
|
293
|
-
print "The program finished.\n"
|
292
|
+
aprint('exited')
|
293
|
+
print "The program finished.\n"
|
294
294
|
end
|
295
295
|
@debugger_context_was_dead = true
|
296
296
|
end
|
@@ -307,7 +307,7 @@ module Debugger
|
|
307
307
|
context.dead?
|
308
308
|
end
|
309
309
|
end
|
310
|
-
|
310
|
+
|
311
311
|
def postcmd(commands, context, cmd)
|
312
312
|
if Debugger.annotate.to_i > 0
|
313
313
|
cmd = @last_cmd unless cmd
|
@@ -315,7 +315,7 @@ module Debugger
|
|
315
315
|
@@Show_breakpoints_postcmd.find{|pat| cmd =~ pat}
|
316
316
|
display_annotations(commands, context)
|
317
317
|
if @@Show_annotations_postcmd.find{|pat| cmd =~ pat}
|
318
|
-
annotation('stack', commands, context, "where") if
|
318
|
+
annotation('stack', commands, context, "where") if
|
319
319
|
context.stack_size > 0
|
320
320
|
annotation('variables', commands, context, "info variables") unless
|
321
321
|
context.dead?
|
@@ -340,14 +340,14 @@ module Debugger
|
|
340
340
|
|
341
341
|
def breakpoint_annotations(commands, context)
|
342
342
|
unless Debugger.breakpoints.empty? and @debugger_breakpoints_were_empty
|
343
|
-
annotation('breakpoints', commands, context, "info breakpoints")
|
343
|
+
annotation('breakpoints', commands, context, "info breakpoints")
|
344
344
|
@debugger_breakpoints_were_empty = Debugger.breakpoints.empty?
|
345
345
|
end
|
346
346
|
end
|
347
347
|
|
348
348
|
def display_annotations(commands, context)
|
349
349
|
return if display.empty?
|
350
|
-
# have_display = display.find{|d| d[0]}
|
350
|
+
# have_display = display.find{|d| d[0]}
|
351
351
|
# return unless have_display and @debugger_displays_were_empty
|
352
352
|
# @debugger_displays_were_empty = have_display
|
353
353
|
annotation('display', commands, context, "display")
|
@@ -366,7 +366,7 @@ module Debugger
|
|
366
366
|
yield self
|
367
367
|
end
|
368
368
|
|
369
|
-
# FIXME: use delegate?
|
369
|
+
# FIXME: use delegate?
|
370
370
|
def errmsg(*args)
|
371
371
|
@interface.errmsg(*args)
|
372
372
|
end
|
@@ -388,25 +388,25 @@ module Debugger
|
|
388
388
|
end
|
389
389
|
end
|
390
390
|
end
|
391
|
-
|
391
|
+
|
392
392
|
class ControlCommandProcessor < Processor # :nodoc:
|
393
393
|
def initialize(interface)
|
394
394
|
super()
|
395
395
|
@interface = interface
|
396
396
|
@debugger_context_was_dead = true # Assume we haven't started.
|
397
397
|
end
|
398
|
-
|
398
|
+
|
399
399
|
def process_commands(verbose=false)
|
400
|
-
control_cmds = Command.commands.select do |cmd|
|
401
|
-
cmd.allow_in_control
|
400
|
+
control_cmds = Command.commands.select do |cmd|
|
401
|
+
cmd.allow_in_control
|
402
402
|
end
|
403
403
|
state = State.new(@interface, control_cmds)
|
404
404
|
commands = control_cmds.map{|cmd| cmd.new(state) }
|
405
405
|
|
406
406
|
unless @debugger_context_was_dead
|
407
407
|
if Debugger.annotate.to_i > 2
|
408
|
-
aprint 'exited'
|
409
|
-
print "The program finished.\n"
|
408
|
+
aprint 'exited'
|
409
|
+
print "The program finished.\n"
|
410
410
|
end
|
411
411
|
@debugger_context_was_dead = true
|
412
412
|
end
|
@@ -433,34 +433,34 @@ module Debugger
|
|
433
433
|
# Note: have an unused 'context' parameter to match the local interface.
|
434
434
|
def prompt(context)
|
435
435
|
p = '(rdb:ctrl) '
|
436
|
-
p = afmt("pre-prompt")+p+"\n"+afmt("prompt") if
|
436
|
+
p = afmt("pre-prompt")+p+"\n"+afmt("prompt") if
|
437
437
|
Debugger.annotate.to_i > 2
|
438
438
|
return p
|
439
439
|
end
|
440
440
|
|
441
441
|
class State # :nodoc:
|
442
442
|
attr_reader :commands, :interface
|
443
|
-
|
443
|
+
|
444
444
|
def initialize(interface, commands)
|
445
445
|
@interface = interface
|
446
446
|
@commands = commands
|
447
447
|
end
|
448
|
-
|
448
|
+
|
449
449
|
def proceed
|
450
450
|
end
|
451
|
-
|
451
|
+
|
452
452
|
def errmsg(*args)
|
453
453
|
@interface.print(*args)
|
454
454
|
end
|
455
|
-
|
455
|
+
|
456
456
|
def print(*args)
|
457
457
|
@interface.print(*args)
|
458
458
|
end
|
459
|
-
|
459
|
+
|
460
460
|
def confirm(*args)
|
461
461
|
'y'
|
462
462
|
end
|
463
|
-
|
463
|
+
|
464
464
|
def context
|
465
465
|
nil
|
466
466
|
end
|