Reputation: 71
scripts joe$ irb -rdebug arbo.rb
/Users/joe/.rvm/rubies/ruby-2.4.1/lib/ruby/2.4.0/x86_64- darwin16/continuation.bundle: warning: callcc is obsolete; use Fiber instead
Debug.rb
Emacs support available.
/Users/joe/.rvm/rubies/ruby-2.4.1/lib/ruby/2.4.0/irb/init.rb:23: unless @CONF[:PROMPT][@CONF[:PROMPT_MODE]]
18 IRB.init_error
19 IRB.parse_opts
20 IRB.run_config
21 IRB.load_modules
22
=> 23 unless @CONF[:PROMPT][@CONF[:PROMPT_MODE]]
24 IRB.fail(UndefinedPromptMode, @CONF[:PROMPT_MODE])
25 end
26 end
27
(rdb:1) `
It doesn't pause at the start of my program. It's pausing somewhere inside irb...
Upvotes: 0
Views: 964
Reputation: 198294
require "debug"
will stop execution after being required, as described here.
Since you're letting irb
require it for you (-rdebug
), it is stopping execution after the line that requires it: IRB.load_modules
.
Also, you should not run your program with irb
(or pry
), but with ruby
: debug
will end up fighting irb
for your standard input.
If you're using pry
, use binding.pry
instead of require "debug"
(and still invoke your code with ruby
, not pry
), like this:
require "pry"
def say(word)
binding.pry
puts word
end
say "Hello"
(and run with ruby file.rb
; or without require "pry"
, invoke with ruby -rpry file.rb
). In the same vein, you could use byebug
with byebug
instead of binding.pry
.
The other part of the text you got shows that debug
is written using continuations (for just one feature, restart
), and continuations have been marked obsolete. Pry does not use continuations.
Upvotes: 2