debugger 1.4.0 → 1.5.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 (75) hide show
  1. data/CHANGELOG.md +4 -0
  2. data/README.md +9 -3
  3. data/debugger.gemspec +1 -1
  4. data/ext/ruby_debug/192/ruby_debug.c +21 -9
  5. data/ext/ruby_debug/193/ruby_debug.c +15 -5
  6. data/lib/debugger/test.rb +6 -0
  7. data/{test/support → lib/debugger/test}/breakpoint.rb +0 -0
  8. data/{test/support → lib/debugger/test}/context.rb +0 -0
  9. data/{test/support → lib/debugger/test}/matchers.rb +0 -0
  10. data/{test/support → lib/debugger/test}/mocha_extensions.rb +1 -1
  11. data/lib/debugger/test/printer_helpers.rb +8 -0
  12. data/{test/support → lib/debugger/test}/processor.rb +0 -0
  13. data/{test/support → lib/debugger/test}/test_dsl.rb +22 -2
  14. data/{test/support → lib/debugger/test}/test_interface.rb +4 -0
  15. data/lib/debugger/version.rb +1 -1
  16. data/lib/ruby-debug.rb +4 -1
  17. data/lib/ruby-debug/command.rb +18 -6
  18. data/lib/ruby-debug/commands/breakpoints.rb +27 -29
  19. data/lib/ruby-debug/commands/condition.rb +7 -2
  20. data/lib/ruby-debug/commands/continue.rb +1 -2
  21. data/lib/ruby-debug/commands/control.rb +8 -9
  22. data/lib/ruby-debug/commands/display.rb +7 -15
  23. data/lib/ruby-debug/commands/edit.rb +6 -6
  24. data/lib/ruby-debug/commands/enable.rb +6 -7
  25. data/lib/ruby-debug/commands/eval.rb +1 -3
  26. data/lib/ruby-debug/commands/frame.rb +72 -101
  27. data/lib/ruby-debug/commands/info.rb +8 -14
  28. data/lib/ruby-debug/commands/irb.rb +1 -1
  29. data/lib/ruby-debug/commands/jump.rb +6 -6
  30. data/lib/ruby-debug/commands/kill.rb +0 -1
  31. data/lib/ruby-debug/commands/list.rb +4 -4
  32. data/lib/ruby-debug/commands/method.rb +8 -11
  33. data/lib/ruby-debug/commands/quit.rb +1 -1
  34. data/lib/ruby-debug/commands/reload.rb +1 -1
  35. data/lib/ruby-debug/commands/save.rb +1 -1
  36. data/lib/ruby-debug/commands/set.rb +10 -15
  37. data/lib/ruby-debug/commands/show.rb +28 -42
  38. data/lib/ruby-debug/commands/skip.rb +1 -1
  39. data/lib/ruby-debug/commands/source.rb +1 -1
  40. data/lib/ruby-debug/commands/start.rb +26 -0
  41. data/lib/ruby-debug/commands/threads.rb +29 -18
  42. data/lib/ruby-debug/commands/tmate.rb +1 -1
  43. data/lib/ruby-debug/commands/trace.rb +6 -7
  44. data/lib/ruby-debug/commands/variables.rb +36 -19
  45. data/lib/ruby-debug/helper.rb +5 -5
  46. data/lib/ruby-debug/interface.rb +15 -3
  47. data/lib/ruby-debug/printers/base.rb +58 -0
  48. data/lib/ruby-debug/printers/plain.rb +41 -0
  49. data/lib/ruby-debug/printers/texts/base.yml +146 -0
  50. data/lib/ruby-debug/printers/texts/plain.yml +60 -0
  51. data/lib/ruby-debug/processor.rb +56 -47
  52. data/test/breakpoints_test.rb +43 -54
  53. data/test/conditions_test.rb +18 -6
  54. data/test/continue_test.rb +1 -1
  55. data/test/display_test.rb +11 -11
  56. data/test/edit_test.rb +1 -2
  57. data/test/eval_test.rb +5 -6
  58. data/test/finish_test.rb +1 -1
  59. data/test/frame_test.rb +29 -27
  60. data/test/help_test.rb +0 -1
  61. data/test/info_test.rb +10 -14
  62. data/test/irb_test.rb +0 -1
  63. data/test/jump_test.rb +21 -2
  64. data/test/method_test.rb +3 -3
  65. data/test/new/printers/plain_test.rb +84 -0
  66. data/test/reload_test.rb +2 -2
  67. data/test/restart_test.rb +1 -2
  68. data/test/set_test.rb +8 -7
  69. data/test/show_test.rb +22 -22
  70. data/test/source_test.rb +1 -1
  71. data/test/test_helper.rb +2 -1
  72. data/test/thread_test.rb +11 -13
  73. data/test/trace_test.rb +7 -7
  74. data/test/variables_test.rb +33 -15
  75. metadata +20 -12
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 1.5.0
2
+ * Add support for any output adapters e.g. xml
3
+ * Bump debugger-linecache dependency
4
+
1
5
  ## 1.4.0
2
6
  * Partial support for 2.0.0
3
7
 
data/README.md CHANGED
@@ -89,16 +89,20 @@ tutorial](http://bashdb.sourceforge.net/ruby-debug/rdebug-emacs.html)
89
89
  * 1.9.3 points to ruby-debug-base19-0.11.26 headers
90
90
  * Install painlessly for rvm and rbenv rubies i.e. no compiler flags needed
91
91
  * No downloading ruby source during install - was behavior of old ruby_core_source dependency
92
- * Fix LocalJumpError caused by using proc in extconf.rb
93
- * Fix where command failing at top level
92
+ * Add output adapters, Printers, to support output besides plain text e.g. xml
94
93
  * A new and improved test suite
95
94
  * Passing tests are up on travis-ci
95
+ * Fix several bugs
96
+ * Fix LocalJumpError caused by using proc in extconf.rb
97
+ * Fix where command failing at top level
98
+ * See changelog for more
96
99
  * Minor
97
100
  * The gem name matches the module namespace, Debugger, and main required file, debugger.
98
101
  * ruby-debug-base19 and ruby-debug19 are released as one gem
99
102
  * Rake tasks have been updated
100
103
  * No more $LOAD_PATH manipulation or runtime code outside of lib
101
104
  * man page available via gem-man
105
+ * Test helpers for third-party debugger libraries can be accessed from debugger/test. See debugger-xml for an example
102
106
 
103
107
  ## Issues
104
108
  Please report them [on github](http://github.com/cldwalker/debugger/issues).
@@ -117,6 +121,8 @@ Let's keep this working for the ruby community!
117
121
 
118
122
  * [debugger-completion](https://github.com/cldwalker/debugger-completion) - autocompletion for
119
123
  debugger commands and more
124
+ * [debugger-xml](https://github.com/astashov/debugger-xml) - XML interface for debugger, compatible
125
+ with ruby-debug-ide
120
126
  * [debugger-pry](https://github.com/pry/debugger-pry) - using pry within debugger
121
127
  * [pry-debugger](https://github.com/nixme/pry-debugger) - using debugger within pry
122
128
  * [ruby-debug-passenger](https://github.com/davejamesmiller/ruby-debug-passenger) - rake task to
@@ -128,7 +134,7 @@ Let's keep this working for the ruby community!
128
134
  ## Credits
129
135
 
130
136
  * Thanks to the original authors: Kent Sibilev and Mark Moseley
131
- * Thanks to astashov for bringing in a new and improved test suite and various bug fixes.
137
+ * Thanks to astashov for bringing in a new and improved test suite, adding printers support and various bug fixes.
132
138
  * Thanks to windwiny for porting to 2.0.0
133
139
  * Contributors: ericpromislow, jnimety, adammck, hipe, FooBarWidget, aghull
134
140
  * Fork started on awesome @relevance fridays!
data/debugger.gemspec CHANGED
@@ -21,7 +21,7 @@ handling, bindings for stack frames among other things.
21
21
  s.executables = ["rdebug"]
22
22
  s.add_dependency "columnize", ">= 0.3.1"
23
23
  s.add_dependency "debugger-ruby_core_source", '~> 1.2.0'
24
- s.add_dependency "debugger-linecache", '~> 1.1.1'
24
+ s.add_dependency "debugger-linecache", '~> 1.2.0'
25
25
  s.add_development_dependency 'rake', '~> 0.9.2.2'
26
26
  s.add_development_dependency 'rake-compiler', '~> 0.8.0'
27
27
  s.add_development_dependency 'minitest', '~> 2.12.1'
@@ -1787,8 +1787,13 @@ context_frame_id(int argc, VALUE *argv, VALUE self)
1787
1787
  frame = optional_frame_position(argc, argv);
1788
1788
  Data_Get_Struct(self, debug_context_t, debug_context);
1789
1789
 
1790
- id = GET_FRAME->info.runtime.cfp->iseq->defined_method_id;
1791
- return id ? ID2SYM(id): Qnil;
1790
+ rb_iseq_t *iseq = GET_FRAME->info.runtime.cfp->iseq;
1791
+ if (iseq) {
1792
+ id = iseq->defined_method_id;
1793
+ return id ? ID2SYM(id): Qnil;
1794
+ } else {
1795
+ return Qnil;
1796
+ }
1792
1797
  }
1793
1798
 
1794
1799
  /*
@@ -1815,7 +1820,7 @@ context_frame_line(int argc, VALUE *argv, VALUE self)
1815
1820
  cfp = GET_FRAME->info.runtime.cfp;
1816
1821
  while (cfp >= th->cfp)
1817
1822
  {
1818
- if ((cfp->iseq != NULL) && (pc >= cfp->iseq->iseq_encoded) && (pc < cfp->iseq->iseq_encoded + cfp->iseq->iseq_size))
1823
+ if ((cfp->iseq) && (pc >= cfp->iseq->iseq_encoded) && (pc < cfp->iseq->iseq_encoded + cfp->iseq->iseq_size))
1819
1824
  return(INT2FIX(rb_vm_get_sourceline(cfp)));
1820
1825
  cfp = RUBY_VM_NEXT_CONTROL_FRAME(cfp);
1821
1826
  }
@@ -1839,7 +1844,12 @@ context_frame_file(int argc, VALUE *argv, VALUE self)
1839
1844
  frame = optional_frame_position(argc, argv);
1840
1845
  Data_Get_Struct(self, debug_context_t, debug_context);
1841
1846
 
1842
- return(GET_FRAME->info.runtime.cfp->iseq->filename);
1847
+ rb_iseq_t *iseq = GET_FRAME->info.runtime.cfp->iseq;
1848
+ if (iseq) {
1849
+ return iseq->filename;
1850
+ } else {
1851
+ return Qnil;
1852
+ }
1843
1853
  }
1844
1854
 
1845
1855
  static int
@@ -2058,11 +2068,13 @@ context_frame_class(int argc, VALUE *argv, VALUE self)
2058
2068
 
2059
2069
  debug_frame = GET_FRAME;
2060
2070
 
2061
- cfp = debug_frame->info.runtime.cfp;
2062
-
2063
- klass = real_class(cfp->iseq->klass);
2064
- if(TYPE(klass) == T_CLASS || TYPE(klass) == T_MODULE)
2065
- return klass;
2071
+ rb_iseq_t *iseq = debug_frame->info.runtime.cfp->iseq;
2072
+ if (iseq) {
2073
+ klass = real_class(iseq->klass);
2074
+ if (TYPE(klass) == T_CLASS || TYPE(klass) == T_MODULE) {
2075
+ return klass;
2076
+ }
2077
+ }
2066
2078
  return Qnil;
2067
2079
  }
2068
2080
 
@@ -1764,12 +1764,17 @@ context_frame_id(int argc, VALUE *argv, VALUE self)
1764
1764
  Data_Get_Struct(self, debug_context_t, debug_context);
1765
1765
 
1766
1766
  cfp = GET_FRAME->info.runtime.cfp;
1767
+ rb_iseq_t *iseq = cfp->iseq;
1768
+ if (iseq) {
1767
1769
  #if defined HAVE_RB_CONTROL_FRAME_T_METHOD_ID
1768
- frame_id = RUBYVM_CFUNC_FRAME_P(cfp) ? cfp->method_id : cfp->iseq->defined_method_id;
1770
+ frame_id = RUBYVM_CFUNC_FRAME_P(cfp) ? cfp->method_id : cfp->iseq->defined_method_id;
1769
1771
  #elif defined HAVE_RB_METHOD_ENTRY_T_CALLED_ID
1770
- frame_id = RUBYVM_CFUNC_FRAME_P(cfp) ? cfp->me->called_id : cfp->iseq->defined_method_id;
1772
+ frame_id = RUBYVM_CFUNC_FRAME_P(cfp) ? cfp->me->called_id : cfp->iseq->defined_method_id;
1771
1773
  #endif
1772
- return frame_id ? ID2SYM(frame_id) : Qnil;
1774
+ return frame_id ? ID2SYM(frame_id) : Qnil;
1775
+ } else {
1776
+ return Qnil;
1777
+ }
1773
1778
  }
1774
1779
 
1775
1780
  /*
@@ -1796,7 +1801,7 @@ context_frame_line(int argc, VALUE *argv, VALUE self)
1796
1801
  cfp = GET_FRAME->info.runtime.cfp;
1797
1802
  while (cfp >= th->cfp)
1798
1803
  {
1799
- if ((cfp->iseq != NULL) && (pc >= cfp->iseq->iseq_encoded) && (pc < cfp->iseq->iseq_encoded + cfp->iseq->iseq_size))
1804
+ if ((cfp->iseq) && (pc >= cfp->iseq->iseq_encoded) && (pc < cfp->iseq->iseq_encoded + cfp->iseq->iseq_size))
1800
1805
  return(INT2FIX(rb_vm_get_sourceline(cfp)));
1801
1806
  cfp = RUBY_VM_NEXT_CONTROL_FRAME(cfp);
1802
1807
  }
@@ -1820,7 +1825,12 @@ context_frame_file(int argc, VALUE *argv, VALUE self)
1820
1825
  frame = optional_frame_position(argc, argv);
1821
1826
  Data_Get_Struct(self, debug_context_t, debug_context);
1822
1827
 
1823
- return(GET_FRAME->info.runtime.cfp->iseq->filename);
1828
+ rb_iseq_t *iseq = GET_FRAME->info.runtime.cfp->iseq;
1829
+ if (iseq) {
1830
+ return iseq->filename;
1831
+ } else {
1832
+ return Qnil;
1833
+ }
1824
1834
  }
1825
1835
 
1826
1836
  static int
@@ -0,0 +1,6 @@
1
+ require 'mocha/setup'
2
+ require 'pathname'
3
+
4
+ Debugger::Command.settings[:debuggertesting] = true
5
+ # $debugger_test_dir must be specified, it should point to the test/ directory
6
+ Dir.glob(File.expand_path("../test/*.rb", __FILE__)).each { |f| require f }
File without changes
File without changes
File without changes
@@ -40,7 +40,7 @@ module Mocha
40
40
  message = UnexpectedInvocation.new(self, symbol, *arguments).to_s
41
41
  require 'mocha/mockery'
42
42
  message << Mockery.instance.mocha_inspect
43
- raise ExpectationError.new(message, caller)
43
+ raise ExpectationError.new(message)
44
44
  end
45
45
  end
46
46
  end
@@ -0,0 +1,8 @@
1
+ module PrinterHelpers
2
+ def yaml_file_path(filename)
3
+ File.expand_path(
4
+ File.join($debugger_test_dir, "..", "lib", "ruby-debug", "printers", "texts", "#{filename}.yml"),
5
+ __FILE__
6
+ )
7
+ end
8
+ end
File without changes
@@ -1,7 +1,7 @@
1
1
  module TestDsl
2
2
  module Shared
3
3
  def fullpath(filename)
4
- (Pathname.new(__FILE__) + "../../examples/#{filename}.rb").cleanpath.to_s
4
+ File.join($debugger_test_dir, "examples", "#{filename}.rb")
5
5
  end
6
6
  end
7
7
  include Shared
@@ -70,7 +70,7 @@ module TestDsl
70
70
  end
71
71
  end
72
72
  Debugger.start do
73
- load fullpath(filename)
73
+ Debugger.debug_load(fullpath(filename))
74
74
  debug_completed = true
75
75
  end
76
76
  flunk "Debug block was not completed" unless debug_completed
@@ -114,6 +114,10 @@ module TestDsl
114
114
  state.context
115
115
  end
116
116
 
117
+ def binding
118
+ context.frame_binding(state.frame_pos)
119
+ end
120
+
117
121
  def breakpoint
118
122
  Debugger.breakpoints.first
119
123
  end
@@ -161,6 +165,22 @@ module TestDsl
161
165
  end
162
166
  end
163
167
 
168
+ def pi
169
+ puts
170
+ puts "Output Queue:"
171
+ puts interface.output_queue.join("")
172
+ puts
173
+ puts "Error Queue:"
174
+ puts interface.error_queue.join("")
175
+ puts
176
+ puts "Confirm Queue:"
177
+ puts interface.confirm_queue.join("")
178
+ puts
179
+ puts "Print Queue:"
180
+ puts interface.print_queue.join("")
181
+ puts
182
+ end
183
+
164
184
  module ClassMethods
165
185
  include Shared
166
186
 
@@ -44,6 +44,10 @@ class TestInterface < Debugger::Interface
44
44
  def close
45
45
  end
46
46
 
47
+ def empty?
48
+ [input_queue, output_queue, error_queue, confirm_queue, print_queue].all?(&:empty?)
49
+ end
50
+
47
51
  def inspect
48
52
  [
49
53
  "input_queue: #{input_queue.inspect}",
@@ -1,5 +1,5 @@
1
1
  module Debugger
2
2
  # TODO: remove version from C ext
3
3
  send :remove_const, :VERSION if const_defined? :VERSION
4
- VERSION = '1.4.0'
4
+ VERSION = '1.5.0'
5
5
  end
data/lib/ruby-debug.rb CHANGED
@@ -4,6 +4,7 @@ require 'socket'
4
4
  require 'thread'
5
5
  require 'ruby-debug-base'
6
6
  require 'ruby-debug/processor'
7
+ Dir.glob(File.expand_path("../ruby-debug/printers/**/*.rb", __FILE__)).each { |f| require f }
7
8
 
8
9
  module Debugger
9
10
  self.handler = CommandProcessor.new
@@ -35,13 +36,14 @@ module Debugger
35
36
  # if the call stack is truncated.
36
37
  attr_accessor :start_sentinal
37
38
 
39
+ attr_accessor :printer
40
+
38
41
  attr_reader :thread, :control_thread, :cmd_port, :ctrl_port
39
42
 
40
43
  def interface=(value) # :nodoc:
41
44
  handler.interface = value
42
45
  end
43
46
 
44
- #
45
47
  # Starts a remote debugger.
46
48
  #
47
49
  def start_remote(host = nil, port = PORT)
@@ -150,6 +152,7 @@ module Debugger
150
152
  processor.process_commands(verbose)
151
153
  end
152
154
  end
155
+ self.printer ||= Printers::Plain.new
153
156
  end
154
157
 
155
158
  module Kernel
@@ -1,4 +1,5 @@
1
1
  require 'columnize'
2
+ require 'forwardable'
2
3
  require 'ruby-debug/helper'
3
4
 
4
5
  module Debugger
@@ -11,6 +12,11 @@ module Debugger
11
12
 
12
13
  include Columnize
13
14
 
15
+ extend Forwardable
16
+ def_delegator :"Debugger.printer", :print, :pr
17
+ def_delegator :"Debugger.printer", :print_collection, :prc
18
+ def_delegator :"Debugger.printer", :print_variables, :prv
19
+
14
20
  # Find param in subcmds. param id downcased and can be abbreviated
15
21
  # to the minimum length listed in the subcommands
16
22
  def find(subcmds, param)
@@ -164,23 +170,29 @@ module Debugger
164
170
  @state.print(*args)
165
171
  end
166
172
 
173
+ def print_debug(*args)
174
+ @state.print_debug(*args)
175
+ end
176
+
167
177
  def confirm(msg)
168
178
  @state.confirm(msg) == 'y'
169
179
  end
170
180
 
181
+ # TODO: Add optional timeout
171
182
  def debug_eval(str, b = get_binding)
172
183
  begin
173
184
  val = eval(str, b)
174
185
  rescue StandardError, ScriptError => e
175
- if Command.settings[:stack_trace_on_error]
186
+ text_message = if Command.settings[:stack_trace_on_error]
176
187
  at = eval("caller(1)", b)
177
- print "%s:%s\n", at.shift, e.to_s.sub(/\(eval\):1:(in `.*?':)?/, '')
178
- for i in at
179
- print "\tfrom %s\n", i
180
- end
188
+ backtraces = []
189
+ backtraces << "#{at.shift}:#{e.to_s.sub(/\(eval\):1:(in `.*?':)?/, '')}"
190
+ backtraces += at.map { |i| "\tfrom #{i}" }
191
+ backtraces.join("\n")
181
192
  else
182
- print "#{e.class} Exception: #{e.message}\n"
193
+ "#{e.class} Exception: #{e.message}\n"
183
194
  end
195
+ errmsg pr("eval.exception", text_message: text_message, class: e.class, value: e.to_s)
184
196
  throw :debug_error
185
197
  end
186
198
  end
@@ -3,7 +3,7 @@ module Debugger
3
3
  # Implements debugger "break" command.
4
4
  class AddBreakpoint < Command
5
5
  self.allow_in_control = true
6
-
6
+
7
7
  def regexp
8
8
  / ^\s*
9
9
  b(?:reak)?
@@ -13,18 +13,22 @@ module Debugger
13
13
  /x
14
14
  end
15
15
 
16
+ def pr(path, *args)
17
+ super("breakpoints.#{path}", *args)
18
+ end
19
+
16
20
  def execute
17
21
  if @match[1]
18
22
  line, _, _, expr = @match.captures
19
23
  else
20
24
  _, file, line, expr = @match.captures
21
25
  end
22
- if expr
26
+ if expr
23
27
  if expr !~ /^\s*if\s+(.+)/
24
28
  if file or line
25
- errmsg "Expecting 'if' in breakpoint condition; got: #{expr}.\n"
29
+ errmsg pr("errors.if", expr: expr)
26
30
  else
27
- errmsg "Invalid breakpoint location: #{expr}.\n"
31
+ errmsg pr("errors.location", expr: expr)
28
32
  end
29
33
  return
30
34
  else
@@ -35,12 +39,12 @@ module Debugger
35
39
  brkpt_filename = nil
36
40
  if file.nil?
37
41
  unless @state.context
38
- errmsg "We are not in a state that has an associated file.\n"
39
- return
42
+ errmsg pr("errors.state_add")
43
+ return
40
44
  end
41
45
  brkpt_filename = @state.file
42
46
  file = File.basename(@state.file)
43
- if line.nil?
47
+ if line.nil?
44
48
  # Set breakpoint at current line
45
49
  line = @state.line.to_s
46
50
  end
@@ -50,7 +54,7 @@ module Debugger
50
54
  if klass && klass.kind_of?(Module)
51
55
  class_name = klass.name if klass
52
56
  else
53
- errmsg "Unknown class #{file}.\n"
57
+ errmsg pr("errors.class", file: file)
54
58
  throw :debug_error
55
59
  end
56
60
  else
@@ -59,38 +63,34 @@ module Debugger
59
63
  File::ALT_SEPARATOR && file.index(File::ALT_SEPARATOR)
60
64
  brkpt_filename = file
61
65
  end
62
-
66
+
63
67
  if line =~ /^\d+$/
64
68
  line = line.to_i
65
69
  if LineCache.cache(brkpt_filename, Command.settings[:reload_source_on_change])
66
70
  last_line = LineCache.size(brkpt_filename)
67
71
  if line > last_line
68
- errmsg("There are only %d lines in file \"%s\".\n", last_line, file)
69
- return
70
- end
71
- unless LineCache.trace_line_numbers(brkpt_filename).member?(line)
72
- errmsg("Line %d is not a stopping point in file \"%s\".\n", line, file)
72
+ errmsg pr("errors.far_line", lines: last_line, file: file)
73
73
  return
74
74
  end
75
75
  else
76
- errmsg("No source file named %s\n" % file)
77
- return unless confirm("Set breakpoint anyway? (y/n) ")
76
+ errmsg pr("errors.source", file: file)
77
+ return unless confirm(pr("confirmations.set_breakpoint"))
78
78
  end
79
79
 
80
- unless @state.context
81
- errmsg "We are not in a state we can add breakpoints.\n"
82
- return
80
+ if file.nil? && !@state.context
81
+ errmsg pr("errors.state")
82
+ return
83
83
  end
84
84
  b = Debugger.add_breakpoint brkpt_filename, line, expr
85
- print "Breakpoint %d file %s, line %s\n", b.id, brkpt_filename, line.to_s
85
+ print pr("set_breakpoint_to_line", id: b.id, file: brkpt_filename, line: line)
86
86
  unless syntax_valid?(expr)
87
- errmsg("Expression \"#{expr}\" syntactically incorrect; breakpoint disabled.\n")
87
+ errmsg pr("errors.expression", expr: expr)
88
88
  b.enabled = false
89
89
  end
90
90
  else
91
91
  method = line.intern.id2name
92
92
  b = Debugger.add_breakpoint class_name, method, expr
93
- print "Breakpoint %d at %s::%s\n", b.id, class_name, method.to_s
93
+ print pr("set_breakpoint_to_method", id: b.id, class: class_name, method: method)
94
94
  end
95
95
  end
96
96
 
@@ -118,21 +118,19 @@ module Debugger
118
118
  end
119
119
 
120
120
  def execute
121
- unless @state.context
122
- errmsg "We are not in a state we can delete breakpoints.\n"
123
- return
124
- end
125
121
  brkpts = @match[1]
126
122
  unless brkpts
127
- if confirm("Delete all breakpoints? (y or n) ")
123
+ if confirm(pr("breakpoints.confirmations.delete_all"))
128
124
  Debugger.breakpoints.clear
129
125
  end
130
126
  else
131
127
  brkpts.split(/[ \t]+/).each do |pos|
132
128
  pos = get_int(pos, "Delete", 1)
133
129
  return unless pos
134
- unless Debugger.remove_breakpoint(pos)
135
- errmsg "No breakpoint number %d\n", pos
130
+ if Debugger.remove_breakpoint(pos)
131
+ print pr("breakpoints.delete", id: pos)
132
+ else
133
+ errmsg pr("breakpoints.errors.no_breakpoint", id: pos)
136
134
  end
137
135
  end
138
136
  end