This is a problem in Ruby 1.9*, but not 1.8*
I have two files, 'script.rb' and 'flickr.rb':
script.rb:
#!/usr/bin/env ruby
require './flickr'
call_twice do |num|
puts 'Starting block' # line 5
puts "Number #{num}"
puts 'Ending block'
end
and flickr.rb:
#!/usr/bin/env ruby
# blank line
# blank line
# blank line # line 5
# blank line
# blank line
def call_twice
puts "before yield1"
yield 1 # line 11
puts "Between the yields"
yield 2
puts "before yield2"
end
I then use rdebug, with these commands:
(rdb:1) b flickr.rb:11
Breakpoint 1 file flickr.rb, line 11
(rdb:1) b script.rb:5
Breakpoint 2 file script.rb, line 5
(rdb:1) c
before yield1
Breakpoint 1 at flickr.rb:11
flickr.rb:11
yield 1 # line 11
(rdb:1) where
--> #0 Object.call_twice
at line flickr.rb:11
#1 at line script.rb:4
(rdb:1) c
Breakpoint 2 at script.rb:5
script.rb:5
puts 'Starting block' # line 5
(rdb:1) where
--> #0 Object.call_twice
at line flickr.rb:5
#1 at line script.rb:4
(rdb:1)
The problem is at the second breakpoint -- position 0 is given
as flickr.rb line 5, when in fact I'm at script.rb line 5. In
Ruby 1.8, the debugger shows pos 0 at script.rb:5, pos 1 at script.rb:4
It would be better to have the stack as:
[script.rb:5]
[flickr.rb:11]
[script.rb:4]
but I would like to have the current file (the one at pos 0)
correctly reported. |