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/CHANGES
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
Oct 27, 2011 (0.1.4)
|
2
|
+
|
3
|
+
- POSIX shell -x (long form: --trace) fixed
|
4
|
+
- Go with rdoc 2.4.2 now
|
5
|
+
- Improve documentation for "macro"
|
6
|
+
- show alias => show aliases
|
7
|
+
- correct info variables
|
8
|
+
- Add ruby-debug-base dependency
|
9
|
+
- Bugs fixed, code reorganized.
|
10
|
+
|
1
11
|
June 12, 2011 (0.1.3) Fleetwood release
|
2
12
|
|
3
13
|
First attempt at backport from trepanning.
|
data/ChangeLog
CHANGED
@@ -1,3 +1,279 @@
|
|
1
|
+
2011-10-15 rocky <rockyb@rubyforge.org>
|
2
|
+
|
3
|
+
* app/display.rb, processor/command/undisplay.rb: Sync with
|
4
|
+
rb-trepanning.
|
5
|
+
|
6
|
+
2011-10-14 rocky <rockyb@rubyforge.org>
|
7
|
+
|
8
|
+
I hate conflicted merges
|
9
|
+
|
10
|
+
2011-10-14 rocky <rockyb@rubyforge.org>
|
11
|
+
|
12
|
+
* app/display.rb, processor/command/disable.rb,
|
13
|
+
processor/command/display.rb, processor/command/enable.rb,
|
14
|
+
processor/command/set_subcmd/auto.rb, processor/display.rb: Sync
|
15
|
+
with rb-trepanning and rbx-trepanning although enable/disable
|
16
|
+
display numbers not supported yet.
|
17
|
+
|
18
|
+
2011-10-09 rocky <rockyb@rubyforge.org>
|
19
|
+
|
20
|
+
* processor/command/set_subcmd/auto.rb,
|
21
|
+
processor/command/set_subcmd/trace.rb,
|
22
|
+
processor/command/set_subcmd/trace_subcmd/print.rb: Regularize and
|
23
|
+
improve "set" help a little bit. Sync with rb-trepanning
|
24
|
+
|
25
|
+
2011-10-09 rocky <rockyb@rubyforge.org>
|
26
|
+
|
27
|
+
Merge branch 'master' of github.com:rocky/rb8-trepanning
|
28
|
+
|
29
|
+
2011-10-09 rocky <rockyb@rubyforge.org>
|
30
|
+
|
31
|
+
* app/options.rb, app/run.rb, bin/trepan8, lib/trepanning.rb,
|
32
|
+
processor.rb, processor/old-processor.rb, test/data/trace.cmd,
|
33
|
+
test/data/trace.right, test/integration/helper.rb,
|
34
|
+
test/integration/test-trace.rb: trepan8 --trace option (-x) works
|
35
|
+
again.
|
36
|
+
|
37
|
+
2011-09-27 rocky <rockyb@rubyforge.org>
|
38
|
+
|
39
|
+
* Rakefile, trepan8.gemspec: Go with rdoc > 2.4.2 now. Sigh
|
40
|
+
|
41
|
+
2011-09-27 rocky <rockyb@rubyforge.org>
|
42
|
+
|
43
|
+
* processor/command/macro.rb, test/unit/test-proc-location.rb:
|
44
|
+
Improve documentation for "macro". Remove a stray "require
|
45
|
+
'ruby-debug'".
|
46
|
+
|
47
|
+
2011-09-25 rocky <rockyb@rubyforge.org>
|
48
|
+
|
49
|
+
* processor/command/show_subcmd/alias.rb,
|
50
|
+
processor/command/show_subcmd/aliases.rb: show alias => show aliases
|
51
|
+
|
52
|
+
|
53
|
+
2011-09-25 rocky <rockyb@rubyforge.org>
|
54
|
+
|
55
|
+
* processor/command/finish.rb, processor/command/unalias.rb: Sync
|
56
|
+
with rbx-trepanning.
|
57
|
+
|
58
|
+
2011-09-25 rocky <rockyb@rubyforge.org>
|
59
|
+
|
60
|
+
* app/run.rb, processor/command/kill.rb,
|
61
|
+
processor/command/set_subcmd/different.rb,
|
62
|
+
processor/command/unalias.rb, test/unit/test-cmd-kill.rb: Misc
|
63
|
+
changes to sync with rb{,x}-trepanning
|
64
|
+
|
65
|
+
2011-08-28 rocky <rockyb@rubyforge.org>
|
66
|
+
|
67
|
+
* processor/command.rb, processor/command/alias.rb,
|
68
|
+
processor/command/backtrace.rb, processor/command/base/cmd.rb,
|
69
|
+
processor/command/base/subcmd.rb, processor/command/base/submgr.rb,
|
70
|
+
processor/command/base/subsubcmd.rb, processor/command/break.rb,
|
71
|
+
processor/command/catch.rb, processor/command/complete.rb,
|
72
|
+
processor/command/continue.rb, processor/command/directory.rb,
|
73
|
+
processor/command/disable.rb, processor/command/display.rb,
|
74
|
+
processor/command/edit.rb, processor/command/eval.rb,
|
75
|
+
processor/command/exit.rb, processor/command/finish.rb,
|
76
|
+
processor/command/frame.rb, processor/command/help.rb,
|
77
|
+
processor/command/kill.rb, processor/command/list.rb,
|
78
|
+
processor/command/macro.rb, processor/command/next.rb,
|
79
|
+
processor/command/parsetree.rb, processor/command/pp.rb,
|
80
|
+
processor/command/pr.rb, processor/command/ps.rb,
|
81
|
+
processor/command/restart.rb, processor/command/save.rb,
|
82
|
+
processor/command/shell.rb, processor/command/source.rb,
|
83
|
+
processor/command/step.rb, processor/command/tbreak.rb,
|
84
|
+
processor/command/unalias.rb, processor/command/undisplay.rb,
|
85
|
+
processor/command/up.rb, processor/old-command.rb,
|
86
|
+
processor/old-processor.rb, processor/subcmd.rb,
|
87
|
+
test/unit/test-base-cmd.rb: processor/command.rb ->
|
88
|
+
processor/old-command.rb processor/base/cmd.rb ->
|
89
|
+
processor/command.rb
|
90
|
+
|
91
|
+
2011-08-28 rocky <rockyb@rubyforge.org>
|
92
|
+
|
93
|
+
Merge branch 'master' of github.com:rocky/rb8-trepanning
|
94
|
+
|
95
|
+
2011-08-28 rocky <rockyb@rubyforge.org>
|
96
|
+
|
97
|
+
* interface.rb, interface/base_intf.rb, interface/script.rb,
|
98
|
+
interface/server.rb, interface/user.rb, io.rb, io/base_io.rb,
|
99
|
+
io/input.rb, io/null_output.rb, io/string_array.rb,
|
100
|
+
io/tcpclient.rb, io/tcpserver.rb, lib/trepanning.rb, processor.rb,
|
101
|
+
processor/command/base/subcmd.rb, processor/command/exit.rb,
|
102
|
+
processor/command/help.rb, processor/help.rb,
|
103
|
+
processor/location.rb, processor/main.rb, processor/mock.rb,
|
104
|
+
processor/msg.rb, processor/old-processor.rb,
|
105
|
+
processor/processor.rb, processor/subcmd.rb, processor/validate.rb,
|
106
|
+
test/unit/test-proc-eval.rb, test/unit/test-subcmd-help.rb: Partial
|
107
|
+
sync with rbx-trepanning: interface/base_intf.rb -> interface.rb
|
108
|
+
base_io -> io.rb processor/main.rb -> processor.b
|
109
|
+
|
110
|
+
2011-08-28 rocky <rockyb@rubyforge.org>
|
111
|
+
|
112
|
+
* lib/trepanning.rb, processor.rb,
|
113
|
+
processor/command/base/subcmd.rb, processor/command/exit.rb,
|
114
|
+
processor/command/help.rb, processor/help.rb,
|
115
|
+
processor/location.rb, processor/main.rb, processor/mock.rb,
|
116
|
+
processor/msg.rb, processor/old-processor.rb,
|
117
|
+
processor/processor.rb, processor/subcmd.rb, processor/validate.rb,
|
118
|
+
test/unit/test-proc-eval.rb, test/unit/test-subcmd-help.rb: Partial
|
119
|
+
sync with rbx-trepanning.
|
120
|
+
|
121
|
+
2011-08-14 rocky <rockyb@rubyforge.org>
|
122
|
+
|
123
|
+
* processor/command/kill.rb: See above
|
124
|
+
|
125
|
+
2011-08-14 rocky <rockyb@rubyforge.org>
|
126
|
+
|
127
|
+
* processor/command/kill.rb, test/unit/test-app-options.rb:
|
128
|
+
test-app-options.rb: testing help/version options was killing the
|
129
|
+
rest of the tests Speaking of killing.. add more robust kill
|
130
|
+
checking and fix an outright bug in name-to-number access.
|
131
|
+
|
132
|
+
2011-06-21 rocky <rockyb@rubyforge.org>
|
133
|
+
|
134
|
+
* app/run.rb: backticks work differently between 1.9.2 and 1.8.7?
|
135
|
+
Can't do an inspect on a string and have the shell drop the quotes.
|
136
|
+
|
137
|
+
|
138
|
+
2011-06-21 rocky <rockyb@rubyforge.org>
|
139
|
+
|
140
|
+
* app/run.rb, app/util.rb, processor/command/info_subcmd/files.rb:
|
141
|
+
Sync with rb-trepanning
|
142
|
+
|
143
|
+
2011-06-21 rocky <rockyb@rubyforge.org>
|
144
|
+
|
145
|
+
* processor/command/continue.rb: One more place we should be
|
146
|
+
checking for a valid Ruby program.
|
147
|
+
|
148
|
+
2011-06-21 rocky <rockyb@rubyforge.org>
|
149
|
+
|
150
|
+
* processor/command/base/cmd.rb, processor/command/break.rb,
|
151
|
+
processor/command/disable.rb, processor/command/eval.rb,
|
152
|
+
processor/command/up.rb: Test for syntactically-correct Ruby program
|
153
|
+
on the break command. DRY including util which is needed for
|
154
|
+
silencing already-defined constant messages.
|
155
|
+
|
156
|
+
2011-06-21 rocky <rockyb@rubyforge.org>
|
157
|
+
|
158
|
+
* app/display.rb, app/run.rb, lib/debugger.rb,
|
159
|
+
processor/command/info_subcmd/source.rb,
|
160
|
+
processor/command/info_subcmd/variables_subcmd/constant.rb,
|
161
|
+
test/unit/test-app-run.rb: "info source" should not try to look for
|
162
|
+
breakpoint line numbers if the source is syntactically invalid as is
|
163
|
+
the case for erb files. Other small changes.
|
164
|
+
|
165
|
+
2011-06-19 rocky <rockyb@rubyforge.org>
|
166
|
+
|
167
|
+
* processor/command/info_subcmd/variables.rb,
|
168
|
+
processor/command/info_subcmd/variables_subcmd/class.rb,
|
169
|
+
processor/command/info_subcmd/variables_subcmd/constant.rb,
|
170
|
+
processor/help.rb, processor/msg.rb, processor/subcmd.rb: Add "info
|
171
|
+
var constant". Correct abbreviation lookup. Sync with
|
172
|
+
rbx-trepanning.
|
173
|
+
|
174
|
+
2011-06-19 rocky <rockyb@rubyforge.org>
|
175
|
+
|
176
|
+
* app/irb.rb, processor/command/enable.rb: Silence another
|
177
|
+
constant-init wraning. Sync with rbx-trepanning.
|
178
|
+
|
179
|
+
2011-06-18 rocky <rockyb@rubyforge.org>
|
180
|
+
|
181
|
+
* app/irb.rb, processor/command/shell.rb: Fix bug in running 'dbgr'
|
182
|
+
inside irb.
|
183
|
+
|
184
|
+
2011-06-18 rocky <rockyb@rubyforge.org>
|
185
|
+
|
186
|
+
* app/irb.rb,
|
187
|
+
processor/command/info_subcmd/variables_subcmd/class.rb,
|
188
|
+
processor/command/info_subcmd/variables_subcmd/globals.rb,
|
189
|
+
processor/command/info_subcmd/variables_subcmd/instance.rb,
|
190
|
+
processor/command/info_subcmd/variables_subcmd/locals.rb,
|
191
|
+
processor/command/shell.rb, processor/msg.rb: Colorize "info
|
192
|
+
variable" display and show class name in header.
|
193
|
+
|
194
|
+
2011-06-18 rocky <rockyb@rubyforge.org>
|
195
|
+
|
196
|
+
* processor/command/help.rb,
|
197
|
+
processor/command/info_subcmd/variables.rb,
|
198
|
+
processor/command/info_subcmd/variables_subcmd/globals.rb,
|
199
|
+
processor/mock.rb: Small changes.
|
200
|
+
|
201
|
+
2011-06-18 rocky <rockyb@rubyforge.org>
|
202
|
+
|
203
|
+
* processor/command/info_subcmd/variables.rb,
|
204
|
+
processor/command/info_subcmd/variables_subcmd/locals.rb,
|
205
|
+
trepan8.gemspec: Correct info variables.
|
206
|
+
|
207
|
+
2011-06-18 rocky <rockyb@rubyforge.org>
|
208
|
+
|
209
|
+
* processor/command/base/subsubmgr.rb,
|
210
|
+
processor/command/info_subcmd/globals.rb,
|
211
|
+
processor/command/info_subcmd/iv.rb,
|
212
|
+
processor/command/info_subcmd/locals.rb,
|
213
|
+
processor/command/info_subcmd/variables_subcmd/.gitignore,
|
214
|
+
processor/command/info_subcmd/variables_subcmd/class.rb,
|
215
|
+
processor/command/info_subcmd/variables_subcmd/globals.rb,
|
216
|
+
processor/command/info_subcmd/variables_subcmd/instance.rb,
|
217
|
+
processor/command/info_subcmd/variables_subcmd/locals.rb: Add "info
|
218
|
+
variables". Sync with rb-trepanning.
|
219
|
+
|
220
|
+
2011-06-18 rocky <rockyb@rubyforge.org>
|
221
|
+
|
222
|
+
* trepan8.gemspec: Add ruby-debug-base dependency. Issue #1.
|
223
|
+
|
224
|
+
2011-06-18 rocky <rockyb@rubyforge.org>
|
225
|
+
|
226
|
+
* app/util.rb, processor/command/disable.rb,
|
227
|
+
processor/command/down.rb, processor/command/enable.rb,
|
228
|
+
processor/command/info.rb,
|
229
|
+
processor/command/info_subcmd/globals.rb,
|
230
|
+
processor/command/info_subcmd/iv.rb,
|
231
|
+
processor/command/info_subcmd/locals.rb, processor/command/up.rb:
|
232
|
+
Add 'info iv' for instance variables. Use better way to suppress
|
233
|
+
warnings.
|
234
|
+
|
235
|
+
2011-06-18 rocky <rockyb@rubyforge.org>
|
236
|
+
|
237
|
+
* data/perldb.bindings, processor/command/alias.rb,
|
238
|
+
processor/command/list.rb, processor/main.rb,
|
239
|
+
test/unit/test-io-tcpserver.rb: alias.rb: cat is an alias for
|
240
|
+
"list". perldb.bindings first attempt at perldb bindings.
|
241
|
+
test-io-tcpserver.rb: skip test if we can't open socket.
|
242
|
+
|
243
|
+
2011-06-16 rocky <rockyb@rubyforge.org>
|
244
|
+
|
245
|
+
* app/irb.rb, app/options.rb, processor/command/shell.rb: Suppress
|
246
|
+
rb-readline dup constant warnings.
|
247
|
+
|
248
|
+
2011-06-16 rocky <rockyb@rubyforge.org>
|
249
|
+
|
250
|
+
* app/irb.rb, processor/command/shell.rb, test/unit/cmd-helper.rb,
|
251
|
+
test/unit/test-proc-location.rb: Get unit test test-proc-location
|
252
|
+
working. There is weirdness here where things are getting required
|
253
|
+
multiple times.
|
254
|
+
|
255
|
+
2011-06-15 rocky <rockyb@rubyforge.org>
|
256
|
+
|
257
|
+
* app/irb.rb, processor/command/step.rb, processor/hook.rb,
|
258
|
+
processor/running.rb: Had broken "autoirb" when I renamed "irb" to
|
259
|
+
"shell". Make a little more like other trepanning debuggers.
|
260
|
+
|
261
|
+
2011-06-12 rocky <rockyb@rubyforge.org>
|
262
|
+
|
263
|
+
* processor/command/set_subcmd/trace.rb,
|
264
|
+
processor/command/set_subcmd/trace_subcmd/buffer.rb,
|
265
|
+
processor/command/set_subcmd/trace_subcmd/print.rb,
|
266
|
+
processor/command/show_subcmd/trace.rb,
|
267
|
+
processor/command/show_subcmd/trace_subcmd/buffer.rb,
|
268
|
+
processor/command/show_subcmd/trace_subcmd/print.rb,
|
269
|
+
trepan8.gemspec: Wrong package name and forgot to add set/show trace
|
270
|
+
files.
|
271
|
+
|
272
|
+
2011-06-11 rocky <rockyb@rubyforge.org>
|
273
|
+
|
274
|
+
* ChangeLog, Rakefile, app/options.rb: Get ready for 0.1.3 release.
|
275
|
+
|
276
|
+
|
1
277
|
2011-06-11 rocky <rockyb@rubyforge.org>
|
2
278
|
|
3
279
|
* Rakefile: I run rubinius on this too often.
|
data/Makefile
ADDED
data/Rakefile
CHANGED
@@ -10,7 +10,7 @@ def gemspec
|
|
10
10
|
@gemspec ||= eval(File.read(Gemspec_filename), binding, Gemspec_filename)
|
11
11
|
end
|
12
12
|
|
13
|
-
require '
|
13
|
+
require 'rdoc/task'
|
14
14
|
desc 'Build the gem'
|
15
15
|
task :package=>:gem
|
16
16
|
task :gem=>:gemspec do
|
@@ -177,7 +177,6 @@ task :gemspec do
|
|
177
177
|
end
|
178
178
|
|
179
179
|
# --------- RDoc Documentation ------
|
180
|
-
require 'rake/rdoctask'
|
181
180
|
desc 'Generate rdoc documentation'
|
182
181
|
Rake::RDocTask.new('rdoc') do |rdoc|
|
183
182
|
rdoc.rdoc_dir = 'doc'
|
data/app/display.rb
CHANGED
@@ -19,6 +19,13 @@ class DisplayMgr
|
|
19
19
|
@list = []
|
20
20
|
end
|
21
21
|
|
22
|
+
def [](index)
|
23
|
+
raise TypeError,
|
24
|
+
"index #{index} should be a Fixnum, is #{index.class}" unless
|
25
|
+
index.is_a?(Fixnum)
|
26
|
+
@list.detect {|disp| disp.number == index }
|
27
|
+
end
|
28
|
+
|
22
29
|
def add(frame, arg, fmt=nil)
|
23
30
|
return nil unless frame
|
24
31
|
begin
|
@@ -83,6 +90,18 @@ Num Enb Expression"
|
|
83
90
|
end
|
84
91
|
false
|
85
92
|
end
|
93
|
+
|
94
|
+
def max
|
95
|
+
@list.map{|disp| disp.number}.max
|
96
|
+
end
|
97
|
+
|
98
|
+
def nums
|
99
|
+
@list.map{|disp| disp.number}
|
100
|
+
end
|
101
|
+
|
102
|
+
def size
|
103
|
+
@list.size
|
104
|
+
end
|
86
105
|
end
|
87
106
|
|
88
107
|
class Display
|
@@ -98,6 +117,22 @@ class Display
|
|
98
117
|
@number = number
|
99
118
|
end
|
100
119
|
|
120
|
+
def disable
|
121
|
+
@enabled = false
|
122
|
+
end
|
123
|
+
|
124
|
+
def disabled?
|
125
|
+
!@enabled
|
126
|
+
end
|
127
|
+
|
128
|
+
def enable
|
129
|
+
@enabled = true
|
130
|
+
end
|
131
|
+
|
132
|
+
def enabled?
|
133
|
+
@enabled
|
134
|
+
end
|
135
|
+
|
101
136
|
def to_s(frame)
|
102
137
|
return 'No symbol "' + @arg + '" in current context.' unless frame
|
103
138
|
|
@@ -119,10 +154,13 @@ class Display
|
|
119
154
|
what += @arg if @arg
|
120
155
|
'%3d: %s' % [@number, what]
|
121
156
|
end
|
157
|
+
|
122
158
|
end
|
123
159
|
|
124
160
|
if __FILE__ == $0
|
125
161
|
# Demo it.
|
162
|
+
require 'rubygems'
|
163
|
+
require 'ruby-debug-base'; Debugger.start
|
126
164
|
mgr = DisplayMgr.new
|
127
165
|
|
128
166
|
def print_display(mgr)
|
@@ -130,10 +168,12 @@ if __FILE__ == $0
|
|
130
168
|
puts '=' * 40
|
131
169
|
end
|
132
170
|
|
133
|
-
frame =
|
171
|
+
frame = Debugger.current_context
|
134
172
|
|
135
173
|
x = 1
|
136
174
|
mgr.add(frame, 'x > 1')
|
175
|
+
puts "Number of displays %s" % mgr.size
|
176
|
+
puts "Max Number %d" % mgr.max
|
137
177
|
print_display(mgr)
|
138
178
|
|
139
179
|
mgr.enable_disable(1, false)
|
data/app/irb.rb
CHANGED
@@ -1,74 +1,80 @@
|
|
1
|
-
# Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
|
1
|
+
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
2
2
|
# This code comes more or less from ruby-debug.
|
3
|
-
require '
|
3
|
+
require 'rubygems'; require 'require_relative'
|
4
|
+
require_relative 'util'
|
5
|
+
|
6
|
+
Trepan::Util.suppress_warnings {
|
7
|
+
require 'irb'
|
8
|
+
}
|
9
|
+
|
4
10
|
module IRB # :nodoc:
|
5
11
|
module ExtendCommand # :nodoc:
|
6
12
|
# FIXME: should we read these out of a directory to
|
7
13
|
# make this more user-customizable?
|
8
14
|
|
9
|
-
|
10
|
-
class DebuggerResumeCommand
|
11
|
-
def self.execute(conf, *opts)
|
12
|
-
name =
|
13
|
-
if self.name =~ /IRB::ExtendCommand::(\S+)/
|
14
|
-
$1.downcase
|
15
|
-
else
|
16
|
-
'unknown'
|
17
|
-
end
|
18
|
-
$trepan_args = opts
|
19
|
-
$trepan_command =
|
20
|
-
if $trepan_irb_statements
|
21
|
-
$trepan_irb_statements
|
22
|
-
else
|
23
|
-
([name] + opts).join(' ')
|
24
|
-
end
|
15
|
+
unless defined? TContinue
|
25
16
|
|
26
|
-
|
17
|
+
# A base command class that resume execution
|
18
|
+
class TrepanResumeCommand
|
19
|
+
def self.execute(conf, *opts)
|
20
|
+
name =
|
21
|
+
if self.name =~ /IRB::ExtendCommand::(\S+)/
|
22
|
+
$1[1..-1].downcase
|
23
|
+
else
|
24
|
+
'unknown'
|
25
|
+
end
|
26
|
+
$trepan_args = opts
|
27
|
+
$trepan_command =
|
28
|
+
if $trepan_irb_statements
|
29
|
+
$trepan_irb_statements
|
30
|
+
else
|
31
|
+
([name] + opts).join(' ')
|
32
|
+
end
|
33
|
+
|
34
|
+
throw :IRB_EXIT, name.to_sym
|
35
|
+
end
|
27
36
|
end
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
class
|
33
|
-
class
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
dbg_cmdproc = conf.workspace.instance_variable_get('@dbg_cmdproc')
|
50
|
-
dbg_cmdproc.run_command($trepan_command)
|
37
|
+
|
38
|
+
class TContinue < TrepanResumeCommand ; end
|
39
|
+
class TFinish < TrepanResumeCommand ; end
|
40
|
+
class TNext < TrepanResumeCommand ; end
|
41
|
+
class TQuit < TrepanResumeCommand ; end
|
42
|
+
class TStep < TrepanResumeCommand ; end
|
43
|
+
|
44
|
+
# Issues a comamnd to the debugger without continuing
|
45
|
+
# execution.
|
46
|
+
class TDbgr
|
47
|
+
def self.execute(conf, *opts)
|
48
|
+
$trepan_command =
|
49
|
+
if opts.size == 1 && opts[0].is_a?(String)
|
50
|
+
$trepan_args = opts[0]
|
51
|
+
else
|
52
|
+
opts.join(' ')
|
53
|
+
end
|
54
|
+
# dbg_cmdproc = conf.workspace.instance_variable_get('@dbg_cmdproc')
|
55
|
+
# dbg_cmdproc.run_command($trepan_command)
|
56
|
+
$trepan_cmdproc.run_command($trepan_command)
|
57
|
+
end
|
51
58
|
end
|
52
59
|
end
|
53
|
-
|
54
60
|
end
|
55
61
|
if defined?(ExtendCommandBundle)
|
56
62
|
# New irb Commands which are the same name as their debugger
|
57
63
|
# counterpart
|
58
|
-
%w(
|
59
|
-
command = name.downcase
|
64
|
+
%w(TDbgr TFinish TStep).each do |name|
|
65
|
+
command = name[1..-1].downcase
|
60
66
|
sym = name.to_sym
|
61
67
|
ExtendCommandBundle.def_extend_command command, sym
|
62
68
|
end
|
63
69
|
# New irb Commands which are the slightly different from their
|
64
70
|
# debugger counterpart
|
65
|
-
[['cont', :
|
66
|
-
['ne', :
|
67
|
-
['q', :
|
71
|
+
[['cont', :TContinue],
|
72
|
+
['ne', :TNext],
|
73
|
+
['q', :TQuit]].each do |command, sym|
|
68
74
|
ExtendCommandBundle.def_extend_command command, sym
|
69
75
|
end
|
70
76
|
end
|
71
|
-
|
77
|
+
|
72
78
|
def self.start_session(binding, dbg_cmdproc, conf={})
|
73
79
|
unless @__initialized
|
74
80
|
|
data/app/options.rb
CHANGED
@@ -9,7 +9,7 @@ module Trepan
|
|
9
9
|
require 'rubygems'; require 'require_relative'
|
10
10
|
require_relative 'default'
|
11
11
|
|
12
|
-
VERSION = '0.1.
|
12
|
+
VERSION = '0.1.4' unless defined? Trepan::VERSION
|
13
13
|
PROGRAM = 'trepan8' unless defined? Trepan::PROGRAM
|
14
14
|
|
15
15
|
module_function
|
@@ -163,7 +163,8 @@ EOB
|
|
163
163
|
options[:wait] = true
|
164
164
|
end
|
165
165
|
opts.on('-x', '--trace', 'Turn on line tracing') do
|
166
|
-
options[:
|
166
|
+
options[:traceprint] = true
|
167
|
+
options[:nx] = true
|
167
168
|
end
|
168
169
|
opts.separator ''
|
169
170
|
opts.on_tail('-?', '--help', 'Show this message') do
|
data/app/run.rb
CHANGED
@@ -10,21 +10,24 @@ module Trepan
|
|
10
10
|
# The caller must ensure that ARGV is set up to remove any debugger
|
11
11
|
# arguments or things that the debugged program isn't supposed to
|
12
12
|
# see. FIXME: Should we make ARGV an explicit parameter?
|
13
|
-
|
14
13
|
def debug_program(ruby_path, options)
|
15
14
|
# Make sure Ruby script syntax checks okay.
|
16
15
|
# Otherwise we get a load message that looks like trepan8 has
|
17
16
|
# a problem.
|
18
|
-
|
19
|
-
|
17
|
+
|
18
|
+
output = ruby_syntax_errors(Trepan::PROG_SCRIPT.inspect)
|
19
|
+
if output
|
20
20
|
puts output
|
21
21
|
exit $?.exitstatus
|
22
22
|
end
|
23
23
|
|
24
|
-
|
24
|
+
cmdproc = Debugger.handler.cmdproc
|
25
|
+
%w(highlight basename traceprint).each do |opt|
|
25
26
|
opt = opt.to_sym
|
26
|
-
|
27
|
+
cmdproc.settings[opt] = options[opt]
|
27
28
|
end
|
29
|
+
cmdproc.unconditional_prehooks.insert_if_new(-1, *cmdproc.trace_hook) if
|
30
|
+
options[:traceprint]
|
28
31
|
|
29
32
|
# Record where we are we can know if the call stack has been
|
30
33
|
# truncated or not.
|
@@ -44,8 +47,9 @@ module Trepan
|
|
44
47
|
# Do a shell-like path lookup for prog_script and return the results.
|
45
48
|
# If we can't find anything return prog_script.
|
46
49
|
def whence_file(prog_script)
|
47
|
-
if prog_script.
|
48
|
-
# Don't search since this name has path
|
50
|
+
if prog_script.start_with?(File::SEPARATOR) || prog_script.start_with?('.')
|
51
|
+
# Don't search since this name has path is explicitly absolute or
|
52
|
+
# relative.
|
49
53
|
return prog_script
|
50
54
|
end
|
51
55
|
for dirname in ENV['PATH'].split(File::PATH_SEPARATOR) do
|
@@ -55,6 +59,14 @@ module Trepan
|
|
55
59
|
# Failure
|
56
60
|
return prog_script
|
57
61
|
end
|
62
|
+
|
63
|
+
def ruby_syntax_errors(prog_script)
|
64
|
+
output = `#{RbConfig.ruby} -c #{prog_script} 2>&1`
|
65
|
+
if $?.exitstatus != 0 and RUBY_PLATFORM !~ /mswin/
|
66
|
+
return output
|
67
|
+
end
|
68
|
+
return nil
|
69
|
+
end
|
58
70
|
end
|
59
71
|
|
60
72
|
# Path name of Ruby interpreter we were invoked with. Is part of
|
@@ -71,4 +83,10 @@ if __FILE__ == $0
|
|
71
83
|
puts whence_file('irb')
|
72
84
|
puts whence_file('probably-does-not-exist')
|
73
85
|
puts RbConfig.ruby
|
86
|
+
puts "#{__FILE__} is syntactically correct" unless
|
87
|
+
ruby_syntax_errors(__FILE__)
|
88
|
+
readme = File.join(File.dirname(__FILE__), '..', 'README.textile')
|
89
|
+
puts "#{readme} is not syntactically correct" if
|
90
|
+
ruby_syntax_errors(readme)
|
91
|
+
|
74
92
|
end
|
data/app/util.rb
CHANGED
@@ -45,6 +45,16 @@ module Trepan
|
|
45
45
|
end
|
46
46
|
return text
|
47
47
|
end
|
48
|
+
|
49
|
+
# Suppress warnings. The main one we encounter is "already initialized
|
50
|
+
# constant" because perhaps another version readline has done that already.
|
51
|
+
def suppress_warnings
|
52
|
+
original_verbosity = $VERBOSE
|
53
|
+
$VERBOSE = nil
|
54
|
+
result = yield
|
55
|
+
$VERBOSE = original_verbosity
|
56
|
+
return result
|
57
|
+
end
|
48
58
|
end
|
49
59
|
end
|
50
60
|
|
@@ -55,7 +65,15 @@ if __FILE__ == $0
|
|
55
65
|
puts safe_repr(string, 17)
|
56
66
|
puts safe_repr(string.inspect, 17)
|
57
67
|
puts safe_repr(string.inspect, 17, '')
|
58
|
-
|
68
|
+
# ------------------------------------
|
69
|
+
# extract_expression
|
70
|
+
['if condition("if")',
|
71
|
+
'until until_termination',
|
72
|
+
'return return_value',
|
73
|
+
'nothing_to_be.done'
|
74
|
+
].each do |stmt|
|
75
|
+
puts extract_expression stmt
|
76
|
+
end
|
59
77
|
|
60
78
|
list = %w(disassemble disable distance up)
|
61
79
|
p list
|
data/bin/trepan8
CHANGED
@@ -0,0 +1,17 @@
|
|
1
|
+
# Aliases to simulate some of the Perl debugger command set
|
2
|
+
alias = alias
|
3
|
+
alias R restart
|
4
|
+
alias b break
|
5
|
+
alias c continue
|
6
|
+
alias f list
|
7
|
+
alias n next
|
8
|
+
alias p pr
|
9
|
+
alias q quit
|
10
|
+
alias s step
|
11
|
+
alias v list
|
12
|
+
macro - Proc.new{|*args| "list -"}
|
13
|
+
macro E Proc.new{|*args| "info thread"}
|
14
|
+
macro L Proc.new{|*args| "info break"}
|
15
|
+
macro T Proc.new{|*args| "info stack"}
|
16
|
+
macro l Proc.new{|*args| "list>"}
|
17
|
+
macro r Proc.new{|*args| %w(finish step)}
|