ruby-debug 0.9.3 → 0.10.0

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 (64) hide show
  1. data/AUTHORS +1 -0
  2. data/CHANGES +41 -0
  3. data/ChangeLog +0 -0
  4. data/README +27 -13
  5. data/Rakefile +220 -0
  6. data/bin/rdebug +116 -42
  7. data/cli/ruby-debug.rb +33 -3
  8. data/cli/ruby-debug/command.rb +49 -12
  9. data/cli/ruby-debug/commands/breakpoints.rb +47 -64
  10. data/cli/ruby-debug/commands/control.rb +41 -13
  11. data/cli/ruby-debug/commands/display.rb +35 -18
  12. data/cli/ruby-debug/commands/enable.rb +159 -0
  13. data/cli/ruby-debug/commands/eval.rb +78 -4
  14. data/cli/ruby-debug/commands/frame.rb +67 -42
  15. data/cli/ruby-debug/commands/help.rb +21 -17
  16. data/cli/ruby-debug/commands/info.rb +210 -0
  17. data/cli/ruby-debug/commands/irb.rb +9 -1
  18. data/cli/ruby-debug/commands/list.rb +11 -8
  19. data/cli/ruby-debug/commands/method.rb +12 -23
  20. data/cli/ruby-debug/commands/script.rb +14 -9
  21. data/cli/ruby-debug/commands/settings.rb +174 -39
  22. data/cli/ruby-debug/commands/show.rb +193 -0
  23. data/cli/ruby-debug/commands/stepping.rb +15 -10
  24. data/cli/ruby-debug/commands/threads.rb +55 -56
  25. data/cli/ruby-debug/commands/variables.rb +27 -27
  26. data/cli/ruby-debug/helper.rb +134 -0
  27. data/cli/ruby-debug/interface.rb +46 -15
  28. data/cli/ruby-debug/processor.rb +156 -25
  29. data/doc/rdebug.1 +236 -0
  30. data/runner.sh +7 -0
  31. data/test/breakpoints.cmd +43 -0
  32. data/test/breakpoints.right +94 -0
  33. data/test/display.cmd +18 -0
  34. data/test/display.right +37 -0
  35. data/test/frame.cmd +21 -0
  36. data/test/frame.right +45 -0
  37. data/test/gcd.rb +18 -0
  38. data/test/help.cmd +12 -0
  39. data/test/help.right +4 -0
  40. data/test/helper.rb +87 -0
  41. data/test/info-var-bug.rb +45 -0
  42. data/test/info-var.cmd +23 -0
  43. data/test/info-var.right +47 -0
  44. data/test/info.cmd +12 -0
  45. data/test/info.right +35 -0
  46. data/test/quit.cmd +9 -0
  47. data/test/quit.right +22 -0
  48. data/test/setshow.cmd +44 -0
  49. data/test/setshow.right +73 -0
  50. data/test/stepping.cmd +17 -0
  51. data/test/stepping.right +40 -0
  52. data/test/tdebug.rb +196 -0
  53. data/test/test-breakpoints.rb +28 -0
  54. data/test/test-columnize.rb +46 -0
  55. data/test/test-display.rb +26 -0
  56. data/test/test-frame.rb +27 -0
  57. data/test/test-help.rb +44 -0
  58. data/test/test-info-var.rb +33 -0
  59. data/test/test-info.rb +28 -0
  60. data/test/test-quit.rb +28 -0
  61. data/test/test-ruby-debug-base.rb +76 -0
  62. data/test/test-setshow.rb +24 -0
  63. data/test/test-stepping.rb +26 -0
  64. metadata +63 -22
@@ -0,0 +1,210 @@
1
+ module Debugger
2
+ class InfoCommand < Command # :nodoc:
3
+ SubcmdStruct=Struct.new(:name, :min, :short_help) unless
4
+ defined?(SubcmdStruct)
5
+ Subcommands =
6
+ [
7
+ ['args', 1, "Argument variables of current stack frame"],
8
+ ['breakpoints', 1, "Status of user-settable breakpoints"],
9
+ ['display', 2, "Expressions to display when program stops"],
10
+ ['file', 1, "File names and timestamps of files read in"],
11
+ ['global_variables', 2, "global variables"],
12
+ ['instance_variables', 2, "instance variables"],
13
+ ['line', 2, "Line number and file name of current position in source"],
14
+ ['locals', 2, "Local variables of the current stack frame"],
15
+ ['program', 2, "Execution status of the program"],
16
+ ['stack', 2, "Backtrace of the stack"],
17
+ ['threads', 1, "IDs of currently known threads"],
18
+ ['variables', 1, "local and instance variables"]
19
+ ].map do |name, min, short_help|
20
+ SubcmdStruct.new(name, min, short_help)
21
+ end unless defined?(Subcommands)
22
+
23
+ def regexp
24
+ /^\s* i(?:nfo)? (?:\s+(.*))?$/ix
25
+ end
26
+
27
+ def execute
28
+ if not @match[1]
29
+ print "\"info\" must be followed by the name of an info command:\n"
30
+ print "List of info subcommands:\n\n"
31
+ for subcmd in Subcommands do
32
+ print "info #{subcmd.name} -- #{subcmd.short_help}\n"
33
+ end
34
+ else
35
+ subcmd, args = @match[1].split(/[ \t]+/)
36
+ subcmd.downcase!
37
+ for try_subcmd in Subcommands do
38
+ if (subcmd.size >= try_subcmd.min) and
39
+ (try_subcmd.name[0..subcmd.size-1] == subcmd)
40
+ send("info_#{try_subcmd.name}", args)
41
+ return
42
+ end
43
+ end
44
+ print "Unknown info command #{subcmd}\n"
45
+ end
46
+ end
47
+
48
+ def info_args(*args)
49
+ locals = @state.context.frame_locals(@state.frame_pos)
50
+ args = @state.context.frame_args(@state.frame_pos)
51
+ args.each do |name|
52
+ s = "#{name} = #{locals[name].inspect}"
53
+ if s.size > self.class.settings[:width]
54
+ s[self.class.settings[:width]-3 .. -1] = "..."
55
+ end
56
+ print "#{s}\n"
57
+ end
58
+ end
59
+
60
+ def info_breakpoints(*args)
61
+ unless Debugger.breakpoints.empty?
62
+ print "Num Enb What\n"
63
+ Debugger.breakpoints.sort_by{|b| b.id }.each do |b|
64
+ if b.expr.nil?
65
+ print "%3d %s at %s:%s\n",
66
+ b.id, (b.enabled? ? 'y' : 'n'), b.source, b.pos
67
+ else
68
+ print "%3d %s at %s:%s if %s\n",
69
+ b.id, (b.enabled? ? 'y' : 'n'), b.source, b.pos, b.expr
70
+ end
71
+ end
72
+ else
73
+ print "No breakpoints.\n"
74
+ end
75
+ end
76
+
77
+ def info_display(*args)
78
+ if @state.display.size > 0
79
+ print "Auto-display expressions now in effect:\n"
80
+ print "Num Enb Expression\n"
81
+ n = 1
82
+ for d in @state.display
83
+ print "%3d: %s %s\n", n, (d[0] ? 'y' : 'n'), d[1] if
84
+ d[0] != nil
85
+ n += 1
86
+ end
87
+ else
88
+ print "There are no auto-display expressions now.\n"
89
+ end
90
+ end
91
+
92
+ def info_file(*args)
93
+ SCRIPT_LINES__.each do |file, value|
94
+ print "File %s %s\n", file, SCRIPT_TIMESTAMPS__[file]
95
+ end
96
+ end
97
+
98
+ def info_instance_variables(*args)
99
+ obj = debug_eval('self')
100
+ var_list(obj.instance_variables)
101
+ end
102
+
103
+ def info_line(*args)
104
+ print "Line %d of \"%s\"\n", @state.line, @state.file
105
+ end
106
+
107
+ def info_locals(*args)
108
+ locals = @state.context.frame_locals(@state.frame_pos)
109
+ locals.keys.sort.each do |name|
110
+ ### FIXME: make a common routine
111
+ begin
112
+ s = "#{name} = #{locals[name].inspect}"
113
+ rescue
114
+ begin
115
+ s = "#{name} = #{locals[name].to_s}"
116
+ rescue
117
+ s = "*Error in evaluation*"
118
+ end
119
+ end
120
+ if s.size > self.class.settings[:width]
121
+ s[self.class.settings[:width]-3 .. -1] = "..."
122
+ end
123
+ print "#{s}\n"
124
+ end
125
+ end
126
+
127
+ def info_program(*args)
128
+ if @state.context.dead?
129
+ print "The program being debugged is not being run.\n"
130
+ return
131
+ end
132
+ print "Program stopped. "
133
+ case @state.context.stop_reason
134
+ when :step
135
+ print "It stopped after stepping, next'ing or initial start.\n"
136
+ when :breakpoint
137
+ print("It stopped at a breakpoint.\n")
138
+ when :catchpoint
139
+ print("It stopped at a catchpoint.\n")
140
+ when :catchpoint
141
+ print("It stopped at a catchpoint.\n")
142
+ else
143
+ print "unknown reason: %s\n" % @state.context.stop_reason.to_s
144
+ end
145
+ end
146
+
147
+ def info_stack(*args)
148
+ (0...@state.context.stack_size).each do |idx|
149
+ if idx == @state.frame_pos
150
+ print "--> "
151
+ else
152
+ print " "
153
+ end
154
+ print_frame(idx)
155
+ end
156
+ end
157
+
158
+ def info_threads(*args)
159
+ threads = Debugger.contexts.sort_by{|c| c.thnum}.each do |c|
160
+ display_context(c)
161
+ end
162
+ end
163
+
164
+ def info_global_variables(*args)
165
+ var_list(global_variables)
166
+ end
167
+
168
+ def info_variables(*args)
169
+ obj = debug_eval('self')
170
+ locals = @state.context.frame_locals(@state.frame_pos)
171
+ locals.keys.sort.each do |name|
172
+ next if name =~ /^__dbg_/ # skip debugger pollution
173
+ ### FIXME: make a common routine
174
+ begin
175
+ s = "#{name} = #{locals[name].inspect}"
176
+ rescue
177
+ begin
178
+ s = "#{name} = #{locals[name].to_s}"
179
+ rescue
180
+ s = "#{name} = *Error in evaluation*"
181
+ end
182
+ end
183
+ if s.size > self.class.settings[:width]
184
+ s[self.class.settings[:width]-3 .. -1] = "..."
185
+ end
186
+ print "#{s}\n"
187
+ end
188
+ var_list(obj.instance_variables, obj.instance_eval{binding()})
189
+ end
190
+
191
+ class << self
192
+ def help_command
193
+ 'info'
194
+ end
195
+
196
+ def help(cmd)
197
+ s = %{
198
+ Generic command for showing things about the program being debugged.
199
+ --
200
+ List of info subcommands:
201
+ --
202
+ }
203
+ for subcmd in Subcommands do
204
+ s += "info #{subcmd.name} -- #{subcmd.short_help}\n"
205
+ end
206
+ return s
207
+ end
208
+ end
209
+ end
210
+ end
@@ -58,7 +58,15 @@ module Debugger
58
58
 
59
59
  $debug_in_irb = true
60
60
  cont = IRB.start_session(get_binding)
61
- @state.proceed if cont == :cont
61
+ if cont == :cont
62
+ @state.proceed
63
+ else
64
+ file = @state.context.frame_file(0)
65
+ line = @state.context.frame_line(0)
66
+ CommandProcessor.print_location_and_text(file, line)
67
+ @state.previous_line = nil
68
+ end
69
+
62
70
  ensure
63
71
  $debug_in_irb = false
64
72
  trap("SIGINT", save_trap) if save_trap
@@ -13,24 +13,27 @@ module Debugger
13
13
  end
14
14
 
15
15
  def execute
16
+ listsize = Command.settings[:listsize]
16
17
  if !@match || !(@match[1] || @match[2])
17
- b = @state.previous_line ? @state.previous_line + 10 : @state.line - 5
18
- e = b + 9
18
+ b = @state.previous_line ?
19
+ @state.previous_line + listsize : @state.line - (listsize/2)
20
+ e = b + listsize - 1
19
21
  elsif @match[1] == '-'
20
- b = @state.previous_line ? @state.previous_line - 10 : @state.line - 5
21
- e = b + 9
22
+ b = @state.previous_line ?
23
+ @state.previous_line - listsize : @state.line - (listsize/2)
24
+ e = b + listsize - 1
22
25
  elsif @match[1] == '='
23
26
  @state.previous_line = nil
24
- b = @state.line - 5
25
- e = b + 9
27
+ b = @state.line - (listsize/2)
28
+ e = b + listsize -1
26
29
  else
27
30
  b, e = @match[2].split(/[-,]/)
28
31
  if e
29
32
  b = b.to_i
30
33
  e = e.to_i
31
34
  else
32
- b = b.to_i - 5
33
- e = b + 9
35
+ b = b.to_i - (listsize/2)
36
+ e = b + listsize - 1
34
37
  end
35
38
  end
36
39
  @state.previous_line = b
@@ -1,38 +1,26 @@
1
1
  module Debugger
2
2
  class MethodCommand < Command # :nodoc:
3
3
  def regexp
4
- /^\s*m(?:ethod)?\s+(?:(i(:?nstance)?)\s)?/
4
+ /^\s*m(?:ethod)?\s+((iv)|(i(:?nstance\s+)?)\s+)?/
5
5
  end
6
6
 
7
7
  def execute
8
- if @match[1]
8
+ if @match[1] == "iv"
9
9
  obj = debug_eval(@match.post_match)
10
-
11
- len = 0
12
- for v in obj.methods.sort
13
- len += v.size + 1
14
- if len > 70
15
- len = v.size + 1
16
- print "\n"
17
- end
18
- print "%s ", v
10
+ obj.instance_variables.sort.each do |v|
11
+ print "%s = %s\n", v, obj.instance_variable_get(v).inspect
19
12
  end
20
- print "\n"
13
+ elsif @match[1]
14
+ obj = debug_eval(@match.post_match)
15
+ print "%s\n", columnize(obj.methods.sort(),
16
+ self.class.settings[:width])
21
17
  else
22
18
  obj = debug_eval(@match.post_match)
23
19
  unless obj.kind_of? Module
24
20
  print "Should be Class/Module: %s\n", @match.post_match
25
21
  else
26
- len = 0
27
- for v in obj.instance_methods(false).sort
28
- len += v.size + 1
29
- if len > 70
30
- len = v.size + 1
31
- print "\n"
32
- end
33
- print "%s ", v
34
- end
35
- print "\n"
22
+ print "%s\n", columnize(obj.instance_methods(false).sort(),
23
+ self.class.settings[:width])
36
24
  end
37
25
  end
38
26
  end
@@ -45,9 +33,10 @@ module Debugger
45
33
  def help(cmd)
46
34
  %{
47
35
  m[ethod] i[nstance] <obj>\tshow methods of object
36
+ m[ethod] iv <obj>\tshow instance variables of object
48
37
  m[ethod] <class|module>\t\tshow instance methods of class or module
49
38
  }
50
39
  end
51
40
  end
52
41
  end
53
- end
42
+ end
@@ -1,27 +1,28 @@
1
1
  module Debugger
2
- class ScriptCommand < Command # :nodoc:
2
+ class SourceCommand < Command # :nodoc:
3
3
  self.control = true
4
4
 
5
5
  def regexp
6
- /^\s*sc(?:ript)?\s+(.+)$/
6
+ /^\s*so(?:urce)?\s+(.+)$/
7
7
  end
8
8
 
9
9
  def execute
10
- unless File.exists?(@match[1])
11
- print "Script file '#{@match[1]}' is not found\n"
10
+ file = File.expand_path(@match[1]).strip
11
+ unless File.exists?(file)
12
+ print "Command file '#{file}' is not found\n"
12
13
  return
13
14
  end
14
- Debugger.run_script(@match[1], @state)
15
+ Debugger.run_script(file, @state)
15
16
  end
16
17
 
17
18
  class << self
18
19
  def help_command
19
- 'script'
20
+ 'source'
20
21
  end
21
22
 
22
23
  def help(cmd)
23
24
  %{
24
- script FILE\texecutes a script file
25
+ source FILE\texecutes a file containing debugger commands
25
26
  }
26
27
  end
27
28
  end
@@ -31,10 +32,14 @@ module Debugger
31
32
  self.control = true
32
33
 
33
34
  def regexp
34
- /^\s*sa(?:ve)?\s+(.+)$/
35
+ /^\s*sa(?:ve)?(?:\s+(.+))?$/
35
36
  end
36
37
 
37
38
  def execute
39
+ unless @match[1]
40
+ print "No filename specified.\n"
41
+ return
42
+ end
38
43
  open(@match[1], 'w') do |file|
39
44
  Debugger.breakpoints.each do |b|
40
45
  file.puts "break #{b.source}:#{b.pos}#{" if #{b.expr}" if b.expr}"
@@ -56,4 +61,4 @@ module Debugger
56
61
  end
57
62
  end
58
63
  end
59
- end
64
+ end
@@ -1,39 +1,173 @@
1
1
  module Debugger
2
2
  class SetCommand < Command # :nodoc:
3
+
4
+ SubcmdStruct=Struct.new(:name, :min, :is_bool, :short_help) unless
5
+ defined?(SubcmdStruct)
6
+ Subcommands =
7
+ [
8
+ ['annotate', 2, false,
9
+ "Set annotation level."],
10
+ ['args', 2, false,
11
+ "Set argument list to give program being debugged when it is started."],
12
+ ['autoeval', 4, true,
13
+ "Evaluate every unrecognized command"],
14
+ ['autolist', 4, true,
15
+ "Execute 'list' command on every breakpoint"],
16
+ ['autoirb', 4, true,
17
+ "Invoke IRB on every stop"],
18
+ ['autoreload', 4, true,
19
+ "Reload source code when changed"],
20
+ ['basename', 1, true,
21
+ "Report file basename only showing file names"],
22
+ ['callstyle', 2, false,
23
+ "Set how you want call parameters displayed"],
24
+ ['debuggertesting', 8, false,
25
+ "Used when testing the debugger"],
26
+ ['forcestep', 2, true,
27
+ "Make sure 'next/step' commands always move to a new line"],
28
+ ['fullpath', 2, true,
29
+ "Display full file names in frames"],
30
+ ['history', 2, false,
31
+ "Generic command for setting command history parameters."],
32
+ ['keep-frame-bindings', 1, true,
33
+ "Save frame binding on each call"],
34
+ ['linetrace+', 10, true,
35
+ "Set line execution tracing to show different lines"],
36
+ ['linetrace', 3, true,
37
+ "Set line execution tracing"],
38
+ ['listsize', 3, false,
39
+ "Set number of source lines to list by default"],
40
+ ['trace', 1, true,
41
+ "Display stack trace when 'eval' raises exception"],
42
+ ['width', 1, false,
43
+ "Number of characters the debugger thinks are in a line"],
44
+ ].map do |name, min, is_bool, short_help|
45
+ SubcmdStruct.new(name, min, is_bool, short_help)
46
+ end unless defined?(Subcommands)
47
+
3
48
  self.control = true
4
49
 
5
50
  def regexp
6
- /^set \s+ (.+) \s*/x
51
+ /^set (?: \s+ (.*) )?$/ix
7
52
  end
8
53
 
9
54
  def execute
10
- case @match[1]
11
- when /^(no)?autolist$/
12
- Command.settings[:autolist] = $1.nil?
13
- print "autolist is #{$1.nil? ? 'on' : 'off'}.\n"
14
- when /^(no)?autoeval$/
15
- Command.settings[:autoeval] = $1.nil?
16
- print "autoeval is #{$1.nil? ? 'on' : 'off'}.\n"
17
- when /^(no)?trace$/
18
- Command.settings[:stack_trace_on_error] = $1.nil?
19
- print "Displaying stack trace is #{$1.nil? ? 'on' : 'off'}.\n"
20
- when /^(no)?framefullpath$/
21
- Command.settings[:frame_full_path] = $1.nil?
22
- print "Displaying frame's full file names is #{$1.nil? ? 'on' : 'off'}.\n"
23
- when /^(no)?frameclassname$/
24
- Command.settings[:frame_class_names] = $1.nil?
25
- print "Displaying frame's original class name is #{$1.nil? ? 'on' : 'off'}.\n"
26
- when /^(no)?autoreload$/
27
- Command.settings[:reload_source_on_change] = $1.nil?
28
- print "autoreload is #{$1.nil? ? 'on' : 'off'}.\n"
29
- when /^(no)?autoirb$/
30
- Command.settings[:autoirb] = $1.nil?
31
- print "autoirb is #{$1.nil? ? 'on' : 'off'}.\n"
32
- when /^(no)?forcestep$/
33
- self.class.settings[:force_stepping] = $1.nil?
34
- print "force-stepping is #{$1.nil? ? 'on' : 'off'}.\n"
55
+ if not @match[1]
56
+ print "\"set\" must be followed by the name of an set command:\n"
57
+ print "List of set subcommands:\n\n"
58
+ for subcmd in Subcommands do
59
+ print "set #{subcmd.name} -- #{subcmd.short_help}\n"
60
+ end
35
61
  else
36
- print "Unknown setting.\n"
62
+ args = @match[1].split(/[ \t]+/)
63
+ subcmd = args.shift
64
+ subcmd.downcase!
65
+ if subcmd =~ /^no/i
66
+ set_on = false
67
+ subcmd = subcmd[2..-1]
68
+ else
69
+ set_on = true
70
+ end
71
+ for try_subcmd in Subcommands do
72
+ if (subcmd.size >= try_subcmd.min) and
73
+ (try_subcmd.name[0..subcmd.size-1] == subcmd)
74
+ begin
75
+ if try_subcmd.is_bool
76
+ if args.size > 0
77
+ set_on = get_onoff(args[0])
78
+ end
79
+ end
80
+ case try_subcmd.name
81
+ when /^annotate$/
82
+ level = get_int(args[0], "Set annotate", 0, 3, 0)
83
+ if level
84
+ Debugger.annotate = level
85
+ else
86
+ return
87
+ end
88
+ Command.settings[:argv][1..-1] = args
89
+ when /^args$/
90
+ Command.settings[:argv][1..-1] = args
91
+ when /^autolist$/
92
+ Command.settings[:autolist] = (set_on ? 1 : 0)
93
+ when /^autoeval$/
94
+ Command.settings[:autoeval] = set_on
95
+ when /^basename$/
96
+ Command.settings[:basename] = set_on
97
+ when /^callstyle$/
98
+ arg = args[0].downcase.to_sym
99
+ case arg
100
+ when :short, :last, :tracked
101
+ Command.settings[:callstyle] = arg
102
+ Debugger.track_frame_args = arg == :tracked ? true : false
103
+ else
104
+ print "Invalid call style #{arg}. Should be one of: " +
105
+ "'short', 'last', or 'tracked'.\n"
106
+ end
107
+ when /^trace$/
108
+ Command.settings[:stack_trace_on_error] = set_on
109
+ when /^fullpath$/
110
+ Command.settings[:full_path] = set_on
111
+ when /^autoreload$/
112
+ Command.settings[:reload_source_on_change] = set_on
113
+ when /^autoirb$/
114
+ Command.settings[:autoirb] = (set_on ? 1 : 0)
115
+ when /^debuggertesting$/
116
+ Command.settings[:debuggertesting] = set_on
117
+ if set_on
118
+ Command.settings[:basename] = true
119
+ end
120
+ when /^forcestep$/
121
+ self.class.settings[:force_stepping] = set_on
122
+ when /^history$/
123
+ if 2 == args.size
124
+ interface = @state.interface
125
+ case args[0]
126
+ when /^save$/
127
+ interface.history_save = get_onoff(args[1])
128
+ when /^size$/
129
+ interface.history_length = get_int(args[1],
130
+ "Set history size")
131
+ else
132
+ print "Invalid history parameter #{args[0]}. Should be 'save' or 'size'.\n"
133
+ end
134
+ else
135
+ print "Need two parameters for 'set history'; got #{args.size}.\n"
136
+ return
137
+ end
138
+ when /^keep-frame-bindings$/
139
+ Debugger.keep_frame_binding = set_on
140
+ when /^linetrace\+$/
141
+ self.class.settings[:tracing_plus] = set_on
142
+ when /^linetrace$/
143
+ Debugger.tracing = set_on
144
+ when /^listsize$/
145
+ listsize = get_int(args[0], "Set listsize", 1, nil, 10)
146
+ if listsize
147
+ self.class.settings[:listsize] = listsize
148
+ else
149
+ return
150
+ end
151
+ when /^width$/
152
+ width = get_int(args[0], "Set width", 10, nil, 80)
153
+ if width
154
+ self.class.settings[:width] = width
155
+ ENV['COLUMNS'] = width.to_s
156
+ else
157
+ return
158
+ end
159
+ else
160
+ print "Unknown setting #{@match[1]}.\n"
161
+ return
162
+ end
163
+ print "%s\n" % show_setting(try_subcmd.name)
164
+ return
165
+ rescue RuntimeError
166
+ return
167
+ end
168
+ end
169
+ end
170
+ print "Unknown set command #{subcmd}\n"
37
171
  end
38
172
  end
39
173
 
@@ -43,18 +177,19 @@ module Debugger
43
177
  end
44
178
 
45
179
  def help(cmd)
46
- %{
47
- set <setting>, where <setting>:
48
- autolist - execute 'list' command on every breakpoint
49
- autoeval - evaluate every unrecognized command
50
- autoreload - enables automatic source code reloading
51
- autoirb - debugger invokes IRB on every stop
52
- trace - display stack trace when 'eval' raises exception
53
- framefullpath - frame will display full file names
54
- frameclassname - frame will display class names
55
- forcestep - make sure 'next/step' commands always move to a new line
56
- To disable setting, use 'no' prefix, like 'noautolist'
57
- }
180
+ s = %{
181
+ Modifies parts of the ruby-debug environment. Boolean values take
182
+ on, off, 1 or 0.
183
+ You can see these environment settings with the \"show\" command.
184
+
185
+ --
186
+ List of set subcommands:
187
+ --
188
+ }
189
+ for subcmd in Subcommands do
190
+ s += "set #{subcmd.name} -- #{subcmd.short_help}\n"
191
+ end
192
+ return s
58
193
  end
59
194
  end
60
195
  end