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
8
votes
1 answer

ByeBug Debugger working only once [Rails 4]

I'm having the problem that byebug class are ignored after the first one. It's very strange. I start the server. Whenever there is a byebug statement, if it is the first one since the server has started, it will work. If not, it will say this…
FranGoitia
  • 1,965
  • 3
  • 30
  • 49
7
votes
2 answers

How can I watch a variable in Ruby Pry?

I'm using Ruby 2.2.2, Pry and 'pry-byebug'. The continue statement removes any watched variables in have in pry-byebug: [1] pry(main)> watch foo Watching foo watch: foo => 42 [2] pry(main)> watch Listing all watched expressions: 1: foo => 42 [3]…
Sasgorilla
  • 2,403
  • 2
  • 29
  • 56
6
votes
1 answer

Using remote byebug instance with docker-compose

Is there a way to setup a rails server so that you can connect with a remote byebug server and debug easily? I've done this in the past by setting up byebug and then enabling a rails bind on 0.0.0.0 and setting a VIRTUAL_PORT=3000 but I was…
nobody
  • 7,803
  • 11
  • 56
  • 91
6
votes
1 answer

ruby: How to step into arbitrary function while debugging

Let's say I'm stopped on point while debugging: def get_data byebug => @cache ||= calculate_data end And @cache has value, so on step function calculate_data won't be executed. But I need to check what's going on inside of calculate_data at…
Daniel Garmoshka
  • 5,849
  • 39
  • 40
5
votes
0 answers

Puma and byebug/pry causes terminal corruption during concurrent requests

UPDATE: Looks like this has been a long-standing issue with Byebug: https://github.com/deivid-rodriguez/byebug/issues/487 When I run my Rails app using Puma with multiple workers in cluster mode and the app is processing concurrent requests, byebug…
Ersin Akinci
  • 164
  • 1
  • 6
5
votes
2 answers

Set conditional breakpoint with pry-byebug

Given the following code: require 'pry-byebug' 10.times.with_index do |i| binding.pry puts i end I'd like to "loop until i == 5 then break" while inside pry-byebug. From running it help break it seems like you can identify breakpoints by…
mbigras
  • 7,664
  • 11
  • 50
  • 111
5
votes
2 answers

debugger in rails with byebug not working

I have a problem when I try using debugger in rails with byebug...I installed the byebug gem without any problems ... in gemfile : group :development, :test do gem 'sqlite3' gem 'byebug' end put the debugger in my controller: class…
sam0101
  • 373
  • 1
  • 4
  • 15
4
votes
3 answers

Why is my pry-byebug package giving so much output when a command executes some error?

I had recently installed the gem pry-byebug, when I noticed it required at least Ruby version 2.4 in order to function. So I updated my Ruby using rvm, and then installed the gems pry and pry-byebug. Everything was working just fine. I started…
Bob McBobson
  • 743
  • 1
  • 9
  • 29
4
votes
1 answer

Difference between next and step in "byebug"

What the difference between "step" and "next" in "byebug". When should one use one over the other?
american-ninja-warrior
  • 7,397
  • 11
  • 46
  • 80
4
votes
2 answers

Byebug terminal output is inconsistent and buggy

Whenever I drop a debugging breakpoint with byebug, I am noticing inconsistencies with the text that I type. For instance, I am able to type the first 2-3 characters. However, after the first 2-3 characters, the terminal starts adding random square…
robskrob
  • 2,720
  • 4
  • 31
  • 58
4
votes
0 answers

Rails: Byebug doesn't print in console

From some unknown reasons, Byebug stops printing code in console. For example, I've added byebug in following test: What I've got in console / terminal: Do you have any idea what could be wrong or where could I search for a reason of this…
nicq
  • 2,182
  • 5
  • 22
  • 38
4
votes
3 answers

Debug into method from production irb

When I look for a problem, for example with a specific ActiveRecord object, I often find myself doing the following on my production system: # RAILS_ENV=production bundle exec irb(main)> article = Article.find(123) => #
4
votes
1 answer

Ruby Pry installation gives strange results?

My workstation: $ uname -a Linux dsktop 3.13.0-77-generic #121-Ubuntu SMP Wed Jan 20 10:50:42 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux $ ruby -v ruby 2.2.4p230 (2015-12-16 revision 53155) [x86_64-linux-gnu] # (also same behavior with ruby…
4
votes
2 answers

Any way to run byebug under passenger + nginx?

I developed a simple rails app which works in development environment under WEBrick. However, when I move to production environment it doesn't work. I fixed trivial errors relating to assets and things. However, some things just don't work. It would…
Adobe
  • 12,967
  • 10
  • 85
  • 126
4
votes
1 answer

Debugging foreman started app with byebug. Remote debugging connects but shows no prompt

I have foreman starting multiple apps. I have set up byebug server with a port #config/initializers/byebug.rb if Rails.env.development? require 'byebug/core' #Byebug.wait_connection = true def find_available_port server =…
jannolii
  • 86
  • 2
  • 9