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
1
vote
1 answer

Make byebug stay in scope/function after running last line

Say I'm debugging a function like this def foo { byebug x = 1+1 } Running this, we hit the breakpoint. If I now hit "n", it runs the next line and exits the function. How can I instead remain in the function and inspect x?
mahemoff
  • 44,526
  • 36
  • 160
  • 222
1
vote
1 answer

Format byebug's output

I've recently done a fresh install of my system and I'm seeing some odd behaviour from byebug. For instance, arrays are listed on element on line instead of having everything on the same line. Here is an example: (byebug) [1,2,3] 1 2 3 Normally, I…
linkyndy
  • 17,038
  • 20
  • 114
  • 194
1
vote
2 answers

Rails Testing Default Value in database fails

Ok, so I am running a Postgres database in Rails 4 and for one of my models Offer the attribute :offer_status should default to declined. Here is my migration: def change create_table :offers do |t| t.integer :offer_status, default: 0 …
ChiefRockaChris
  • 643
  • 5
  • 21
1
vote
0 answers

Ruby debugger 'Byebug' step into Issue

Adding byebug in code for debugging ,when i entered 's' for step into method it say byebug/history.rb:118:in `[]': invalid index (IndexError) Please Help me out
gaurav
  • 421
  • 1
  • 6
  • 16
1
vote
2 answers

IRB called from byebug loses context

When I call IRB from a byebug breakpoint I seem not to be in the expected context. Is this a bug or am I doing something incredibly stupid? $ ruby -v ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-darwin14] $ ruby test.rb test [3, 12] in…
Matthias Winkelmann
  • 15,870
  • 7
  • 64
  • 76
1
vote
1 answer

Could not find byebug-3.5.1 in any of the sources

I am making a rather simple Rails app with Rails 4.1.6. Initially, I used Ruby version 1.9.3 (which is what I used for another project, and this Ruby version was set as default), but half way through the app I decided to change the Ruby version to…
azangru
  • 2,644
  • 5
  • 34
  • 55
0
votes
0 answers

New entry is created with all values as nil in Rails API

I am using Postman to make a Post request to my Rails backend and the new entry is created successfully with all values being 'nil'. I can see that the parameters are being passed into the request as expected but I cannot figure out why they aren't…
0
votes
1 answer

Error when trying to install Byebug with bundle

The gemfile requires installation of byebug 5.0.0, and I ran the bundle to get all setup. However, byebug installation failed The error message: Fetching byebug 5.0.0 Installing byebug 5.0.0 with native extensions Gem::Ext::BuildError: ERROR: Failed…
0
votes
1 answer

An error occurred while installing byebug (8.2.1), and Bundler cannot continue

I try to run 'bundle install' but i have this problem with byebug gem. This is my setup rails 4.2.2 ruby 2.3.1 with rbenv Mac OS 11.6.2 Thanks for your…
0
votes
1 answer

When I add a byebug statement to my code the bug I was investigating disappears

I have run across a strange bug I'm not sure how to solve. I am trying to make a program that solves Wordle in the browser using Ruby and Selenium. I noticed that starting with the second guess, the program would just keep guessing the same word…
Calvin0125
  • 26
  • 3
0
votes
0 answers

Byebug not responding to commands?

I have been having an issue lately. When trying to debug anything I run my file and use Byebug. However when I run any command on Byebug my main menu command line of terminal appears. Ex: *****$: ruby file.rb require "byebug" debugger 1: def…
0
votes
2 answers

Passing arguments while debugging

I'm attempting to debug a Ruby script, but I am unable to access one method as seen below. def move_objects(target_folder) s3_objects.each do |obj| binding.pry new_key = s3_folder ? obj.key.sub(s3_folder, target_folder) :…
user16741832
0
votes
1 answer

Rails Byebug gem: How to create a conditional breakpoint on a variable assignment?

How do I create a conditional breakpoint in Byebug about a variable assignment? This is more an event than a condition. But how would you proceed if you do not know where in the code the assignment could happen? Watching a variable in step by step…
von spotz
  • 875
  • 7
  • 17
0
votes
0 answers

ByeBug or Pry not running on one of the controllers on Rails app

I have two controllers, One lets me use byebug and pry, the other just skips it, not sure why. Wondering if anyone has ran into a similar issue. I have installed pry and byebug correctly for it to work on one of the controllers, i try to import and…
0
votes
1 answer

Why does include? for Ruby return false?

I have the following Ruby fragment from a byebug session: (byebug) target_name "foo/" (byebug) target_name.class String (byebug) target_name.include?('/') false (byebug) "foo/".include?('/') true Why does the include? method return false as / is…
Michel Keijzers
  • 15,025
  • 28
  • 93
  • 119