ruby-debug 0.10.2 → 0.10.3

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.
Files changed (69) hide show
  1. data/CHANGES +13 -0
  2. data/ChangeLog +307 -0
  3. data/README +15 -7
  4. data/Rakefile +7 -3
  5. data/bin/rdebug +106 -28
  6. data/cli/ruby-debug.rb +31 -2
  7. data/cli/ruby-debug/commands/breakpoints.rb +4 -0
  8. data/cli/ruby-debug/commands/continue.RB.save +48 -0
  9. data/cli/ruby-debug/commands/disassemble.RB +38 -0
  10. data/cli/ruby-debug/commands/frame.rb +46 -0
  11. data/cli/ruby-debug/commands/source.RB +44 -0
  12. data/cli/ruby-debug/interface.rb +1 -1
  13. data/rdbg.rb +0 -0
  14. data/test/base/base.rb +0 -0
  15. data/test/base/binding.rb +0 -0
  16. data/test/base/catchpoint.rb +0 -0
  17. data/test/cli/commands/catchpoint_test.rb +9 -8
  18. data/test/cli/commands/unit/regexp.rb +31 -0
  19. data/test/data/annotate.right +2 -0
  20. data/test/data/breakpoints.right +11 -7
  21. data/test/data/emacs_basic.right +7 -2
  22. data/test/data/finish.right +0 -12
  23. data/test/data/pm-bug.cmd +7 -0
  24. data/test/data/pm-bug.right +12 -0
  25. data/test/data/post-mortem.right +4 -4
  26. data/test/data/raise.right +3 -3
  27. data/test/dollar-0.rb +0 -0
  28. data/test/except-bug2.rb +7 -0
  29. data/test/gcd-dbg.rb +0 -0
  30. data/test/helper.rb +5 -1
  31. data/test/pm-base.rb +0 -0
  32. data/test/pm-bug.rb +3 -0
  33. data/test/pm.rb +0 -0
  34. data/test/raise.rb +0 -0
  35. data/test/scope-test.rb +8 -0
  36. data/test/tdebug.rb +10 -1
  37. data/test/test-annotate.rb +0 -0
  38. data/test/test-break-bad.rb +0 -0
  39. data/test/test-breakpoints.rb +0 -0
  40. data/test/test-catch.rb +0 -0
  41. data/test/test-condition.rb +0 -0
  42. data/test/test-ctrl.rb +0 -0
  43. data/test/test-display.rb +0 -0
  44. data/test/test-dollar-0.rb +9 -3
  45. data/test/test-edit.rb +0 -0
  46. data/test/test-emacs-basic.rb +0 -0
  47. data/test/test-enable.rb +0 -0
  48. data/test/test-finish.rb +7 -7
  49. data/test/test-frame.rb +1 -1
  50. data/test/test-help.rb +0 -0
  51. data/test/test-hist.rb +0 -0
  52. data/test/test-info-thread.rb +0 -0
  53. data/test/test-info-var.rb +0 -0
  54. data/test/test-info.rb +0 -0
  55. data/test/test-init.rb +0 -0
  56. data/test/test-list.rb +0 -0
  57. data/test/test-method.rb +0 -0
  58. data/test/test-output.rb +0 -0
  59. data/test/test-pm.rb +13 -0
  60. data/test/test-quit.rb +0 -0
  61. data/test/test-raise.rb +0 -0
  62. data/test/test-save.rb +0 -0
  63. data/test/test-setshow.rb +0 -0
  64. data/test/test-source.rb +0 -0
  65. data/test/test-stepping.rb +0 -0
  66. data/test/test-trace.rb +0 -0
  67. data/test/trunc-call.rb +31 -0
  68. data/test/tvar.rb +3 -0
  69. metadata +179 -177
data/CHANGES CHANGED
@@ -1,3 +1,16 @@
1
+ 0.10.3
2
+ 11/17/08
3
+
4
+ - a backtrace now warns when it thinks the callstack is truncated which it
5
+ gets by comparing with caller()
6
+ - fix setting $0.
7
+ - fix bug in showing variables in post-mortem
8
+ - Document how Debugger.start with a block is intended to be used.
9
+ - Move Kernel#debugger from ruby-debug-base into ruby-debug
10
+ - Get regression tests working again
11
+ - Warn and add a "confirmation" when setting a breakpoint on a
12
+ file that is not loaded.
13
+
1
14
  0.10.2
2
15
  - debugger(steps=0) breaks inside of debugger rather than wait for a line event.
3
16
  - trace var varname (stop|nostop) added which issues trace_var.
data/ChangeLog CHANGED
@@ -1,3 +1,310 @@
1
+ 2008-11-17 07:34 Rocky Bernstein
2
+
3
+ * CHANGES: Last commit before release.
4
+
5
+ 2008-11-16 00:14 Rocky Bernstein
6
+
7
+ * ChangeLog, bin/rdebug, lib/ChangeLog: Add rdoc for rdebug script.
8
+
9
+ 2008-11-15 22:13 Rocky Bernstein
10
+
11
+ * Rakefile, ext/ruby_debug.c: Go over RDOC documentation.
12
+
13
+ 2008-11-15 21:51 Rocky Bernstein
14
+
15
+ * doc/ruby-debug.texi: Add one more reference to start with a block
16
+
17
+ 2008-11-15 21:23 Rocky Bernstein
18
+
19
+ * doc/ruby-debug.texi: Remove hard-coded version number in example
20
+ output
21
+
22
+ 2008-11-15 02:21 Rocky Bernstein
23
+
24
+ * ext/win32/.cvsignore: More administrivia
25
+
26
+ 2008-11-15 02:20 Rocky Bernstein
27
+
28
+ * ext/win32: More administrivia
29
+
30
+ 2008-11-15 02:18 Rocky Bernstein
31
+
32
+ * ., .cvsignore: More administrivia
33
+
34
+ 2008-11-14 19:39 Rocky Bernstein
35
+
36
+ * ., .cvsignore: More administrivia
37
+
38
+ 2008-11-14 19:38 Rocky Bernstein
39
+
40
+ * .cvsignore: Administrivia
41
+
42
+ 2008-11-14 19:37 Rocky Bernstein
43
+
44
+ * ., README, Rakefile, doc, doc/.cvsignore: Go over documentation
45
+ for 0.10.3 release. rdoc creates files in doc/rdoc.
46
+
47
+ 2008-11-14 19:28 Rocky Bernstein
48
+
49
+ * README, configure.ac, doc/ruby-debug.texi,
50
+ lib/ruby-debug-base.rb: Go over documentation and revise.
51
+
52
+ 2008-11-14 15:32 Rocky Bernstein
53
+
54
+ * CHANGES, ChangeLog, cli/ruby-debug.rb,
55
+ cli/ruby-debug/commands/frame.rb, doc/ruby-debug.texi,
56
+ ext/ruby_debug.c, lib/ChangeLog, lib/ruby-debug-base.rb: Move
57
+ Debugger#debugger from base to cli. Revert code in ruby_debug.c
58
+ and block parameter in debugger. cf. -> Compare with. Document
59
+ Debugger.start better.
60
+
61
+ 2008-11-13 10:29 Rocky Bernstein
62
+
63
+ * ChangeLog, ext/ruby_debug.c, lib/ChangeLog: Make
64
+ Debugger.start{block} work if Debugger.started? is false. Second
65
+ try.
66
+
67
+ 2008-11-11 15:33 Rocky Bernstein
68
+
69
+ * ., Rakefile, test/cli/commands/catchpoint_test.rb,
70
+ test/cli/commands/unit, test/cli/commands/unit/regexp.rb: Start
71
+ unit test for command regular expressions. Much more willing out
72
+ to be done later....
73
+
74
+ 2008-11-11 14:42 Rocky Bernstein
75
+
76
+ * test/data/raise.right: More line number changes in tdebug
77
+
78
+ 2008-11-11 14:40 Rocky Bernstein
79
+
80
+ * test/data/raise.right: tdebug lines have changed
81
+
82
+ 2008-11-11 02:07 Rocky Bernstein
83
+
84
+ * ChangeLog, cli/ruby-debug/commands/frame.rb, lib/ChangeLog,
85
+ test/test-dollar-0.rb, test/test-frame.rb, test/trunc-call.rb:
86
+ Tweak truncated stack test since Ruby's caller doesn't seem to
87
+ include (tail?) recursive calls and we do. Get regression tests
88
+ working in light of recent changes.
89
+
90
+ 2008-11-10 08:47 Kent Sibilev
91
+
92
+ * ext/ruby_debug.c: register debug_frame_t->arg_ary with GC
93
+
94
+ 2008-11-10 02:56 Kent Sibilev
95
+
96
+ * bin/rdebug, ext/ruby_debug.c: Trying to fix "if $0 == __FILE__"
97
+ ruby's idiom. Apparently setting $0 to
98
+ a new value doesn't work correctly. (Ruby's bug?)
99
+
100
+ $ cat t3.rb
101
+ p $0
102
+ p File.expand_path $0
103
+ $0 = File.expand_path $0
104
+ p $0
105
+ $ ruby t3.rb
106
+ "t3.rb"
107
+ "/Users/kent/Work/ruby-debug/trunk/t3.rb"
108
+ "/Users/ke"
109
+
110
+ 2008-11-10 01:50 Kent Sibilev
111
+
112
+ * ext/ruby_debug.h: added declaration of
113
+ check_breakpoints_by_method method to remove compiler warning
114
+
115
+ 2008-11-10 01:48 Kent Sibilev
116
+
117
+ * lib/ruby-debug-base.rb: a little bit more readable
118
+
119
+ 2008-11-10 01:43 Kent Sibilev
120
+
121
+ * ext/ruby_debug.c: running at_exit hooks at the end of the
122
+ debug_load method in order to fix test cases a chance to run
123
+
124
+ 2008-11-10 01:41 Kent Sibilev
125
+
126
+ * ext/ruby_debug.c: can't store a copy of the debug_context in the
127
+ stack like that, it doesn't play along with garbage collector.
128
+
129
+ 2008-11-10 01:39 Kent Sibilev
130
+
131
+ * ext/ruby_debug.c: these two methods are unused
132
+
133
+ 2008-11-10 01:36 Kent Sibilev
134
+
135
+ * ext/breakpoint.c: fix the compiler warning
136
+
137
+ 2008-11-10 01:35 Kent Sibilev
138
+
139
+ * lib/ruby-debug-base.rb: Debugger.start must always call the
140
+ passed block
141
+
142
+ 2008-11-07 19:35 Rocky Bernstein
143
+
144
+ * ChangeLog, cli/ruby-debug/commands/frame.rb, lib/ChangeLog:
145
+ Change truncated frame message.
146
+
147
+ 2008-11-07 10:39 Rocky Bernstein
148
+
149
+ * ChangeLog, bin/rdebug, cli/ruby-debug.rb,
150
+ cli/ruby-debug/commands/frame.rb, lib/ChangeLog, test/tdebug.rb:
151
+ Add check to "where" to see if the call stack is truncated; task
152
+ #2354
153
+
154
+ 2008-11-06 16:17 Rocky Bernstein
155
+
156
+ * ChangeLog, Rakefile, lib/ChangeLog: #22698 Allow ruby-debug-base
157
+ 0.x.y.z be compatible with ruby-debug 0.x.y.
158
+
159
+ 2008-11-02 21:59 Rocky Bernstein
160
+
161
+ * ChangeLog, ext/ruby_debug.c, lib/ChangeLog,
162
+ lib/ruby-debug-base.rb: Debugger.start with a block now stops
163
+ inside the block. Debugger.debugger with a block works like
164
+ Debugger.start with a block.
165
+
166
+ The whole interface is hopelessly kludgy and needs to be redone.
167
+
168
+ 2008-10-27 15:29 Rocky Bernstein
169
+
170
+ * ChangeLog, test/data/raise.right: tdebug.rb line numbers changed.
171
+ Update test numbers -- I think this is right.
172
+
173
+ 2008-10-26 14:54 Rocky Bernstein
174
+
175
+ * ChangeLog, ext/extconf.rb, ext/ruby_debug.c, lib/ChangeLog: Doc
176
+ typo. Add comment to remind me how to turn off optimizationin
177
+ extconf.rb
178
+
179
+ 2008-10-25 18:10 Rocky Bernstein
180
+
181
+ * cli/ruby-debug/interface.rb: Fix mismatched interface.
182
+
183
+ 2008-10-25 16:01 Rocky Bernstein
184
+
185
+ * cli/ruby-debug/commands/breakpoints.rb, ext/ruby_debug.c,
186
+ lib/ChangeLog, test/data/annotate.right,
187
+ test/data/breakpoints.right, test/data/emacs_basic.right,
188
+ test/data/finish.right, test/test-finish.rb: Warn and add a
189
+ "confirmation" when setting a breakpoint on a file that is not
190
+ loaded. Regression tests no longer fail.
191
+
192
+ 2008-09-22 21:01 Rocky Bernstein
193
+
194
+ * cli/ruby-debug.rb: Remove a $DEBUG warning
195
+
196
+ 2008-09-22 00:07 Rocky Bernstein
197
+
198
+ * doc, doc/.cvsignore, lib/ruby-debug-base.rb,
199
+ test/data/pm-bug.cmd, test/data/pm-bug.right,
200
+ test/data/post-mortem.right, test/pm-bug.rb, test/test-pm.rb:
201
+ #22118 bug in showing variables post mortem. Patch thanks to
202
+ rubikitch.
203
+ Update pm.rb integration test.
204
+
205
+ 2008-09-21 23:09 Rocky Bernstein
206
+
207
+ * CHANGES: In 0.10.3 territory now.
208
+
209
+ 2008-09-21 23:06 Rocky Bernstein
210
+
211
+ * ext/ruby_debug.c, test/tdebug.rb: tdebug.rb: modify frozen string
212
+ taken from rdebug. Patch from Martin Krauskopf.
213
+ ruby_debug.c: in 0.10.3 now.
214
+
215
+ 2008-09-03 17:33 Rocky Bernstein
216
+
217
+ * doc: Administrivia
218
+
219
+ 2008-09-03 17:29 Rocky Bernstein
220
+
221
+ * ChangeLog, lib/ChangeLog, test/helper.rb: Show line numbers when
222
+ $DEBUG is set. Patch #21772 from Martin Krauskopf
223
+
224
+ 2008-08-28 05:43 Kent Sibilev
225
+
226
+ * ext/ruby_debug.c:
227
+
228
+ 2008-08-28 05:41 Kent Sibilev
229
+
230
+ * CHANGES: preparing version 0.10.2
231
+
232
+ 2008-08-15 17:36 Kent Sibilev
233
+
234
+ * cli/ruby-debug/commands/list.rb: Fixed an exception when calling
235
+ Kernel#debugger method from the eval code
236
+
237
+ 2008-07-10 09:47 Kent Sibilev
238
+
239
+ * cli/ruby-debug/commands/continue.rb, cli/ruby-debug/processor.rb:
240
+ allow 'continue' command from post-mortem
241
+
242
+ here is an example where it is needed:
243
+
244
+ ...
245
+ Debugger.post_mortem do
246
+ method_that_raises_an_exception()
247
+ end
248
+ ...
249
+
250
+ I want to be able to inspect the post_mortem context and then to
251
+ continue the program execution
252
+
253
+ 2008-07-10 08:55 Kent Sibilev
254
+
255
+ * ext/ruby_debug.c: fixed segfault and finish command
256
+
257
+ 2008-07-09 19:43 Kent Sibilev
258
+
259
+ * cli/ruby-debug/commands/breakpoints.rb: allow setting a
260
+ breakpoint on a file that is not yet loaded
261
+
262
+ 2008-07-09 19:29 Kent Sibilev
263
+
264
+ * cli/ruby-debug/interface.rb: RemoteInterface should extend
265
+ Interface class
266
+
267
+ 2008-07-09 19:25 Kent Sibilev
268
+
269
+ * bin/rdebug: $0 is frozen in Ruby 1.8.7
270
+
271
+ 2008-07-09 00:43 Rocky Bernstein
272
+
273
+ * cli/ruby-debug.rb, cli/ruby-debug/processor.rb: Some meager (and
274
+ not complete) support for a verbose mode on
275
+ source'ing a file. Some more print's turned to errmsg as
276
+ appropriate.
277
+
278
+ 2008-07-07 07:11 Rocky Bernstein
279
+
280
+ * lib/ruby-debug-base.rb: Tracker [#20041] start erroneously moved
281
+ to Kernel - should be in
282
+ Debugger.start
283
+
284
+ 2008-07-03 16:03 Rocky Bernstein
285
+
286
+ * doc/ruby-debug.texi: Document that backslash can escape debugger
287
+ command separation.
288
+
289
+ 2008-06-20 06:46 Rocky Bernstein
290
+
291
+ * CHANGES, cli/ruby-debug/commands/trace.rb,
292
+ lib/ruby-debug-base.rb: trace.rb: add "trace var"
293
+ ruby-debug-base.rb: remove another undefined warning.
294
+
295
+ 2008-05-27 03:54 Rocky Bernstein
296
+
297
+ * cli/ruby-debug/commands/save.rb, cli/ruby-debug/interface.rb,
298
+ test/data/save.cmd, test/data/save.right, test/test-save.rb: Add
299
+ save test. save.rb: use pretty-printed regexp. Interface, for now
300
+ add restart_file accessor like the others. The processor
301
+ interface
302
+ need revision though.
303
+
304
+ 2008-05-24 01:27 Rocky Bernstein
305
+
306
+ * ChangeLog, doc/ruby-debug.texi, lib/ChangeLog: Remove dup lines.
307
+
1
308
  2008-05-23 14:57 Rocky Bernstein
2
309
 
3
310
  * cli/ruby-debug/commands/save.rb: Catchpoints have changed. Fix
data/README CHANGED
@@ -3,7 +3,8 @@
3
3
  == Overview
4
4
 
5
5
  ruby-debug is a fast implementation of the standard debugger debug.rb.
6
- The faster execution speed is achieved by utilizing a new hook Ruby C API.
6
+ The faster execution speed is achieved by utilizing a new hook in the
7
+ Ruby C API.
7
8
 
8
9
  == Requirements
9
10
 
@@ -28,20 +29,19 @@ ruby-debug is provided as a RubyGem. To install:
28
29
 
29
30
  This should also pull in <tt>ruby-debug-base</tt> as a dependency.
30
31
 
31
- (If you install ruby-debug-base explicitly, you can add in the secret
32
- --test option after "install" to have the regression test run before
32
+ (If you install ruby-debug-base explicitly, you can add in the <tt>--test</tt>
33
+ option after "install" to have the regression test run before
33
34
  installing.)
34
35
 
35
36
  For Emacs support and the Reference Manual, get
36
37
  <tt>ruby-debug-extra</tt>. This is not a RubyGem, you'll need a Make
37
38
  program and a POSIX shell. With this installed, run:
38
39
 
39
- <pre>
40
40
  sh ./configure
41
41
  make
42
42
  make test # optional, but a good idea
43
43
  sudo make install
44
- </pre>
44
+
45
45
 
46
46
  ==== Install on MS Windows
47
47
 
@@ -86,13 +86,21 @@ code execution at run time.
86
86
  ...
87
87
  end
88
88
 
89
+ or
90
+
91
+ require 'ruby-debug' ;
92
+ Debugger.start do
93
+ ...
94
+ debugger
95
+ end
96
+
89
97
  When Kernel#debugger method is executed, the debugger is activated
90
98
  and you will be able to inspect and step through your code.
91
99
 
92
100
  == Performance
93
101
 
94
- The debug.rb script that comes with the standard Ruby library uses
95
- Kernel#set_trace_func API. Implementing the debugger in pure Ruby has
102
+ The <tt>debug.rb</tt> script that comes with the standard Ruby library uses
103
+ <tt>Kernel#set_trace_func</tt> API. Implementing the debugger in pure Ruby has
96
104
  a negative impact on the speed of your program execution. This is
97
105
  because the Ruby interpreter creates a Binding object each trace call,
98
106
  even though it is not being used most of the time. ruby-debug moves
data/Rakefile CHANGED
@@ -20,7 +20,10 @@ COMMON_FILES = FileList[
20
20
  'Rakefile',
21
21
  ]
22
22
 
23
- CLI_TEST_FILE_LIST = FileList['test/test-*.rb', 'test/cli/**/*_test.rb']
23
+ CLI_TEST_FILE_LIST = FileList['test/cli/commands/unit/*.rb',
24
+ 'test/cli/commands/*_test.rb',
25
+ 'test/cli/**/*_test.rb',
26
+ 'test/test-*.rb']
24
27
  CLI_FILES = COMMON_FILES + FileList[
25
28
  "cli/**/*",
26
29
  'ChangeLog',
@@ -147,7 +150,7 @@ EOF
147
150
  spec.date = Time.now
148
151
  spec.rubyforge_project = 'ruby-debug'
149
152
  spec.add_dependency('columnize', '>= 0.1')
150
- spec.add_dependency('ruby-debug-base', RUBY_DEBUG_VERSION)
153
+ spec.add_dependency('ruby-debug-base', "~> #{RUBY_DEBUG_VERSION}.0")
151
154
 
152
155
  # FIXME: work out operational logistics for this
153
156
  # spec.test_files = FileList[CLI_TEST_FILE_LIST]
@@ -217,13 +220,14 @@ end
217
220
  # --------- RDoc Documentation ------
218
221
  desc "Generate rdoc documentation"
219
222
  Rake::RDocTask.new("rdoc") do |rdoc|
220
- rdoc.rdoc_dir = 'doc'
223
+ rdoc.rdoc_dir = 'doc/rdoc'
221
224
  rdoc.title = "ruby-debug"
222
225
  # Show source inline with line numbers
223
226
  rdoc.options << "--inline-source" << "--line-numbers"
224
227
  # Make the readme file the start page for the generated html
225
228
  rdoc.options << '--main' << 'README'
226
229
  rdoc.rdoc_files.include('bin/**/*',
230
+ 'cli/ruby-debug/commands/*.rb',
227
231
  'lib/**/*.rb',
228
232
  'ext/**/ruby_debug.c',
229
233
  'README',
data/bin/rdebug CHANGED
@@ -1,5 +1,106 @@
1
1
  #!/usr/bin/env ruby
2
- # -*- Ruby -*-
2
+
3
+ #=== Summary
4
+ #
5
+ #A command-line front-end to the Ruby debugger, <tt>ruby-debug</tt>, the
6
+ #Fast Ruby Debugger.
7
+ #
8
+ #Command invocation:
9
+ #
10
+ # rdebug [options] [--] [script-options] ruby-script-to-debug
11
+ # rdebug [options] [script-options] [--client]
12
+ # rdebug [--version | --help]
13
+ #
14
+ #=== Options
15
+ #
16
+ #<tt>-A | --annotate</tt> <i>level</i>::
17
+ # Set gdb-style annotation to <i>level</i>, a number. Additional
18
+ # information is output automatically when program state is
19
+ # changed. This can be used by front-ends such as GNU Emacs to post
20
+ # this updated information without having to poll for it.
21
+ #
22
+ #<tt>--client</tt>::
23
+ # Connect to a remote debugger. Used with another rdebug invocation
24
+ # using <tt>--server</tt>. See also <tt>--host</tt> and
25
+ # <tt>--cport</tt> options
26
+ #
27
+ #<tt>--cport=</tt><i>port</i>::
28
+ # Use port <i>port</i> for access to debugger control.
29
+ #
30
+ #<tt>-d | --debug</tt>::
31
+ # Set $DEBUG true.
32
+ #
33
+ #<tt>--emacs</tt>::
34
+ # Activates full GNU Emacs mode. Is the equivalent of setting the
35
+ # options <tt>--emacs-basic --annotate=3 --no-stop --no-control
36
+ # --post-mortem</tt>.
37
+ #
38
+ #<tt>--emacs-basic</tt>::
39
+ # Activates GNU Emacs mode. Debugger prompts are prefaced with two
40
+ # octal 032 characters.
41
+ #
42
+ #<tt>-h | --host=</tt><i>host</i>::
43
+ # Use host name <i>host</i> for remote debugging.
44
+ #
45
+ #<tt>-I | --include</tt> <i>path</i>
46
+ # Add <i>path</i> to <tt>$LOAD_PATH</tt>
47
+ #
48
+ #<tt>-m | --post-mortem</tt>::
49
+ # Activate post-mortem mode.
50
+ #
51
+ #<tt>--no-control</tt>::
52
+ # Do not automatically start control thread.
53
+ #
54
+ #<tt>--no-stop</tt>::
55
+ # Do not stop when script is loaded.
56
+ #
57
+ #<tt>-p | --port=PORT</tt>::
58
+ # Host name used for remote debugging.
59
+ #
60
+ #<tt>-r | --require</tt><i>script</i>::
61
+ # Require the library, before executing your script.
62
+ #
63
+ #<tt>--script</tt> <i>file</i>::
64
+ # Run debugger script file <i>file</i>
65
+ #
66
+ #<tt>-x | --trace</tt>::
67
+ # Show lines before executing them.
68
+ #
69
+ #<tt>--no-quit</tt>::
70
+ # Do not quit when script terminates. Instead rerun the
71
+ # program.
72
+ #
73
+ #<tt>--version</tt>::
74
+ # Show the version number and exit.
75
+ #
76
+ #<tt>--verbose</tt>::
77
+ # Turn on verbose mode.
78
+ #
79
+ #<tt>--v</tt>::
80
+ # Print the version number, then turn on verbose mode if
81
+ # a script name is given. If no script name is given
82
+ # just exit after printing the version number.
83
+ #
84
+ #<tt>--nx</tt>::
85
+ # Don’t execute commands found in any initialization
86
+ # files, e.g. <tt>.rdebugrc</tt>.
87
+ #
88
+ #<tt>--keep-frame-binding</tt>::
89
+ # Keep frame bindings.
90
+ #
91
+ #<tt>--script=</tt><i>file</i>::
92
+ # Name of the script file to run
93
+ #
94
+ #<tt>-s | --server</tt>::
95
+ # Listen for remote connections. Another rdebug session
96
+ # accesses using the <tt>--client</tt> option. See also the
97
+ # <tt>--host</tt>, <tt>--port</tt> and <tt>--cport</tt> options
98
+ #
99
+ #<tt>-w | --wait</tt>::
100
+ # Wait for a client connection; implies <tt>-s</tt> option.
101
+ #
102
+ #<tt>--help</tt>::
103
+ # Show invocation help and exit.
3
104
 
4
105
  require 'rubygems'
5
106
  require 'optparse'
@@ -16,34 +117,11 @@ def debug_program(options)
16
117
  exit $?.exitstatus
17
118
  end
18
119
  print "\032\032starting\n" if Debugger.annotate and Debugger.annotate > 2
19
- unless options.no_rewrite_program
20
- # Set $0 so things like __FILE == $0 work.
21
- # A more reliable way to do this is to put $0 = __FILE__ *after*
22
- # loading the script to be debugged. For this, adding a debug hook
23
- # for the first time and then switching to the debug hook that's
24
- # normally used would be helpful. Doing this would also help other
25
- # first-time initializations such as reloading debugger state
26
- # after a restart.
27
120
 
28
- # However This is just a little more than I want to take on right
29
- # now, so I think I'll stick with the slightly hacky approach.
30
- $RDEBUG_0 = $0
121
+ # Record where we are we can know if the call stack has been
122
+ # truncated or not.
123
+ Debugger.start_sentinal=caller(0)[1]
31
124
 
32
- # cygwin does some sort of funky truncation on $0 ./abcdef => ./ab
33
- # probably something to do with 3-letter extension truncation.
34
- # The hacky workaround is to do slice assignment. Ugh.
35
- d0 = if '.' == File.dirname(Debugger::PROG_SCRIPT) and
36
- Debugger::PROG_SCRIPT[0..0] != '.'
37
- File.join('.', Debugger::PROG_SCRIPT)
38
- else
39
- Debugger::PROG_SCRIPT
40
- end
41
- if $0.frozen?
42
- $0 = d0
43
- else
44
- $0[0..-1] = d0
45
- end
46
- end
47
125
  bt = Debugger.debug_load(Debugger::PROG_SCRIPT, options.stop, false)
48
126
  if bt
49
127
  if options.post_mortem
@@ -267,7 +345,7 @@ else
267
345
  # save script name
268
346
  prog_script = ARGV.shift
269
347
  prog_script = whence_file(prog_script) unless File.exist?(prog_script)
270
- Debugger::PROG_SCRIPT = prog_script
348
+ Debugger::PROG_SCRIPT = File.expand_path prog_script
271
349
 
272
350
  # install interruption handler
273
351
  trap('INT') { Debugger.interrupt_last }