Debugger Debugging Ruby?

When I run
    ruby -rdebug foo.rb
the debugger displays
    Debug.rb
    Emacs support available.

    c:/ruby/lib/ruby/site_ruby/1.8/ubygems.rb:4:require 'rubygems'

This would be OK if the first line of foo.rb were "require 'rubygems'", but it isn't. The only line in foo.rb is
    print "hello"

Why is the debugger stopping in ubygems.rb? How can I make it stop at the first line in *my* code when it starts?

TIA
Kevin Kleinfelter

You probably have RUBYOPT environment variable set to load rubygems
automatically (it is set up automatically with the 1-click installer).

You can set a breakpoint in the first line of your file as the first
command to the debugger and then continue until you reach it:

c:\TEMP>ruby -rdebug foo.rb
Debug.rb
Emacs support available.

c:/bin/ruby/lib/ruby/site_ruby/1.8/ubygems.rb:4:require 'rubygems'
(rdb:1) b foo.rb:1
Set breakpoint 1 at foo.rb:1
(rdb:1) c
Breakpoint 1, toplevel at foo.rb:1
foo.rb:1:print "hello"
(rdb:1)

HTH,
Assaph