ruby-debug 0.10.3 → 0.10.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. data/CHANGES +15 -0
  2. data/ChangeLog +461 -104
  3. data/Rakefile +69 -13
  4. data/VERSION +3 -0
  5. data/bin/rdebug +2 -1
  6. data/cli/ruby-debug.rb +8 -5
  7. data/cli/ruby-debug/command.rb +43 -4
  8. data/cli/ruby-debug/commands/breakpoints.rb +3 -1
  9. data/cli/ruby-debug/commands/catchpoint.rb +5 -3
  10. data/cli/ruby-debug/commands/{continue.RB.save → continue.RB} +0 -0
  11. data/cli/ruby-debug/commands/eval.rb +4 -1
  12. data/cli/ruby-debug/commands/frame.rb +11 -10
  13. data/cli/ruby-debug/commands/help.rb +5 -0
  14. data/cli/ruby-debug/commands/info.rb +6 -3
  15. data/cli/ruby-debug/commands/irb.rb +115 -12
  16. data/cli/ruby-debug/commands/kill.rb +50 -0
  17. data/cli/ruby-debug/commands/list.rb +3 -3
  18. data/cli/ruby-debug/commands/quit.rb +12 -6
  19. data/cli/ruby-debug/commands/raise.RB +41 -0
  20. data/cli/ruby-debug/commands/show.rb +26 -28
  21. data/cli/ruby-debug/helper.rb +5 -0
  22. data/cli/ruby-debug/interface.rb +53 -25
  23. data/cli/ruby-debug/processor.RB +484 -0
  24. data/cli/ruby-debug/processor.rb +140 -56
  25. data/rdbg.rb +0 -0
  26. data/runner.sh +7 -0
  27. data/test/base/base.rb +0 -0
  28. data/test/base/binding.rb +0 -0
  29. data/test/base/catchpoint.rb +0 -0
  30. data/test/base/reload_bug.rb +8 -0
  31. data/test/brkpt-class-bug.rb +8 -0
  32. data/test/cli/commands/unit/regexp.rb +11 -0
  33. data/test/config.yaml +8 -0
  34. data/test/data/annotate.cmd +1 -1
  35. data/test/data/annotate.right +3 -3
  36. data/test/data/break_bad.cmd +1 -1
  37. data/test/data/break_bad.right +1 -1
  38. data/test/data/break_loop_bug.right +1 -1
  39. data/test/data/breakpoints.cmd +1 -1
  40. data/test/data/breakpoints.right +3 -3
  41. data/test/data/brkpt-class-bug.cmd +9 -0
  42. data/test/data/brkpt-class-bug.right +18 -0
  43. data/test/data/catch.right +2 -0
  44. data/test/data/condition.cmd +1 -0
  45. data/test/data/condition.right +5 -3
  46. data/test/data/ctrl.right +2 -2
  47. data/test/data/display.right +1 -1
  48. data/test/data/emacs_basic.right +2 -2
  49. data/test/data/except-bug1.cmd +7 -0
  50. data/test/data/except-bug1.right +13 -0
  51. data/test/data/file-with-space.cmd +7 -0
  52. data/test/data/file-with-space.right +9 -0
  53. data/test/data/finish.right +1 -1
  54. data/test/data/frame.cmd +7 -1
  55. data/test/data/frame.right +12 -1
  56. data/test/data/info-var.right +1 -1
  57. data/test/data/info.cmd +1 -0
  58. data/test/data/info.right +21 -2
  59. data/test/data/list.right +1 -1
  60. data/test/data/method.right +1 -1
  61. data/test/data/post-mortem.right +5 -4
  62. data/test/data/save.right +1 -1
  63. data/test/data/setshow.cmd +0 -10
  64. data/test/data/setshow.right +0 -17
  65. data/test/dollar-0.rb +0 -0
  66. data/test/except-bug1.rb +4 -0
  67. data/test/file with space.rb +1 -0
  68. data/test/gcd-dbg.rb +0 -0
  69. data/test/helper.rb +7 -1
  70. data/test/pm-base.rb +0 -0
  71. data/test/pm.rb +1 -1
  72. data/test/raise.rb +0 -0
  73. data/test/rdebug-save.1 +7 -0
  74. data/test/tdebug.rb +2 -2
  75. data/test/test-annotate.rb +0 -0
  76. data/test/test-break-bad.rb +0 -0
  77. data/test/test-breakpoints.rb +0 -0
  78. data/test/test-brkpt-class-bug.rb +26 -0
  79. data/test/test-catch.rb +1 -1
  80. data/test/test-condition.rb +1 -1
  81. data/test/test-ctrl.rb +1 -0
  82. data/test/test-display.rb +0 -0
  83. data/test/test-dollar-0.rb +0 -0
  84. data/test/test-edit.rb +0 -0
  85. data/test/test-emacs-basic.rb +0 -0
  86. data/test/test-enable.rb +0 -0
  87. data/test/test-except-bug1.rb +31 -0
  88. data/test/test-file-with-space.rb +30 -0
  89. data/test/test-finish.rb +0 -0
  90. data/test/test-frame.rb +0 -0
  91. data/test/test-help.rb +0 -0
  92. data/test/test-hist.rb +0 -0
  93. data/test/test-info-thread.rb +0 -0
  94. data/test/test-info-var.rb +0 -0
  95. data/test/test-info.rb +0 -0
  96. data/test/test-init.rb +7 -1
  97. data/test/test-list.rb +0 -0
  98. data/test/test-method.rb +0 -0
  99. data/test/test-output.rb +0 -0
  100. data/test/test-pm.rb +0 -0
  101. data/test/test-quit.rb +0 -0
  102. data/test/test-raise.rb +1 -1
  103. data/test/test-save.rb +7 -1
  104. data/test/test-setshow.rb +0 -0
  105. data/test/test-source.rb +0 -0
  106. data/test/test-stepping.rb +0 -0
  107. data/test/test-trace.rb +0 -0
  108. metadata +211 -180
data/Rakefile CHANGED
@@ -6,17 +6,37 @@ require 'rake/rdoctask'
6
6
  require 'rake/testtask'
7
7
 
8
8
  SO_NAME = "ruby_debug.so"
9
+ ROOT_DIR = File.dirname(__FILE__)
10
+ VERSION_FILE = ROOT_DIR + '/VERSION'
11
+
12
+ def make_version_file
13
+ ruby_debug_version = open("ext/ruby_debug.c").
14
+ grep(/^#define DEBUG_VERSION/).first[/"(.+)"/,1]
15
+ File.open(VERSION_FILE, 'w') do |f|
16
+ f.write(
17
+ "# This file was created automatically from data in ext/ruby_debug.c via:
18
+ # rake :make_version_file.
19
+ #{ruby_debug_version}
20
+ ")
21
+ end
22
+ end
9
23
 
10
- # ------- Default Package ----------
11
- RUBY_DEBUG_VERSION = open("ext/ruby_debug.c") do |f|
12
- f.grep(/^#define DEBUG_VERSION/).first[/"(.+)"/,1]
24
+ make_version_file unless File.exist?(VERSION_FILE)
25
+ ruby_debug_version = nil
26
+ open(VERSION_FILE).each do |line|
27
+ next if line =~ /^#/
28
+ ruby_debug_version = line.chomp
29
+ break
13
30
  end
14
31
 
32
+
33
+ # ------- Default Package ----------
15
34
  COMMON_FILES = FileList[
16
35
  'AUTHORS',
17
36
  'CHANGES',
18
37
  'LICENSE',
19
38
  'README',
39
+ 'VERSION',
20
40
  'Rakefile',
21
41
  ]
22
42
 
@@ -29,17 +49,23 @@ CLI_FILES = COMMON_FILES + FileList[
29
49
  'ChangeLog',
30
50
  'bin/*',
31
51
  'doc/rdebug.1',
52
+ 'test/rdebug-save.1',
32
53
  'test/**/data/*.cmd',
33
54
  'test/**/data/*.right',
55
+ 'test/config.yaml',
34
56
  'test/**/*.rb',
35
57
  'rdbg.rb',
58
+ 'runner.sh',
36
59
  CLI_TEST_FILE_LIST
37
60
  ]
38
61
 
39
62
  BASE_TEST_FILE_LIST = %w(
40
63
  test/base/base.rb
41
64
  test/base/binding.rb
42
- test/base/catchpoint.rb)
65
+ test/base/catchpoint.rb
66
+ test/base/reload_bug.rb
67
+ )
68
+
43
69
  BASE_FILES = COMMON_FILES + FileList[
44
70
  'ext/breakpoint.c',
45
71
  'ext/extconf.rb',
@@ -51,9 +77,12 @@ BASE_FILES = COMMON_FILES + FileList[
51
77
  ]
52
78
 
53
79
  desc "Test everything."
54
- task :test => :test_base do
80
+ ext = File.join(ROOT_DIR, 'ext')
81
+ test_and_args = File.exist?(ext) ? {:test => :test_base} : [:test]
82
+ task test_and_args do
55
83
  Rake::TestTask.new(:test) do |t|
56
- t.libs << ['./ext', './lib', './cli']
84
+ t.libs += %W(#{ROOT_DIR}/lib #{ROOT_DIR}/cli)
85
+ t.libs << ext if File.exist?(ext)
57
86
  t.test_files = CLI_TEST_FILE_LIST
58
87
  t.verbose = true
59
88
  end
@@ -62,7 +91,7 @@ end
62
91
  desc "Test ruby-debug-base."
63
92
  task :test_base => :lib do
64
93
  Rake::TestTask.new(:test_base) do |t|
65
- t.libs << ['./ext', './lib']
94
+ t.libs += ['./ext', './lib']
66
95
  t.test_files = FileList[BASE_TEST_FILE_LIST]
67
96
  t.verbose = true
68
97
  end
@@ -88,9 +117,9 @@ end
88
117
 
89
118
  desc "Create a GNU-style ChangeLog via svn2cl"
90
119
  task :ChangeLog do
91
- system("svn2cl --authors=svn2cl_usermap svn://rubyforge.org/var/svn/ruby-debug/trunk")
92
- system("svn2cl --authors=svn2cl_usermap svn://rubyforge.org/var/svn/ruby-debug/trunk/ext -o ext/ChangeLog")
93
- system("svn2cl --authors=svn2cl_usermap svn://rubyforge.org/var/svn/ruby-debug/trunk/lib -o lib/ChangeLog")
120
+ system('svn2cl --authors=svn2cl_usermap http://ruby-debug.rubyforge.org/svn/trunk')
121
+ system("svn2cl --authors=svn2cl_usermap http://ruby-debug.rubyforge.org/svn/trunk/ext -o ext/ChangeLog")
122
+ system("svn2cl --authors=svn2cl_usermap http://ruby-debug.rubyforge.org/svn/trunk/lib -o lib/ChangeLog")
94
123
  end
95
124
 
96
125
  # Base GEM Specification
@@ -106,7 +135,7 @@ provides support that front-ends can build on. It provides breakpoint
106
135
  handling, bindings for stack frames among other things.
107
136
  EOF
108
137
 
109
- spec.version = RUBY_DEBUG_VERSION
138
+ spec.version = ruby_debug_version
110
139
 
111
140
  spec.author = "Kent Sibilev"
112
141
  spec.email = "ksibilev@yahoo.com"
@@ -136,7 +165,7 @@ cli_spec = Gem::Specification.new do |spec|
136
165
  A generic command line interface for ruby-debug.
137
166
  EOF
138
167
 
139
- spec.version = RUBY_DEBUG_VERSION
168
+ spec.version = ruby_debug_version
140
169
 
141
170
  spec.author = "Kent Sibilev"
142
171
  spec.email = "ksibilev@yahoo.com"
@@ -150,7 +179,7 @@ EOF
150
179
  spec.date = Time.now
151
180
  spec.rubyforge_project = 'ruby-debug'
152
181
  spec.add_dependency('columnize', '>= 0.1')
153
- spec.add_dependency('ruby-debug-base', "~> #{RUBY_DEBUG_VERSION}.0")
182
+ spec.add_dependency('ruby-debug-base', "~> #{ruby_debug_version}.0")
154
183
 
155
184
  # FIXME: work out operational logistics for this
156
185
  # spec.test_files = FileList[CLI_TEST_FILE_LIST]
@@ -228,6 +257,7 @@ Rake::RDocTask.new("rdoc") do |rdoc|
228
257
  rdoc.options << '--main' << 'README'
229
258
  rdoc.rdoc_files.include('bin/**/*',
230
259
  'cli/ruby-debug/commands/*.rb',
260
+ 'cli/ruby-debug/*.rb',
231
261
  'lib/**/*.rb',
232
262
  'ext/**/ruby_debug.c',
233
263
  'README',
@@ -253,3 +283,29 @@ task :rubyforge_upload do
253
283
  system(release_command)
254
284
  end
255
285
  end
286
+
287
+ def install(spec, *opts)
288
+ args = ['gem', 'install', "pkg/#{spec.name}-#{spec.version}.gem"] + opts
289
+ args.unshift 'sudo' unless 0 == Process.uid
290
+ system(*args)
291
+ end
292
+
293
+ desc 'Install locally'
294
+ task :install => :package do
295
+ Dir.chdir(File::dirname(__FILE__)) do
296
+ # ri and rdoc take lots of time
297
+ install(base_spec, '--no-ri', '--no-rdoc')
298
+ install(cli_spec, '--no-ri', '--no-rdoc')
299
+ end
300
+ end
301
+
302
+ task :install_full => :package do
303
+ Dir.chdir(File::dirname(__FILE__)) do
304
+ install(base_spec)
305
+ install(cli_spec)
306
+ end
307
+ end
308
+
309
+ task :make_version_file do
310
+ make_version_file
311
+ end
data/VERSION ADDED
@@ -0,0 +1,3 @@
1
+ # This file was created automatically from data in ext/ruby_debug.c via:
2
+ # rake :make_version_file.
3
+ 0.10.4
data/bin/rdebug CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # -*- coding: utf-8 -*-
2
3
 
3
4
  #=== Summary
4
5
  #
@@ -111,7 +112,7 @@ def debug_program(options)
111
112
  # Make sure Ruby script syntax checks okay.
112
113
  # Otherwise we get a load message that looks like rdebug has
113
114
  # a problem.
114
- output = `ruby -c #{Debugger::PROG_SCRIPT} 2>&1`
115
+ output = `ruby -c #{Debugger::PROG_SCRIPT.inspect} 2>&1`
115
116
  if $?.exitstatus != 0 and RUBY_PLATFORM !~ /mswin/
116
117
  puts output
117
118
  exit $?.exitstatus
data/cli/ruby-debug.rb CHANGED
@@ -35,7 +35,7 @@ module Debugger
35
35
  # if the call stack is truncated.
36
36
  attr_accessor :start_sentinal
37
37
 
38
- attr_reader :thread, :control_thread
38
+ attr_reader :thread, :control_thread, :cmd_port, :ctrl_port
39
39
 
40
40
  def interface=(value) # :nodoc:
41
41
  handler.interface = value
@@ -58,15 +58,16 @@ module Debugger
58
58
  cmd_port, ctrl_port = port, port + 1
59
59
  end
60
60
 
61
- start_control(host, ctrl_port)
61
+ ctrl_port = start_control(host, ctrl_port)
62
62
 
63
63
  yield if block_given?
64
64
 
65
65
  mutex = Mutex.new
66
66
  proceed = ConditionVariable.new
67
67
 
68
+ server = TCPServer.new(host, cmd_port)
69
+ @cmd_port = cmd_port = server.addr[1]
68
70
  @thread = DebugThread.new do
69
- server = TCPServer.new(host, cmd_port)
70
71
  while (session = server.accept)
71
72
  self.interface = RemoteInterface.new(session)
72
73
  if wait_connection
@@ -86,15 +87,17 @@ module Debugger
86
87
 
87
88
  def start_control(host = nil, ctrl_port = PORT + 1) # :nodoc:
88
89
  raise "Debugger is not started" unless started?
89
- return if defined?(@control_thread) && @control_thread
90
+ return @ctrl_port if defined?(@control_thread) && @control_thread
91
+ server = TCPServer.new(host, ctrl_port)
92
+ @ctrl_port = server.addr[1]
90
93
  @control_thread = DebugThread.new do
91
- server = TCPServer.new(host, ctrl_port)
92
94
  while (session = server.accept)
93
95
  interface = RemoteInterface.new(session)
94
96
  processor = ControlCommandProcessor.new(interface)
95
97
  processor.process_commands
96
98
  end
97
99
  end
100
+ @ctrl_port
98
101
  end
99
102
 
100
103
  #
@@ -6,14 +6,32 @@ module Debugger
6
6
  RUBY_DEBUG_DIR = File.expand_path(File.dirname(__FILE__)) unless
7
7
  defined?(RUBY_DEBUG_DIR)
8
8
 
9
- class Command # :nodoc:
9
+ # A Debugger::Command object is is the base class for commands that
10
+ # implement a single debugger command. Individual debugger commands
11
+ # will be a subclass of this. The singleton class object is the
12
+ # command manager for all commands.
13
+ #
14
+ # Each debugger command is expected to implement the following methods:
15
+ # _regexp_:: A regular expression which input strings are matched
16
+ # against. If we have a match, run this command.
17
+ # It is the ruby-debug programmer's responsibility
18
+ # to make sure that these regular expressions match disjoint
19
+ # sets of strings. Otherwise one is arbitrarily used.
20
+ # _execute_:: Ruby code that implements the command.
21
+ # _help_:: Should return a String containing descriptive help for
22
+ # the commmand. Used by the 'help' command Debugger::HelpCommand
23
+ # _help_command_:: The name of the command listed via help.
24
+ #
25
+ # _help_ and _help_command_ methods are singleton methods, not
26
+ # instance methods like _regexp_ and _execute_.
27
+ class Command
10
28
  SubcmdStruct=Struct.new(:name, :min, :short_help, :long_help) unless
11
29
  defined?(SubcmdStruct)
12
30
 
13
31
  include Columnize
14
32
 
15
- # Find param in subcmds. param id downcased and can be abbreviated
16
- # to the minimum length listed in the subcommands
33
+ # Find _param_ in _subcmds_. The _param_ id downcased and can be
34
+ # abbreviated to the minimum length listed in the subcommands
17
35
  def find(subcmds, param)
18
36
  param.downcase!
19
37
  for try_subcmd in subcmds do
@@ -26,6 +44,8 @@ module Debugger
26
44
  end
27
45
 
28
46
  class << self
47
+ # An Array containing Debugger::Command classes that implment each
48
+ # of the debugger commands.
29
49
  def commands
30
50
  @commands ||= []
31
51
  end
@@ -46,6 +66,11 @@ module Debugger
46
66
  commands << klass
47
67
  end
48
68
 
69
+ # Read in and "include" all the subclasses of the
70
+ # Debugger::Command class. For example
71
+ # Debugger::QuitCommand is one of them. The list of Ruby
72
+ # files to read are all the files that end .rb in directory
73
+ # Debugger::RUBY_DEBUG_DIR
49
74
  def load_commands
50
75
  Dir[File.join(Debugger.const_get(:RUBY_DEBUG_DIR), 'commands', '*')].each do |file|
51
76
  require file if file =~ /\.rb$/
@@ -75,7 +100,9 @@ module Debugger
75
100
  @@settings_map ||= {}
76
101
  end
77
102
  private :settings_map
78
-
103
+
104
+ # Returns a Hash of Debugger settings, @settings. If doesn't exist
105
+ # we create a @settings hash with [] setter and getter and return that.
79
106
  def settings
80
107
  unless true and defined? @settings and @settings
81
108
  @settings = Object.new
@@ -165,10 +192,17 @@ module Debugger
165
192
  @state.print(*args)
166
193
  end
167
194
 
195
+ # Called when we are about to do a dangerous operation. _msg_
196
+ # contains a prompt message. Return _true_ if confirmed or _false_
197
+ # if not confirmed.
168
198
  def confirm(msg)
169
199
  @state.confirm(msg) == 'y'
170
200
  end
171
201
 
202
+ # debug_eval like Kernel.eval or Object.instance_eval but using
203
+ # the bindings for the debugged program. If there is a
204
+ # syntax-error like exception in running eval, print an
205
+ # appropriate message and throw :debug_error
172
206
  def debug_eval(str, b = get_binding)
173
207
  begin
174
208
  val = eval(str, b)
@@ -186,6 +220,10 @@ module Debugger
186
220
  end
187
221
  end
188
222
 
223
+ # debug_eval like Kernel.eval or Object.instance_eval but using
224
+ # the bindings for the debugged program. If there is a syntax
225
+ # error kind of exception in running eval, no warning is given and
226
+ # nil is returned.
189
227
  def debug_silent_eval(str)
190
228
  begin
191
229
  eval(str, get_binding)
@@ -194,6 +232,7 @@ module Debugger
194
232
  end
195
233
  end
196
234
 
235
+ # Return a binding object for the debugged program.
197
236
  def get_binding
198
237
  @state.context.frame_binding(@state.frame_pos)
199
238
  end
@@ -81,7 +81,9 @@ module Debugger
81
81
  errmsg "We are not in a state we can add breakpoints.\n"
82
82
  return
83
83
  end
84
- b = Debugger.add_breakpoint file, line, expr
84
+ brkpt_filename = File.basename(brkpt_filename) if
85
+ Command.settings[:basename]
86
+ b = Debugger.add_breakpoint brkpt_filename, line, expr
85
87
  print "Breakpoint %d file %s, line %s\n", b.id, brkpt_filename, line.to_s
86
88
  unless syntax_valid?(expr)
87
89
  errmsg("Expression \"#{expr}\" syntactically incorrect; breakpoint disabled.\n")
@@ -43,9 +43,11 @@ module Debugger
43
43
 
44
44
  def help(cmd)
45
45
  %{
46
- cat[ch]\t\t\tsame as "info catch"
47
- cat[ch] <exception-name>\tIntercept <exception-name> when there would otherwise be is no handler
48
- for it.
46
+ cat[ch]\t\tsame as "info catch"
47
+ cat[ch] <exception-name> [on|off]
48
+ \tIntercept <exception-name> when there would otherwise be no handler.
49
+ \tWith an "on" or "off", turn handling the exception on or off.
50
+ cat[ch] off\tdelete all catchpoints
49
51
  }
50
52
  end
51
53
  end
@@ -3,7 +3,8 @@ module Debugger
3
3
  def run_with_binding
4
4
  binding = @state.context ? get_binding : TOPLEVEL_BINDING
5
5
  $__dbg_interface = @state.interface
6
- eval(<<-EOC, binding)
6
+ begin
7
+ eval(<<-EOC, binding)
7
8
  __dbg_verbose_save=$VERBOSE; $VERBOSE=false
8
9
  def dbg_print(*args)
9
10
  $__dbg_interface.print(*args)
@@ -16,6 +17,8 @@ module Debugger
16
17
  end
17
18
  $VERBOSE=__dbg_verbose_save
18
19
  EOC
20
+ rescue
21
+ end
19
22
  yield binding
20
23
  ensure
21
24
  $__dbg_interface = nil
@@ -101,7 +101,7 @@ module Debugger
101
101
  end
102
102
  end
103
103
  print file_line
104
- if ENV['EMACS'] && adjust
104
+ if Debugger.inside_emacs? && adjust
105
105
  fmt = (Debugger.annotate.to_i > 1 ?
106
106
  "\032\032source %s:%d\n" : "\032\032%s:%d\n")
107
107
  print fmt % [CommandProcessor.canonic_file(file), line]
@@ -168,7 +168,8 @@ module Debugger
168
168
 
169
169
  end
170
170
  if truncated_callstack?(@state.context, Debugger.start_sentinal)
171
- print "Warning: saved frames may be incomplete; compare with caller(0).\n"
171
+ print "Warning: saved frames may be incomplete;\n"
172
+ print "compare debugger backtrace (bt) with Ruby caller(0).\n"
172
173
  end
173
174
  end
174
175
 
@@ -198,7 +199,7 @@ The position of the current frame is marked with -->. }
198
199
 
199
200
  class UpCommand < Command # :nodoc:
200
201
  def regexp
201
- /^\s* u(?:p)? (?:\s+(.*))?$/x
202
+ /^\s* u(?:p)? (?:\s+(\S+))? $/x
202
203
  end
203
204
 
204
205
  def execute
@@ -222,7 +223,7 @@ The position of the current frame is marked with -->. }
222
223
 
223
224
  class DownCommand < Command # :nodoc:
224
225
  def regexp
225
- /^\s* down (?:\s+(.*))? .*$/x
226
+ /^\s* down (?:\s+(\S+))? $/x
226
227
  end
227
228
 
228
229
  def execute
@@ -255,8 +256,7 @@ The position of the current frame is marked with -->. }
255
256
 
256
257
  def execute
257
258
  if not @match[1]
258
- errmsg "Missing a frame number argument.\n"
259
- return
259
+ pos = 0
260
260
  else
261
261
  pos = get_int(@match[1], "Frame")
262
262
  return unless pos
@@ -280,8 +280,9 @@ The position of the current frame is marked with -->. }
280
280
 
281
281
  def help(cmd)
282
282
  %{
283
- f[rame] frame-number [thread thread-number]
284
- Move the current frame to the specified frame number.
283
+ f[rame] [frame-number [thread thread-number]]
284
+ Move the current frame to the specified frame number, or the
285
+ 0 if no frame-number has been given.
285
286
 
286
287
  A negative number indicates position from the other end. So
287
288
  'frame -1' moves to the oldest frame, and 'frame 0' moves to
@@ -289,10 +290,10 @@ The position of the current frame is marked with -->. }
289
290
 
290
291
  Without an argument, the command prints the current stack
291
292
  frame. Since the current position is redisplayed, it may trigger a
292
- resyncronization if there is a front end also watching over
293
+ resynchronization if there is a front end also watching over
293
294
  things.
294
295
 
295
- If a thread number is given then we set the context for evaluating
296
+ If a thread number is given, then we set the context for evaluating
296
297
  expressions to that frame of that thread.
297
298
  }
298
299
  end