trepanning 1.93.32 → 1.93.35
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +16 -2
- data/NEWS +6 -0
- data/app/markdown.rb +3 -1
- data/app/options.rb +1 -1
- data/processor.rb +33 -32
- data/processor/command/list.rb +143 -140
- data/trepanning.gemspec +9 -4
- metadata +29 -7
data/ChangeLog
CHANGED
@@ -1,7 +1,21 @@
|
|
1
|
+
2015-03-12 rocky <rockyb@rubyforge.org>
|
2
|
+
|
3
|
+
* trepanning.gemspec: Get ready for release 1.93.34 (again)
|
4
|
+
|
5
|
+
2015-03-12 rocky <rockyb@rubyforge.org>
|
6
|
+
|
7
|
+
* ChangeLog, NEWS, app/markdown.rb, app/options.rb,
|
8
|
+
processor/command/list.rb: Get ready for release 1.93.34
|
9
|
+
|
10
|
+
2015-03-12 rocky <rockyb@rubyforge.org>
|
11
|
+
|
12
|
+
* processor.rb, trepanning.gemspec: Empty line runs "next command".
|
13
|
+
Add Markdown in description.
|
14
|
+
|
1
15
|
2015-03-08 rocky <rockyb@rubyforge.org>
|
2
16
|
|
3
|
-
* NEWS, app/breakpoint.rb, app/options.rb,
|
4
|
-
ready for release 1.93.32
|
17
|
+
* ChangeLog, NEWS, app/breakpoint.rb, app/options.rb,
|
18
|
+
trepanning.gemspec: Get ready for release 1.93.32
|
5
19
|
|
6
20
|
2015-03-08 rocky <rockyb@rubyforge.org>
|
7
21
|
|
data/NEWS
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
(1.93.40) Mar 12, 2015
|
2
|
+
- remove stray space after backtick in markdown
|
3
|
+
- list command continues where it last left off
|
4
|
+
- empty debugger command repeats last command
|
5
|
+
- Use markdown in Gem description
|
6
|
+
|
1
7
|
(1.93.32) Mar 8, 2015
|
2
8
|
- Remove reference to threadframe
|
3
9
|
|
data/app/markdown.rb
CHANGED
@@ -58,7 +58,7 @@ module Redcarpet
|
|
58
58
|
|
59
59
|
def codespan(text)
|
60
60
|
if ansi?
|
61
|
-
Term::ANSIColor.underline + text + Term::ANSIColor.reset
|
61
|
+
Term::ANSIColor.underline + text + Term::ANSIColor.reset
|
62
62
|
else
|
63
63
|
"'" + text + "'"
|
64
64
|
end
|
@@ -162,6 +162,8 @@ if __FILE__ == $0
|
|
162
162
|
# HI
|
163
163
|
This is a paragraph
|
164
164
|
|
165
|
+
A `b`, `c`, d
|
166
|
+
|
165
167
|
**This** is another *paragraph*.
|
166
168
|
EOF
|
167
169
|
[[80, true],
|
data/app/options.rb
CHANGED
data/processor.rb
CHANGED
@@ -153,41 +153,42 @@ class Trepan
|
|
153
153
|
|
154
154
|
# Run one debugger command. True is returned if we want to quit.
|
155
155
|
def process_command_and_quit?()
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
156
|
+
intf_size = @dbgr.intf.size
|
157
|
+
@intf = @dbgr.intf[-1]
|
158
|
+
return true if @intf.input_eof? && intf_size == 1
|
159
|
+
while intf_size > 1 || !@intf.input_eof?
|
160
|
+
begin
|
161
|
+
@current_command =
|
162
|
+
if @cmd_queue.empty?
|
163
|
+
# Leave trailing blanks on for the "complete" command
|
164
|
+
read_command.chomp
|
165
|
+
else
|
166
|
+
@cmd_queue.shift
|
167
|
+
end
|
168
|
+
if @current_command.empty?
|
169
|
+
next unless @last_command && intf.interactive?
|
170
|
+
@current_command = @last_command
|
171
|
+
end
|
172
|
+
next if @current_command[0..0] == '#' # Skip comment lines
|
173
|
+
break
|
174
|
+
rescue IOError, Errno::EPIPE => e
|
175
|
+
if intf_size > 1
|
176
|
+
@dbgr.intf.pop
|
177
|
+
intf_size = @dbgr.intf.size
|
178
|
+
@intf = @dbgr.intf[-1]
|
179
|
+
@last_command = nil
|
180
|
+
print_location
|
181
|
+
else
|
182
|
+
## FIXME: think of something better.
|
182
183
|
quit('quit!')
|
183
|
-
|
184
|
-
|
184
|
+
return true
|
185
|
+
end
|
186
|
+
end
|
185
187
|
end
|
186
|
-
|
187
|
-
run_command(@current_command)
|
188
|
+
run_command(@current_command)
|
188
189
|
|
189
|
-
|
190
|
-
|
190
|
+
# Save it to the history.
|
191
|
+
@intf.history_io.puts @last_command if @last_command && @intf.history_io
|
191
192
|
end
|
192
193
|
|
193
194
|
# This is the main entry point.
|
data/processor/command/list.rb
CHANGED
@@ -5,11 +5,12 @@ require_relative '../command'
|
|
5
5
|
require_relative '../list'
|
6
6
|
|
7
7
|
class Trepan::Command::ListCommand < Trepan::Command
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
**#{NAME}[
|
12
|
-
|
8
|
+
unless defined?(HELP)
|
9
|
+
NAME = File.basename(__FILE__, '.rb')
|
10
|
+
HELP = <<-HELP
|
11
|
+
**#{NAME}**[**>**] [*module*] [*first* [*num*]]
|
12
|
+
|
13
|
+
**#{NAME}**[**>**] *location* [*num*]
|
13
14
|
|
14
15
|
List source code.
|
15
16
|
|
@@ -21,13 +22,13 @@ changing, then that is start the line after we last one previously
|
|
21
22
|
shown.
|
22
23
|
|
23
24
|
If the command has a ">" suffix, then line centering is disabled and
|
24
|
-
listing begins at the
|
25
|
+
listing begins at the specified location.
|
25
26
|
|
26
27
|
The number of lines to show is controlled by the debugger "listsize"
|
27
28
|
setting. Use 'set max list' or 'show max list' to see or set the
|
28
29
|
value.
|
29
30
|
|
30
|
-
|
31
|
+
`#{NAME} -` shows lines before a previous listing.
|
31
32
|
|
32
33
|
A *location* is a either:
|
33
34
|
|
@@ -90,164 +91,166 @@ See also:
|
|
90
91
|
`set max list`, `show max list`, `disassemble`, `help syntax location`
|
91
92
|
HELP
|
92
93
|
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
end
|
98
|
-
|
99
|
-
def run(args)
|
100
|
-
if args.empty? and not frame
|
101
|
-
errmsg("No Ruby program loaded.")
|
102
|
-
return
|
103
|
-
end
|
104
|
-
listsize = settings[:maxlist]
|
105
|
-
center_correction =
|
106
|
-
if args[0][-1..-1] == '>'
|
107
|
-
0
|
108
|
-
else
|
109
|
-
(listsize-1) / 2
|
110
|
-
end
|
111
|
-
|
112
|
-
iseq, filename, first, last =
|
113
|
-
@proc.parse_list_cmd(@proc.cmd_argstr, listsize, center_correction)
|
114
|
-
return unless filename
|
115
|
-
container = iseq ? iseq.source_container : ['file', filename]
|
116
|
-
breaklist = @proc.brkpts.line_breaks(container)
|
117
|
-
|
118
|
-
# We now have range information. Do the listing.
|
119
|
-
max_line = LineCache::size(filename)
|
120
|
-
unless max_line
|
121
|
-
errmsg('File "%s" not found.' % filename)
|
122
|
-
return
|
94
|
+
ALIASES = %W(l #{NAME}> l> cat)
|
95
|
+
CATEGORY = 'files'
|
96
|
+
MAX_ARGS = 3
|
97
|
+
SHORT_HELP = 'List source code'
|
123
98
|
end
|
124
99
|
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
100
|
+
def run(args)
|
101
|
+
if args.size == 1 and not @proc.frame
|
102
|
+
errmsg("No Ruby program loaded.")
|
103
|
+
return
|
104
|
+
end
|
105
|
+
listsize = settings[:maxlist]
|
106
|
+
center_correction =
|
107
|
+
if args[0][-1..-1] == '>'
|
108
|
+
0
|
109
|
+
else
|
110
|
+
(listsize-1) / 2
|
111
|
+
end
|
112
|
+
|
113
|
+
iseq, filename, first, last =
|
114
|
+
@proc.parse_list_cmd(@proc.cmd_argstr, listsize, center_correction)
|
115
|
+
return unless filename
|
116
|
+
container = iseq ? iseq.source_container : ['file', filename]
|
117
|
+
breaklist = @proc.brkpts.line_breaks(container)
|
118
|
+
|
119
|
+
# We now have range information. Do the listing.
|
120
|
+
max_line = LineCache::size(filename)
|
121
|
+
unless max_line
|
122
|
+
errmsg('File "%s" not found.' % filename)
|
123
|
+
return
|
124
|
+
end
|
130
125
|
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
126
|
+
if first > max_line
|
127
|
+
errmsg('Bad line range [%d...%d]; file "%s" has only %d lines' %
|
128
|
+
[first, last, filename, max_line])
|
129
|
+
return
|
130
|
+
end
|
135
131
|
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
132
|
+
if last > max_line
|
133
|
+
# msg('End position changed to last line %d ' % max_line)
|
134
|
+
last = max_line
|
135
|
+
end
|
136
|
+
|
137
|
+
begin
|
138
|
+
opts = {
|
139
|
+
:reload_on_change => settings[:reload],
|
140
|
+
:output => settings[:highlight]
|
141
|
+
}
|
142
|
+
frame = @proc.frame
|
143
|
+
first.upto(last).each do |lineno|
|
144
|
+
line = LineCache::getline(filename, lineno, opts)
|
145
|
+
unless line
|
146
|
+
msg('[EOF]')
|
147
|
+
break
|
148
|
+
end
|
149
|
+
line.chomp!
|
150
|
+
s = '%3d' % lineno
|
151
|
+
s = s + ' ' if s.size < 4
|
152
|
+
s += if breaklist.member?(lineno)
|
153
|
+
bp = breaklist[lineno]
|
154
|
+
a_pad = '%02d' % bp.id
|
155
|
+
bp.icon_char
|
156
|
+
else
|
157
|
+
a_pad = ' '
|
158
|
+
' '
|
159
|
+
end
|
160
|
+
s += (frame && lineno == @proc.frame_line &&
|
161
|
+
filename == frame.source_container[1]) ? '->' : a_pad
|
162
|
+
msg(s + "\t" + line, {:unlimited => true})
|
163
|
+
@proc.line_no = lineno
|
164
|
+
end
|
165
|
+
@proc.list_lineno += listsize + center_correction + 1
|
166
|
+
@proc.list_lineno = max_line if @proc.list_lineno > max_line
|
167
|
+
rescue => e
|
168
|
+
errmsg e.to_s if settings[:debugexcept]
|
147
169
|
end
|
148
|
-
line.chomp!
|
149
|
-
s = '%3d' % lineno
|
150
|
-
s = s + ' ' if s.size < 4
|
151
|
-
s += if breaklist.member?(lineno)
|
152
|
-
bp = breaklist[lineno]
|
153
|
-
a_pad = '%02d' % bp.id
|
154
|
-
bp.icon_char
|
155
|
-
else
|
156
|
-
a_pad = ' '
|
157
|
-
' '
|
158
|
-
end
|
159
|
-
s += (frame && lineno == @proc.frame_line &&
|
160
|
-
filename == frame.source_container[1]) ? '->' : a_pad
|
161
|
-
msg(s + "\t" + line, {:unlimited => true})
|
162
|
-
@proc.line_no = lineno
|
163
|
-
end
|
164
|
-
rescue => e
|
165
|
-
errmsg e.to_s if settings[:debugexcept]
|
166
170
|
end
|
167
|
-
end
|
168
171
|
end
|
169
172
|
|
170
173
|
if __FILE__ == $0
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
174
|
+
if !(ARGV.size == 1 && ARGV[0] == 'noload')
|
175
|
+
ARGV[0..-1] = ['noload']
|
176
|
+
load(__FILE__)
|
177
|
+
else
|
178
|
+
require_relative '../location'
|
179
|
+
require_relative '../mock'
|
180
|
+
require_relative '../frame'
|
181
|
+
dbgr, cmd = MockDebugger::setup
|
182
|
+
cmd.proc.send('frame_initialize')
|
183
|
+
|
184
|
+
def run_cmd(cmd, args)
|
185
|
+
cmd.proc.instance_variable_set('@cmd_argstr', args[1..-1].join(' '))
|
186
|
+
cmd.run(args)
|
187
|
+
end
|
185
188
|
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
+
LineCache::cache(__FILE__)
|
190
|
+
run_cmd(cmd, [cmd.name])
|
191
|
+
run_cmd(cmd, [cmd.name, __FILE__ + ':10'])
|
189
192
|
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
193
|
+
def run_cmd2(cmd, args)
|
194
|
+
seps = '--' * 10
|
195
|
+
puts "%s %s %s" % [seps, args.join(' '), seps]
|
196
|
+
run_cmd(cmd,args)
|
197
|
+
end
|
195
198
|
|
196
199
|
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
+
load 'tmpdir.rb'
|
201
|
+
run_cmd2(cmd, %w(list tmpdir.rb 10))
|
202
|
+
run_cmd2(cmd, %w(list tmpdir.rb))
|
200
203
|
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
+
# cmd.proc.frame = sys._getframe()
|
205
|
+
# cmd.proc.setup()
|
206
|
+
# run_cmd2(['list'])
|
204
207
|
|
205
|
-
|
206
|
-
|
208
|
+
run_cmd2(cmd, %w(list .))
|
209
|
+
run_cmd2(cmd, %w(list 30))
|
207
210
|
|
208
|
-
|
211
|
+
# run_cmd2(['list', '9+1'])
|
209
212
|
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
+
run_cmd2(cmd, %w(list> 10))
|
214
|
+
run_cmd2(cmd, %w(list 3000))
|
215
|
+
run_cmd2(cmd, %w(list run_cmd2))
|
213
216
|
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
217
|
+
p = Proc.new do
|
218
|
+
|x,y| x + y
|
219
|
+
end
|
220
|
+
require 'thread_frame'
|
221
|
+
tf = RubyVM::Frame.current
|
222
|
+
cmd.proc.frame_setup(tf)
|
223
|
+
run_cmd2(cmd, %w(list p))
|
221
224
|
|
222
|
-
|
223
|
-
|
225
|
+
# Function from a file found via an instruction sequence
|
226
|
+
run_cmd2(cmd, %w(list Columnize.columnize))
|
224
227
|
|
225
|
-
|
226
|
-
|
228
|
+
# Use Class/method name. 15 isn't in the function - should this be okay?
|
229
|
+
run_cmd2(cmd, %W(#{cmd.name} Columnize.columnize 15))
|
227
230
|
|
228
|
-
|
229
|
-
|
231
|
+
# Start line and count, since 3 < 30
|
232
|
+
run_cmd2(cmd, %W(#{cmd.name} Columnize.columnize 30 3))
|
230
233
|
|
231
|
-
|
232
|
-
|
234
|
+
# Start line finish line
|
235
|
+
run_cmd2(cmd, %W(#{cmd.name} Columnize.columnize 40 50))
|
233
236
|
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
237
|
+
# puts '--' * 10
|
238
|
+
# run_cmd2([cmd.name, os.path.abspath(__file__)+':3', '4'])
|
239
|
+
# puts '--' * 10
|
240
|
+
# run_cmd2([cmd.name, os.path.abspath(__file__)+':3', '12-10'])
|
241
|
+
# run_cmd2([cmd.name, 'os.path:5'])
|
239
242
|
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
243
|
+
brkpt_cmd = cmd.proc.instance_variable_get('@commands')['break']
|
244
|
+
brkpt_cmd.run(['break'])
|
245
|
+
line = __LINE__
|
246
|
+
run_cmd2(cmd, [cmd.name, __LINE__.to_s])
|
244
247
|
|
245
|
-
|
246
|
-
|
248
|
+
disable_cmd = cmd.proc.instance_variable_get('@commands')['disable']
|
249
|
+
disable_cmd.run(['disable', '1'])
|
247
250
|
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
251
|
+
run_cmd2(cmd, [cmd.name, line.to_s])
|
252
|
+
run_cmd2(cmd, %W(#{cmd.name} run_cmd2))
|
253
|
+
run_cmd2(cmd, %W(#{cmd.name} run_cmd2))
|
254
|
+
run_cmd2(cmd, %W(#{cmd.name} @0))
|
252
255
|
end
|
253
256
|
end
|
data/trepanning.gemspec
CHANGED
@@ -10,15 +10,20 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.authors = ['R. Bernstein']
|
11
11
|
spec.date = Time.now
|
12
12
|
spec.description = <<-EOF
|
13
|
-
|
13
|
+
== Description
|
14
|
+
|
15
|
+
A gdb-like Ruby debugger with both high and low-level debugging support.
|
16
|
+
|
17
|
+
See https://github.com/rocky/rb-trepanning/wiki/Features for a list of features.
|
14
18
|
|
15
19
|
To provide the advanced features this version works only with a
|
16
|
-
patched MRI Ruby 1.9.3 runtime.
|
20
|
+
[patched MRI Ruby 1.9.3. See http://ruby-debugger-runtime.sourceforge.net/
|
17
21
|
|
18
|
-
|
19
|
-
|
22
|
+
This version works only with a patched version of Ruby 1.9.3
|
23
|
+
Ruby 2.1.5, look for a version that starts with 2.1.5
|
20
24
|
EOF
|
21
25
|
spec.add_dependency('rb-trace', '~> 0.5')
|
26
|
+
spec.add_dependency('rb-threadframe', '~> 0.41')
|
22
27
|
spec.add_dependency('columnize', '~> 0.9')
|
23
28
|
spec.add_dependency('redcarpet', '~> 3.2')
|
24
29
|
spec.add_dependency('coderay', '~> 1.1')
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trepanning
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.93.
|
4
|
+
version: 1.93.35
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-03-
|
12
|
+
date: 2015-03-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rb-trace
|
@@ -27,6 +27,22 @@ dependencies:
|
|
27
27
|
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '0.5'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rb-threadframe
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0.41'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0.41'
|
30
46
|
- !ruby/object:Gem::Dependency
|
31
47
|
name: columnize
|
32
48
|
requirement: !ruby/object:Gem::Requirement
|
@@ -107,17 +123,23 @@ dependencies:
|
|
107
123
|
- - ~>
|
108
124
|
- !ruby/object:Gem::Version
|
109
125
|
version: '0'
|
110
|
-
description: ! '
|
126
|
+
description: ! '== Description
|
127
|
+
|
128
|
+
|
129
|
+
A gdb-like Ruby debugger with both high and low-level debugging support.
|
130
|
+
|
131
|
+
|
132
|
+
See https://github.com/rocky/rb-trepanning/wiki/Features for a list of features.
|
111
133
|
|
112
134
|
|
113
135
|
To provide the advanced features this version works only with a
|
114
136
|
|
115
|
-
patched MRI Ruby 1.9.3 runtime.
|
137
|
+
[patched MRI Ruby 1.9.3. See http://ruby-debugger-runtime.sourceforge.net/
|
116
138
|
|
117
139
|
|
118
|
-
|
140
|
+
This version works only with a patched version of Ruby 1.9.3
|
119
141
|
|
120
|
-
|
142
|
+
Ruby 2.1.5, look for a version that starts with 2.1.5
|
121
143
|
|
122
144
|
'
|
123
145
|
email: rockyb@rubyforge.net
|
@@ -486,7 +508,7 @@ rdoc_options:
|
|
486
508
|
- --main
|
487
509
|
- README
|
488
510
|
- --title
|
489
|
-
- Trepan 1.93.
|
511
|
+
- Trepan 1.93.35 Documentation
|
490
512
|
require_paths:
|
491
513
|
- lib
|
492
514
|
required_ruby_version: !ruby/object:Gem::Requirement
|