P
pat eyler
I'm running into an unexpected issue with the debugger, and I'm hoping some=
one
here can help me out. I' ve got a short program like this (stolen directly
from zenspider's RubyInline tutorial):
-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D=3D-=3D-=3D-=3D-=3D=
-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-
#!/usr/local/bin/ruby -w
class Array
def average
result =3D 0
self.each { |x| result +=3D x }
result / self.size.to_f
end
end
max_loop =3D (ARGV.shift || 5).to_i
max_size =3D (ARGV.shift || 100_000).to_i
a =3D (1..max_size).to_a
1.upto(max_loop) do
avg =3D a.average
$stderr.print "."
end
$stderr.puts ""
-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D=3D-=3D-=3D-=3D-=3D=
-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-
Everytime I step to line 7 (the self.each ... line) or do a step nnn which
executes line 7, the debugger stops there. Neither step or next will move
past this line. If I try to continue the program, it will run to the next
breakpoint or end of the program.
-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D=3D-=3D-=3D-=3D-=3D=
-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-
pate@linux:~/scripts> ruby -rdebug averager.rb
Debug.rb
Emacs support available.
averager.rb:3:class Array
(rdb:1) s 13
averager.rb:7: self.each { |x| result +=3D x }
(rdb:1) s
averager.rb:7: self.each { |x| result +=3D x }
(rdb:1) s
averager.rb:7: self.each { |x| result +=3D x }
(rdb:1) s
averager.rb:7: self.each { |x| result +=3D x }
(rdb:1) n
averager.rb:7: self.each { |x| result +=3D x }
(rdb:1) n
averager.rb:7: self.each { |x| result +=3D x }
(rdb:1) n
averager.rb:7: self.each { |x| result +=3D x }
(rdb:1) n 20
averager.rb:7: self.each { |x| result +=3D x }
(rdb:1) c
.....
pate@linux:~/scripts>
-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D=3D-=3D-=3D-=3D-=3D=
-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-
Any idea what's going on? Is this a bug in the debugger, or am I
misunderstanding something?
--=20
thanks,
-pate
one
here can help me out. I' ve got a short program like this (stolen directly
from zenspider's RubyInline tutorial):
-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D=3D-=3D-=3D-=3D-=3D=
-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-
#!/usr/local/bin/ruby -w
class Array
def average
result =3D 0
self.each { |x| result +=3D x }
result / self.size.to_f
end
end
max_loop =3D (ARGV.shift || 5).to_i
max_size =3D (ARGV.shift || 100_000).to_i
a =3D (1..max_size).to_a
1.upto(max_loop) do
avg =3D a.average
$stderr.print "."
end
$stderr.puts ""
-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D=3D-=3D-=3D-=3D-=3D=
-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-
Everytime I step to line 7 (the self.each ... line) or do a step nnn which
executes line 7, the debugger stops there. Neither step or next will move
past this line. If I try to continue the program, it will run to the next
breakpoint or end of the program.
-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D=3D-=3D-=3D-=3D-=3D=
-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-
pate@linux:~/scripts> ruby -rdebug averager.rb
Debug.rb
Emacs support available.
averager.rb:3:class Array
(rdb:1) s 13
averager.rb:7: self.each { |x| result +=3D x }
(rdb:1) s
averager.rb:7: self.each { |x| result +=3D x }
(rdb:1) s
averager.rb:7: self.each { |x| result +=3D x }
(rdb:1) s
averager.rb:7: self.each { |x| result +=3D x }
(rdb:1) n
averager.rb:7: self.each { |x| result +=3D x }
(rdb:1) n
averager.rb:7: self.each { |x| result +=3D x }
(rdb:1) n
averager.rb:7: self.each { |x| result +=3D x }
(rdb:1) n 20
averager.rb:7: self.each { |x| result +=3D x }
(rdb:1) c
.....
pate@linux:~/scripts>
-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D=3D-=3D-=3D-=3D-=3D=
-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-
Any idea what's going on? Is this a bug in the debugger, or am I
misunderstanding something?
--=20
thanks,
-pate