Breakpoints
< Continued from page 2
Breakpoints are lines on which you want the program to stop execution. When the program reaches such a line, the debugger will stop execution and allow you to take control of the program. Breakpoints can be set on line numbers or on more descriptive things (such as methods).
Breakpoints can be set with the b command. It takes a single argument; the line of code or method name you want to break on. If you don't specify any line or method name, the breakpoint command will list all active breakpoints.
Breakpoints are lines on which you want the program to stop execution. When the program reaches such a line, the debugger will stop execution and allow you to take control of the program. Breakpoints can be set on line numbers or on more descriptive things (such as methods).
Breakpoints can be set with the b command. It takes a single argument; the line of code or method name you want to break on. If you don't specify any line or method name, the breakpoint command will list all active breakpoints.
$ ruby -rdebug problem.rb data.txt
Debug.rb
Emacs support available.
problem.rb:3:lines = File.readlines(ARGV[0])
(rdb:1) l
[-2, 7] in problem.rb
1
2
=> 3 lines = File.readlines(ARGV[0])
4
5 lines.each do|l|
6 nums = l.split /,/
7 nums.map!{|n| n.to_f }
(rdb:1) b 7
Set breakpoint 1 at problem.rb:7
(rdb:1) b
Breakpoints:
1 problem.rb:7
(rdb:1) exit
Source...