rbx-trepanning 0.0.4-universal-rubinius-1.2 → 0.0.6-universal-rubinius-1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (102) hide show
  1. data/ChangeLog +682 -0
  2. data/NEWS +19 -0
  3. data/README.textile +8 -9
  4. data/Rakefile +8 -8
  5. data/app/complete.rb +52 -0
  6. data/app/complete.rbc +1288 -0
  7. data/app/irb.rb +1 -2
  8. data/app/irb.rbc +55 -72
  9. data/app/llvm.rbc +780 -878
  10. data/app/method.rb +1 -1
  11. data/app/method.rbc +31 -35
  12. data/app/method_name.rbc +2467 -0
  13. data/app/options.rb +7 -24
  14. data/app/options.rbc +238 -132
  15. data/app/rbx-llvm.rbc +2478 -0
  16. data/app/util.rb +3 -3
  17. data/app/util.rbc +23 -27
  18. data/bin/trepanx +4 -3
  19. data/bin/trepanx.compiled.rbc +42 -32
  20. data/data/irbrc +41 -0
  21. data/data/irbrc.compiled.rbc +640 -0
  22. data/interface/base_intf.rb +9 -5
  23. data/interface/base_intf.rbc +200 -146
  24. data/interface/comcodes.rb +10 -8
  25. data/interface/comcodes.rbc +68 -26
  26. data/interface/script.rbc +21 -9
  27. data/interface/user.rb +74 -8
  28. data/interface/user.rbc +1702 -156
  29. data/io/input.rb +37 -14
  30. data/io/input.rbc +869 -320
  31. data/io/tcpclient.rb +7 -1
  32. data/io/tcpclient.rbc +205 -113
  33. data/io/tcpfns.rb +5 -3
  34. data/io/tcpfns.rbc +82 -40
  35. data/io/tcpserver.rb +13 -10
  36. data/io/tcpserver.rbc +236 -183
  37. data/lib/trepanning.rb +62 -21
  38. data/lib/trepanning.rbc +1304 -874
  39. data/lib/{trepanning.rb.orig → trepanning2.rb} +12 -4
  40. data/processor/breakpoint.rb +4 -1
  41. data/processor/command/base/cmd.rb +48 -3
  42. data/processor/command/base/subcmd.rb +2 -1
  43. data/processor/command/base/submgr.rb +23 -20
  44. data/processor/command/base/subsubmgr.rb +13 -2
  45. data/processor/command/complete.rb +7 -17
  46. data/processor/command/continue.rb +19 -11
  47. data/processor/command/disassemble.rb +39 -12
  48. data/processor/command/eval.rb +23 -5
  49. data/processor/command/help.rb +60 -6
  50. data/processor/command/info_subcmd/{file.rb → files.rb} +76 -18
  51. data/processor/command/info_subcmd/line.rb +86 -0
  52. data/processor/command/info_subcmd/program.rb +2 -11
  53. data/processor/command/info_subcmd/ruby.rb +62 -0
  54. data/processor/command/info_subcmd/variables.rb +7 -0
  55. data/processor/command/irb.rb +39 -7
  56. data/processor/command/macro.rb +76 -0
  57. data/processor/command/set_subcmd/confirm.rb +24 -0
  58. data/processor/command/set_subcmd/max.rb +4 -5
  59. data/processor/command/show.rb +11 -0
  60. data/processor/command/show_subcmd/auto.rb +1 -0
  61. data/processor/command/show_subcmd/basename.rb +1 -2
  62. data/processor/command/show_subcmd/confirm.rb +18 -0
  63. data/processor/command/show_subcmd/max.rb +0 -2
  64. data/processor/command/source.rb +0 -1
  65. data/processor/default.rb +2 -0
  66. data/processor/disassemble.rb +1 -0
  67. data/processor/load_cmds.rb +104 -20
  68. data/processor/location.rb +11 -12
  69. data/processor/main.rb +10 -6
  70. data/processor/mock.rb +6 -2
  71. data/processor/stepping.rb +1 -4
  72. data/processor/subcmd.rb +3 -2
  73. data/processor/validate.rb +3 -3
  74. data/sample/list-terminal-colors.rbc +158 -4
  75. data/sample/rocky-trepanx-colors.rb +15 -7
  76. data/sample/rocky-trepanx-colors.rbc +530 -0
  77. data/test/data/quit2.cmd +6 -0
  78. data/test/data/quit2.right +3 -0
  79. data/test/data/step-bug.cmd +11 -0
  80. data/test/data/step-bug.right +3 -0
  81. data/test/example/step-bug.rb +14 -0
  82. data/test/integration/helper.rb +1 -1
  83. data/test/integration/skip-test-step-bug.rb +17 -0
  84. data/test/integration/test-quit.rb +11 -0
  85. data/test/unit/test-app-util.rb +0 -1
  86. data/test/unit/test-base-cmd.rb +47 -0
  87. data/test/unit/test-base-subcmd.rb +2 -2
  88. data/test/unit/test-base-submgr.rb +24 -0
  89. data/test/unit/test-cmd-help.rb +4 -0
  90. data/test/unit/test-completion.rb +38 -0
  91. data/test/unit/test-intf-user.rb +2 -2
  92. data/test/unit/test-io-tcpclient.rb +3 -2
  93. data/test/unit/test-proc-eval.rb +1 -1
  94. data/test/unit/test-proc-load_cmds.rb +9 -0
  95. data/test/unit/test-subcmd-help.rb +1 -5
  96. metadata +182 -167
  97. data/app/options.rb.orig +0 -154
  98. data/bin/trepan.orig +0 -0
  99. data/bin/trepan.rej +0 -11
  100. data/lib/trepanning.rb.rej +0 -11
  101. data/sample/rocky-dot-trepanrc.orig +0 -0
  102. data/sample/rocky-dot-trepanrc.rej +0 -11
@@ -6,13 +6,15 @@ module Trepanning
6
6
  # Most of these go from debugged process to front-end
7
7
  # client interface. COMMAND goes the other way.
8
8
  module RemoteCommunication
9
- PRINT = '.'
10
- COMMAND = 'C'
11
- CONFIRM_TRUE = 'Y'
12
- CONFIRM_FALSE = 'N'
13
- CONFIRM_REPLY = '?'
14
- QUIT = 'q'
15
- PROMPT = 'p'
16
- RESTART = 'r'
9
+ unless defined?(PRINT)
10
+ PRINT = '.'
11
+ COMMAND = 'C'
12
+ CONFIRM_TRUE = 'Y'
13
+ CONFIRM_FALSE = 'N'
14
+ CONFIRM_REPLY = '?'
15
+ QUIT = 'q'
16
+ PROMPT = 'p'
17
+ RESTART = 'r'
18
+ end
17
19
  end
18
20
  end
@@ -123,27 +123,49 @@ x
123
123
  19
124
124
  RemoteCommunication
125
125
  i
126
- 82
126
+ 114
127
127
  5
128
128
  66
129
- 65
130
- 7
129
+ 26
130
+ 93
131
+ 0
132
+ 15
133
+ 29
134
+ 17
131
135
  0
132
136
  7
137
+ 0
138
+ 98
133
139
  1
134
- 64
135
- 49
136
- 2
137
- 2
140
+ 1
141
+ 30
142
+ 8
143
+ 23
144
+ 25
145
+ 92
146
+ 0
147
+ 27
148
+ 8
149
+ 28
138
150
  15
151
+ 7
152
+ 2
153
+ 8
154
+ 29
155
+ 1
156
+ 9
157
+ 34
158
+ 1
159
+ 8
160
+ 113
139
161
  65
140
162
  7
141
- 3
163
+ 0
142
164
  7
143
- 4
165
+ 3
144
166
  64
145
167
  49
146
- 2
168
+ 4
147
169
  2
148
170
  15
149
171
  65
@@ -153,7 +175,7 @@ i
153
175
  6
154
176
  64
155
177
  49
156
- 2
178
+ 4
157
179
  2
158
180
  15
159
181
  65
@@ -163,7 +185,7 @@ i
163
185
  8
164
186
  64
165
187
  49
166
- 2
188
+ 4
167
189
  2
168
190
  15
169
191
  65
@@ -173,7 +195,7 @@ i
173
195
  10
174
196
  64
175
197
  49
176
- 2
198
+ 4
177
199
  2
178
200
  15
179
201
  65
@@ -183,7 +205,7 @@ i
183
205
  12
184
206
  64
185
207
  49
186
- 2
208
+ 4
187
209
  2
188
210
  15
189
211
  65
@@ -193,7 +215,7 @@ i
193
215
  14
194
216
  64
195
217
  49
196
- 2
218
+ 4
197
219
  2
198
220
  15
199
221
  65
@@ -203,11 +225,21 @@ i
203
225
  16
204
226
  64
205
227
  49
228
+ 4
206
229
  2
230
+ 15
231
+ 65
232
+ 7
233
+ 17
234
+ 7
235
+ 18
236
+ 64
237
+ 49
238
+ 4
207
239
  2
208
240
  11
209
241
  I
210
- 3
242
+ 4
211
243
  I
212
244
  0
213
245
  I
@@ -216,10 +248,16 @@ I
216
248
  0
217
249
  n
218
250
  p
219
- 17
251
+ 19
220
252
  x
221
253
  5
222
254
  PRINT
255
+ x
256
+ 16
257
+ vm_const_defined
258
+ s
259
+ 8
260
+ constant
223
261
  s
224
262
  1
225
263
  .
@@ -269,41 +307,45 @@ s
269
307
  1
270
308
  r
271
309
  p
272
- 17
310
+ 19
273
311
  I
274
312
  2
275
313
  I
276
314
  9
277
315
  I
278
- c
316
+ 22
279
317
  I
280
318
  a
281
319
  I
282
- 16
320
+ 2c
283
321
  I
284
322
  b
285
323
  I
286
- 20
324
+ 36
287
325
  I
288
326
  c
289
327
  I
290
- 2a
328
+ 40
291
329
  I
292
330
  d
293
331
  I
294
- 34
332
+ 4a
295
333
  I
296
334
  e
297
335
  I
298
- 3e
336
+ 54
299
337
  I
300
338
  f
301
339
  I
302
- 48
340
+ 5e
303
341
  I
304
342
  10
305
343
  I
306
- 52
344
+ 68
345
+ I
346
+ 11
347
+ I
348
+ 72
307
349
  x
308
350
  61
309
351
  /home/rocky-rvm/.rvm/src/rbx-trepanning/interface/comcodes.rb
data/interface/script.rbc CHANGED
@@ -704,9 +704,9 @@ x
704
704
  10
705
705
  initialize
706
706
  p
707
- 23
707
+ 25
708
708
  I
709
- 0
709
+ -1
710
710
  I
711
711
  15
712
712
  I
@@ -734,6 +734,10 @@ I
734
734
  I
735
735
  1d
736
736
  I
737
+ 56
738
+ I
739
+ 1c
740
+ I
737
741
  59
738
742
  I
739
743
  1e
@@ -809,7 +813,7 @@ close
809
813
  p
810
814
  5
811
815
  I
812
- 0
816
+ -1
813
817
  I
814
818
  26
815
819
  I
@@ -866,7 +870,7 @@ x
866
870
  p
867
871
  5
868
872
  I
869
- 0
873
+ -1
870
874
  I
871
875
  2f
872
876
  I
@@ -1050,9 +1054,9 @@ x
1050
1054
  5
1051
1055
  raise
1052
1056
  p
1053
- 17
1057
+ 21
1054
1058
  I
1055
- 0
1059
+ -1
1056
1060
  I
1057
1061
  35
1058
1062
  I
@@ -1072,10 +1076,18 @@ I
1072
1076
  I
1073
1077
  3b
1074
1078
  I
1079
+ 2a
1080
+ I
1081
+ 3a
1082
+ I
1075
1083
  30
1076
1084
  I
1077
1085
  3c
1078
1086
  I
1087
+ 40
1088
+ I
1089
+ 39
1090
+ I
1079
1091
  43
1080
1092
  I
1081
1093
  40
@@ -1130,7 +1142,7 @@ p
1130
1142
  p
1131
1143
  3
1132
1144
  I
1133
- 0
1145
+ -1
1134
1146
  I
1135
1147
  46
1136
1148
  I
@@ -1275,7 +1287,7 @@ msg
1275
1287
  p
1276
1288
  17
1277
1289
  I
1278
- 0
1290
+ -1
1279
1291
  I
1280
1292
  4a
1281
1293
  I
@@ -1446,7 +1458,7 @@ raise
1446
1458
  p
1447
1459
  11
1448
1460
  I
1449
- 0
1461
+ -1
1450
1462
  I
1451
1463
  59
1452
1464
  I
data/interface/user.rb CHANGED
@@ -1,5 +1,5 @@
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
  # Interface when communicating with the user in the same process as
5
5
  # the debugged program.
@@ -10,21 +10,34 @@ require 'rubygems'; require 'require_relative'
10
10
  require_relative 'base_intf'
11
11
  require_relative '../io/input'
12
12
 
13
- # Moutput = import_relative('dbg_output', '..io', 'pydbgr')
14
-
15
- # Interface when communicating with the user in the same
16
- # process as the debugged program.
13
+ # Interface when communicating with the user.
17
14
  class Trepan::UserInterface < Trepan::Interface
18
15
 
19
- FILE_HISTORY = '.trapan_hist' unless defined?(FILE_HISTORY)
16
+ DEFAULT_USER_OPTS = {
17
+ :readline => true, # Try to use GNU Readline?
18
+
19
+ # The below are only used if we want and have readline support.
20
+ # See method Trepan::GNU_readline? below.
21
+ :histsize => 256, # Use gdb's default setting
22
+ :file_history => '.trepanx_hist', # where history file lives
23
+ # Note a directory will
24
+ # be appended
25
+ :history_save => true # do we save the history?
26
+ } unless defined?(DEFAULT_USER_OPTS)
20
27
 
21
28
  def initialize(inp=nil, out=nil, opts={})
22
29
  super(inp, out, opts)
30
+ @opts = DEFAULT_USER_OPTS.merge(opts)
23
31
  @input = if inp.class.ancestors.member?(Trepan::InputBase)
24
32
  inp
25
33
  else
26
- Trepan::UserInput.open(inp)
34
+ Trepan::UserInput.open(inp, {:readline => opts[:readline]})
27
35
  end
36
+ if Trepan::GNU_readline? && opts[:complete]
37
+ Readline.completion_proc = opts[:complete]
38
+ read_history
39
+ end
40
+ at_exit { finalize }
28
41
  end
29
42
 
30
43
  # Called when a dangerous action is about to be done, to make
@@ -50,13 +63,66 @@ class Trepan::UserInterface < Trepan::Interface
50
63
  return YES.member?(response)
51
64
  end
52
65
 
66
+ # Read a saved Readline history file into Readline. The history
67
+ # file will be created if it doesn't already exist.
68
+ # Much of this code follows what's done in ruby-debug.
69
+ def read_history
70
+ unless @histfile
71
+ dirname = ENV['HOME'] || ENV['HOMEPATH'] || File.expand_path('~')
72
+ @histfile = File.join(dirname, @opts[:file_history])
73
+ end
74
+ @histsize ||= (ENV['HISTSIZE'] ? ENV['HISTSIZE'].to_i : @opts[:histsize])
75
+ Readline.completion_proc = @opts[:complete]
76
+ if File.exists?(@histfile)
77
+ lines = IO::readlines(@histfile).last(@histsize).collect do
78
+ |line| line.chomp
79
+ end
80
+ Readline::HISTORY.push(*lines)
81
+ @history_io = File.new(@histfile, "a")
82
+ else
83
+ @history_io = File.new(@histfile, "w")
84
+ end
85
+ @history_io.sync = true
86
+ @history_save = @opts[:history_save]
87
+ end
88
+
89
+ def save_history
90
+ if @histfile
91
+ lines = Readline::HISTORY.to_a
92
+ lines = lines[-@histsize, @histsize] if lines.size > @histsize
93
+ begin
94
+ open(@histfile, 'w') do |file|
95
+ Readline::HISTORY.to_a.last(@histsize).each do |line|
96
+ file.puts line
97
+ end
98
+ end if defined?(@history_save) and @history_save
99
+ rescue
100
+ end
101
+ end
102
+ end
103
+
53
104
  def finalize(last_wishes=nil)
54
105
  # print exit annotation
55
- # save history
106
+ if Trepan::GNU_readline? && @history_save
107
+ save_history
108
+ end
56
109
  super
57
110
  end
58
111
 
59
112
  def interactive? ; @input.interactive? end
113
+
114
+ def read_command(prompt=''); readline(prompt) end
115
+
116
+ def readline(prompt='')
117
+ @output.flush
118
+ if @input.line_edit && @opts[:use_readline]
119
+ @input.readline(prompt)
120
+ else
121
+ @output.write(prompt) if prompt and prompt.size > 0
122
+ @input.readline
123
+ end
124
+ end
125
+
60
126
  end
61
127
 
62
128
  # Demo