Questions tagged [byebug]

Byebug is a simple to use, feature rich debugger for Ruby 2.0.

Byebug is a Ruby 2.0 debugger. It's implemented using the Ruby 2.0 TracePoint C API for execution control and the Debug Inspector C API for call stack navigation. The core component provides support that front-ends can build on. It provides breakpoint handling and bindings for stack frames among other things and it comes with an easy to use command line interface.

When your code is behaving in unexpected ways, you can try printing to logs or the console to diagnose the problem. Unfortunately, there are times when this sort of error tracking is not effective in finding the root cause of a problem. When you actually need to journey into your running source code, the debugger is your best companion.

The debugger can also help you if you want to learn about the Rails source code but don't know where to start. Just debug any request to your application and use this guide to learn how to move from the code you have written deeper into Rails code.

Homepage

Guide

119 questions
29
votes
2 answers

Rails Byebug Did Not Stop Application

I want to use byebug to debug my application but the app is never stop although I already put byebug inside my code. Here is my Gemfile. group :development, :test do # Call 'byebug' anywhere in the code to stop execution and get a debugger…
Edwin Lunando
  • 2,726
  • 3
  • 24
  • 33
29
votes
3 answers

undefined local variable or method `byebug'

I have the follwing error: NameError (undefined local variable or method `byebug' Code is def test t = "" byebug end -- RAILS_ENV=development gem list | grep bye byebug (3.5.1) then I run : RAILS_ENV=development rails s but it…
TGI
  • 559
  • 1
  • 6
  • 15
28
votes
3 answers

How to use Byebug with a remote process (e.g., pow)

How do I connect to a remote debugging instance of Byebug (for use with Pow, etc)?
Joseph Siefers
  • 1,282
  • 1
  • 12
  • 23
26
votes
2 answers

How do we access/manipulate variable names which conflicts with byebug reserved keywords?

How do we access those variable names which conflict with byebug reserved name? (byebug) var local h = {"hierarchyId"=>"59f0b029e4b037ef11a055f7", "level"=>2, ... self =
(byebug) I want to…
enator
  • 2,431
  • 2
  • 28
  • 46
22
votes
9 answers

Make Byebug finish executing without exiting Pry

When I set a breakpoint with Byebug in Rails, I sometimes want it to finish executing, but the guide on github says to use exit which also exits Pry. Typing continue repeatedly can be annoying if the breakpoint is in a loop. Is there anyway to…
user4970820
20
votes
2 answers

Rails and Byebug - How can I re-display the current line context

When I'm debugging with Byebug sometimes I evaluate some variables in the terminal which causes the displayed line context to 'go up'. Then I would like to print it again to screen. How can I do that? I thought maybe 'display' will do that but…
Eyal Levin
  • 16,271
  • 6
  • 66
  • 56
16
votes
1 answer

How to use Byebug with Sidekiq and Foreman

I have a rails application in which I use foreman to start my rails and sidekiq servers. Since foreman doesn't interact well with regular byebug (you can't see the prompt as you type), I have set up remote debugging for both my rails and sidekiq…
Tommy Steimel
  • 771
  • 8
  • 16
16
votes
4 answers

Ruby / byebug / binding.pry: How to step back?

I type next on binding.pry or byebug to step over to the next line. I use step to step into the procedure. How do I step BACK a line? I've been looking through documentation with no luck. Help greatly appreciated. Thanks.
jamesdlivesinatree
  • 1,016
  • 3
  • 11
  • 36
14
votes
1 answer

Why does the Ruby debugger return different values than the code at run time?

See this simple Ruby class: require 'byebug' class Foo def run byebug puts defined?(bar) puts bar.inspect bar = 'local string' puts defined?(bar) puts bar.inspect end def bar 'string from method' …
spickermann
  • 100,941
  • 9
  • 101
  • 131
14
votes
3 answers

How to continue without breakpoints in Byebug

Using the byebug gem gives me the ability to continue until the next breakpoint: (byebug) help break -- Sets breakpoints in the source code catch -- Handles exception catchpoints condition -- Sets conditions on breakpoints …
ardavis
  • 9,842
  • 12
  • 58
  • 112
14
votes
4 answers

Better format for byebug (with colors)

Is there a way to get a better format of output with byebug? When I print objects the output is a little hard to read, would be better with colors similar to Awesome Print.
Rich
  • 5,603
  • 9
  • 39
  • 61
10
votes
3 answers

Why doesnt byebug/pry stop at the breakpoint in Rspec ActionMailer?

I try to debug my user_mailer.rb within my test environment. But I dont know why the debugger doesnst stop where it suppose to. So, the code I roughly have is: user_mailer_spec.rb describe UserMailer do describe '#send_notification_letters' do …
Sida Zhou
  • 3,529
  • 2
  • 33
  • 48
9
votes
1 answer

Rails multiline debug in byebug or how to rescue in single line

Sometimes I need to debug some nasty exception that has its backtrace hidden or truncated, like an ArgumentError without any stack trace. I am used to debugging with byebug. The problem is that the byebug interpreter is a REPL, so it's not possible…
Cyril Duchon-Doris
  • 12,964
  • 9
  • 77
  • 164
9
votes
2 answers

Debugging in JRuby 9000

What is the best way to debug in JRuby 9000? Pry and Byebug are both MRI-dependent. All the JRuby info that I have found seem to be only for pre-9k, and are not working for my JRuby 9k setup.
RezaF
  • 123
  • 1
  • 6
8
votes
2 answers

byebug isn't displaying the output as I type

I've experienced an odd interface glitch. [44, 53] in /document.rb 44: code 45: code 46: 47: def code 48: byebug => 49: code 50: code 51: code 52: end 53: (byebug) {here is where…
1
2 3 4 5 6 7 8