Git Product home page Git Product logo

byebug's Introduction

Byebug

Version Tidelift Gitter

Byebug is a simple to use and feature rich debugger for Ruby. It uses the TracePoint API for execution control and the Debug Inspector API for call stack navigation. Therefore, Byebug doesn't depend on internal core sources. Byebug is also fast because it is developed as a C extension and reliable because it is supported by a full test suite.

The debugger permits the ability to understand what is going on inside a Ruby program while it executes and offers many of the traditional debugging features such as:

  • Stepping: Running your program one line at a time.
  • Breaking: Pausing the program at some event or specified instruction, to examine the current state.
  • Evaluating: Basic REPL functionality, although pry does a better job at that.
  • Tracking: Keeping track of the different values of your variables or the different lines executed by your program.

For enterprise

Byebug for enterprise is available via the Tidelift Subscription. Learn more.

Build Status

ubuntu windows

Requirements

  • Required: MRI 2.5.0 or higher.
  • Recommended: MRI 2.6.4 or higher (MRI 2.6.0 to 2.6.3 contain a regression causing unbalanced call/return events in some cases, breaking the next command).

Install

gem install byebug

Alternatively, if you use bundler:

bundle add byebug --group "development, test"

Usage

From within the Ruby code

Simply include byebug wherever you want to start debugging and the execution will stop there. For example, if you were debugging Rails, you would add byebug to your code:

def index
  byebug
  @articles = Article.find_recent
end

And then start a Rails server:

bin/rails s

Once the execution gets to your byebug command, you will receive a debugging prompt.

From the command line

If you want to debug a Ruby script without editing it, you can invoke byebug from the command line.

byebug myscript.rb

Byebug's commands

Command Aliases Subcommands
backtrace bt w where
break b
catch cat
condition cond
continue c cont
continue! c! cont!
debug
delete del
disable dis breakpoints display
display disp
down
edit ed
enable en breakpoints display
finish fin
frame f
help h
history hist
info i args breakpoints catch display file line program
interrupt int
irb
kill
list l
method m instance
next n
pry
quit q
quit! q!
restart
save sa
set autoirb autolist autopry autosave basename callstyle fullpath histfile histsize linetrace listsize post_mortem savefile stack_on_error width
show autoirb autolist autopry autosave basename callstyle fullpath histfile histsize linetrace listsize post_mortem savefile stack_on_error width
skip sk
source so
step s
thread th current list resume stop switch
tracevar tr
undisplay undisp
untracevar untr
up
var v all constant global instance local

Semantic Versioning

Byebug attempts to follow semantic versioning and bump major version only when backwards incompatible changes are released. Backwards compatibility is targeted to pry-byebug and any other plugins relying on byebug.

Getting Started

Read byebug's markdown guide to get started. Proper documentation will be eventually written.

Related projects

  • pry-byebug adds next, step, finish, continue and break commands to pry using byebug.
  • ruby-debug-passenger adds a rake task that restarts Passenger with Byebug connected.
  • minitest-byebug starts a byebug session on minitest failures.
  • sublime_debugger provides a plugin for ruby debugging on Sublime Text.
  • atom-byebug provides integration with the Atom editor [EXPERIMENTAL].

Contribute

See Getting Started with Development.

Funding

Subscribe to Tidelift to ensure byebug stays actively maintained, and at the same time get licensing assurances and timely security notifications for your open source dependencies.

You can also help byebug by leaving a small (or big) tip through Liberapay.

Security contact information

Please use the Tidelift security contact to report a security vulnerability. Tidelift will coordinate the fix and disclosure.

Credits

Everybody who has ever contributed to this forked and reforked piece of software, especially:

  • @ko1, author of the awesome TracePoint API for Ruby.
  • @cldwalker, debugger's maintainer.
  • @denofevil, author of debase, the starting point of this.
  • @kevjames3 for testing, bug reports and the interest in the project.
  • @FooBarWidget for working and helping with remote debugging.

byebug's People

Contributors

arthurnn avatar astashov avatar bak1an avatar bquorning avatar ddzz avatar deivid-rodriguez avatar dependabot-preview[bot] avatar dependabot-support avatar dependabot[bot] avatar eagletmt avatar eric-hu avatar firelizzard18 avatar foobarwidget avatar guilherme avatar jonatack avatar josephks avatar k0kubun avatar larrykooper avatar msp-greg avatar os97673 avatar rudyonrails avatar sergioro9 avatar shuky19 avatar terceiro avatar tzmfreedom avatar utkarsh2102 avatar wikimatze avatar windwiny avatar x-yuri avatar yui-knk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

byebug's Issues

INTERNAL ERROR!!! That frame doesn't exist!

I have no idea what causes this, but when I insert a breakpoint into one of my classes and try to print the stack, this happens:

(byebug) backtrace
--> #0  AddressKit::Correction::GoogleGeocodingCorrectionDriver.correct(address#AddressKit::Entities:...)
      at /mnt/hgfs/Dropbox/Kvantel/Address Kit/lib/address_kit/correction/google_geocoding_correction_driver.rb:21
    #1  AddressKit::Correction::GoogleGeocodingCorrectionDriver.block (2 levels) in 
      at /mnt/hgfs/Dropbox/Kvantel/Address Kit/specs/address_kit/correction/google_geocoding_correction_driver_spec.rb:41
    #2  MiniTest::Unit::TestCase.run(runner#MiniTest::Unit) at /home/tomas/ruby2/lib/ruby/2.0.0/minitest/unit.rb:1301
    #3  MiniTest::Unit.block in _run_suite(suite#Class, type#Symbol) at /home/tomas/ruby2/lib/ruby/2.0.0/minitest/unit.rb:919
    #4  Array.map(frame_no#Fixnum) at /home/tomas/ruby2/lib/ruby/2.0.0/minitest/unit.rb:912
    #5  MiniTest::Unit._run_suite(suite#Class, type#Symbol) at /home/tomas/ruby2/lib/ruby/2.0.0/minitest/unit.rb:912
    #6  MiniTest::Unit.block in _run_suites(suites#Array, type#Symbol) at /home/tomas/ruby2/lib/ruby/2.0.0/minitest/unit.rb:899
    #7  Array.map(frame_no#Fixnum) at /home/tomas/ruby2/lib/ruby/2.0.0/minitest/unit.rb:899
    #8  MiniTest::Unit._run_suites(suites#Array, type#Symbol) at /home/tomas/ruby2/lib/ruby/2.0.0/minitest/unit.rb:899
    #9  MiniTest::Unit._run_anything(type#Symbol) at /home/tomas/ruby2/lib/ruby/2.0.0/minitest/unit.rb:867
    #10 MiniTest::Unit.run_tests at /home/tomas/ruby2/lib/ruby/2.0.0/minitest/unit.rb:1060
    #11 MiniTest::Unit.block in _run(args#Array) at /home/tomas/ruby2/lib/ruby/2.0.0/minitest/unit.rb:1047
    #12 Array.each(frame_no#Fixnum) at /home/tomas/ruby2/lib/ruby/2.0.0/minitest/unit.rb:1046
    #13 MiniTest::Unit._run(args#Array) at /home/tomas/ruby2/lib/ruby/2.0.0/minitest/unit.rb:1046
    #14 MiniTest::Unit.run(args#Array) at /home/tomas/ruby2/lib/ruby/2.0.0/minitest/unit.rb:1035
    #15 #.block in autorun at /home/tomas/ruby2/lib/ruby/2.0.0/minitest/unit.rb:789
INTERNAL ERROR!!! That frame doesn't exist!
        /home/tomas/ruby2/lib/ruby/gems/2.0.0/gems/byebug-1.4.0/lib/byebug/commands/frame.rb:90:in `frame_file'
        /home/tomas/ruby2/lib/ruby/gems/2.0.0/gems/byebug-1.4.0/lib/byebug/commands/frame.rb:90:in `print_frame'
        /home/tomas/ruby2/lib/ruby/gems/2.0.0/gems/byebug-1.4.0/lib/byebug/commands/frame.rb:85:in `block in print_backtrace'
        /home/tomas/ruby2/lib/ruby/gems/2.0.0/gems/byebug-1.4.0/lib/byebug/commands/frame.rb:84:in `each'
        /home/tomas/ruby2/lib/ruby/gems/2.0.0/gems/byebug-1.4.0/lib/byebug/commands/frame.rb:84:in `print_backtrace'
        /home/tomas/ruby2/lib/ruby/gems/2.0.0/gems/byebug-1.4.0/lib/byebug/commands/frame.rb:170:in `execute'
        /home/tomas/ruby2/lib/ruby/gems/2.0.0/gems/byebug-1.4.0/lib/byebug/processor.rb:264:in `one_cmd'
        /home/tomas/ruby2/lib/ruby/gems/2.0.0/gems/byebug-1.4.0/lib/byebug/processor.rb:248:in `block (2 levels) in process_commands'
        /home/tomas/ruby2/lib/ruby/gems/2.0.0/gems/byebug-1.4.0/lib/byebug/processor.rb:247:in `each'
        /home/tomas/ruby2/lib/ruby/gems/2.0.0/gems/byebug-1.4.0/lib/byebug/processor.rb:247:in `block in process_commands'
        /home/tomas/ruby2/lib/ruby/gems/2.0.0/gems/byebug-1.4.0/lib/byebug/processor.rb:240:in `catch'
        /home/tomas/ruby2/lib/ruby/gems/2.0.0/gems/byebug-1.4.0/lib/byebug/processor.rb:240:in `process_commands'
        /home/tomas/ruby2/lib/ruby/gems/2.0.0/gems/byebug-1.4.0/lib/byebug/processor.rb:157:in `at_line'
        (eval):5:in `block in at_line'
        (eval):3:in `synchronize'
        (eval):3:in `at_line'
        /home/tomas/ruby2/lib/ruby/gems/2.0.0/gems/byebug-1.4.0/lib/byebug/context.rb:52:in `at_line'
        /mnt/hgfs/Dropbox/Kvantel/Address Kit/lib/address_kit/correction/google_geocoding_correction_driver.rb:21:in `correct'
        /mnt/hgfs/Dropbox/Kvantel/Address Kit/specs/address_kit/correction/google_geocoding_correction_driver_spec.rb:41:in `block (2 levels) in '
        /home/tomas/ruby2/lib/ruby/2.0.0/minitest/unit.rb:1301:in `run'
        /home/tomas/ruby2/lib/ruby/2.0.0/minitest/unit.rb:919:in `block in _run_suite'
        /home/tomas/ruby2/lib/ruby/2.0.0/minitest/unit.rb:912:in `map'
        /home/tomas/ruby2/lib/ruby/2.0.0/minitest/unit.rb:912:in `_run_suite'
        /home/tomas/ruby2/lib/ruby/2.0.0/minitest/unit.rb:899:in `block in _run_suites'
        /home/tomas/ruby2/lib/ruby/2.0.0/minitest/unit.rb:899:in `map'
        /home/tomas/ruby2/lib/ruby/2.0.0/minitest/unit.rb:899:in `_run_suites'
        /home/tomas/ruby2/lib/ruby/2.0.0/minitest/unit.rb:867:in `_run_anything'
        /home/tomas/ruby2/lib/ruby/2.0.0/minitest/unit.rb:1060:in `run_tests'
        /home/tomas/ruby2/lib/ruby/2.0.0/minitest/unit.rb:1047:in `block in _run'
        /home/tomas/ruby2/lib/ruby/2.0.0/minitest/unit.rb:1046:in `each'
        /home/tomas/ruby2/lib/ruby/2.0.0/minitest/unit.rb:1046:in `_run'
        /home/tomas/ruby2/lib/ruby/2.0.0/minitest/unit.rb:1035:in `run'
        /home/tomas/ruby2/lib/ruby/2.0.0/minitest/unit.rb:789:in `block in autorun'.[16, 25] in /mnt/hgfs/Dropbox/Kvantel/Address Kit/lib/address_kit/correction/google_geocoding_correction_driver.rb
   16:       def correct(address)
   17:         debug { "Correcting address: #{address}" }
   18:
   19:         byebug
   20:
=> 21:         results = @client.address_search address
   22:
   23:         if results.length > 1
   24:           debug { "Got more than one result from Google Geocoding" }
   25:           out = AddressKit::Correction::CorrectionResult.new address
(byebug)

Hopefully you can extrapolate what the issue is from the stack trace.

Byebug version 1.4.0

Warning at breakpoint.c:281 in 2.2.0 causes compilation to fail

I can't install 2.2.0 on OS X 10.8.5, XCode 4.6.3 because of a warning caused in breakpoint.c:281

cc1: warnings being treated as errors
breakpoint.c: In function โ€˜brkpt_removeโ€™:
breakpoint.c:281: warning: unused parameter โ€˜selfโ€™
make: *** [breakpoint.o] Error 1

I believe I can find a flag to avoid treating warnings as errors and have the ext compile, but I'd be great if this warning were fixed.

If it involves too much refactoring to remove self from the method signature, then maybe just adding a dumb line with self could be a workaround ?

Alias/Input History for continue

This is a really minor "issue" and it's probably a personal preference, but I use byebug quite significantly while designing capybara tests (it's a great way to pause execution when you want to look at what the browser is doing) and I'm finding it slightly frustrating having to type "continue" all the time.

For some reason continue doesn't save itself in the input history (whereas commands like quit do).

Would it be possible to either

  • Alias "continue" to something short, like "go"?
  • Allow continue to somehow persist in the history (so I'd just have to hit up-arrow to get to it)

Appreciating the hard work on this. It's really useful for those parts of Rails that the better-errors gem can't get to.

using byebug breaks rails 4 application

I've got this strange problem that only begins to appear after i add a byebug command inside of a controller in my rails 4 app.

After that the view is throwing an error about 50% of the time, otherwise it just renders fine. i get the following error:

Started GET "/" for 127.0.0.1 at 2014-02-17 15:21:59 +0100
Processing by WelcomeController#index as HTML
Rendered welcome/index.slim within layouts/application (0.2ms)
Completed 500 Internal Server Error in 24ms

ActionView::Template::Error (no implicit conversion from nil to integer):
/home/goltergaul/.rbenv/versions/2.1.0/lib/ruby/2.1.0/timeout.rb:73:in `block (2 levels) in timeout'

This also causes my webrick terminal not to be responding to ctrl+c commands at all.

steps to reproduce:

  1. I add byebug inside of my controller action
  2. I navigate my browser to that controller and start an irb session at that breakpoint
  3. i exit the irb and continue
  4. i remove byebug from the controller
  5. now only 50% of the requests produce no error and my terminal can't be terminated by pressing ctrl+c anymore

Line 73 in timeout.rb is:

    y = Thread.start {
      begin
        sleep sec
      rescue => e
        x.raise e
      else
        x.raise exception, message
      end
    }

My OS version is Ubuntu 13.04

RubyGems Environment:

RUBYGEMS VERSION: 2.2.0
RUBY VERSION: 2.1.0 (2013-12-25 patchlevel 0) [x86_64-linux]
INSTALLATION DIRECTORY: /home/goltergaul/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0
RUBY EXECUTABLE: /home/goltergaul/.rbenv/versions/2.1.0/bin/ruby
EXECUTABLE DIRECTORY: /home/goltergaul/.rbenv/versions/2.1.0/bin
SPEC CACHE DIRECTORY: /home/goltergaul/.gem/specs
RUBYGEMS PLATFORMS:
ruby
x86_64-linux
GEM PATHS:
/home/goltergaul/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0
/home/goltergaul/.gem/ruby/2.1.0
GEM CONFIGURATION:
:update_sources => true
:verbose => true
:backtrace => false
:bulk_threshold => 1000
REMOTE SOURCES:
https://rubygems.org/
SHELL PATH:
/home/goltergaul/.rbenv/versions/2.1.0/bin
/home/goltergaul/.rbenv/libexec
/home/goltergaul/.rbenv/plugins/ruby-build/bin
/usr/local/texlive/2013/bin/x86_64-linux
/home/goltergaul/.rbenv/shims
/home/goltergaul/.rbenv/bin
/usr/local/sbin
/usr/local/bin
/usr/sbin
/usr/bin
/sbin
/bin
/usr/games
/usr/local/games

here is my corresponding stackoverflow question: http://stackoverflow.com/questions/21831638/random-error-when-rendering-rails-4-view-after-using-byebug

Lambda's and the Stack Trace

Consider the following code when run with byebug

$list = []

a = lambda {|x| return $list.push x}

listToAdd = [1,2,3] * 5
while not listToAdd.empty? do
    a.call(listToAdd.pop)
end
byebug
simpleStatement = 1

When I call backtrace, I get the following

#0  <main> at C:/Grits/thread_trial.rb:10
#1  <main> at C:/Grits/thread_trial.rb:7
#2  <main> at C:/Grits/thread_trial.rb:7
#3  <main> at C:/Grits/thread_trial.rb:7
#4  <main> at C:/Grits/thread_trial.rb:7
#5  <main> at C:/Grits/thread_trial.rb:7
#6  <main> at C:/Grits/thread_trial.rb:7
#7  <main> at C:/Grits/thread_trial.rb:7
#8  <main> at C:/Grits/thread_trial.rb:7
#9  <main> at C:/Grits/thread_trial.rb:7
#10 <main> at C:/Grits/thread_trial.rb:7
#11 <main> at C:/Grits/thread_trial.rb:7
#12 <main> at C:/Grits/thread_trial.rb:7
#13 <main> at C:/Grits/thread_trial.rb:7
#14 <main> at C:/Grits/thread_trial.rb:7
#15 <main> at C:/Grits/thread_trial.rb:7

This is using byebug 1.3.0, I tried do with 1.4.2 but I got the following instead:

(byebug) backtrace
--> #0  <top (required)> at C:/Grits/thread_trial.rb:10
    #1  #<Class:Byebug>.debug_load(frame_no#Fixnum) at C:/Ruby200/lib/ruby/gems/2.0.0/gems/byebug-1.4.2/bin/byebug:82
    #2  Object.debug_program(options#OpenStruct) at C:/Ruby200/lib/ruby/gems/2.0.0/gems/byebug-1.4.2/bin/byebug:82
    #3  block in <top (required)> at C:/Ruby200/lib/ruby/gems/2.0.0/gems/byebug-1.4.2/bin/byebug:251
    #4  Kernel.loop(frame_no#Fixnum) at C:/Ruby200/lib/ruby/gems/2.0.0/gems/byebug-1.4.2/bin/byebug:249
    #5  <top (required)> at C:/Ruby200/lib/ruby/gems/2.0.0/gems/byebug-1.4.2/bin/byebug:249
    #6  Kernel.load(frame_no#Fixnum) at C:/Ruby200/bin/byebug:23
    #7  <main> at C:/Ruby200/bin/byebug:23
INTERNAL ERROR!!! That frame doesn't exist!
        C:/Ruby200/lib/ruby/gems/2.0.0/gems/byebug-1.4.2/lib/byebug/commands/frame.rb:90:in `frame_file'
        C:/Ruby200/lib/ruby/gems/2.0.0/gems/byebug-1.4.2/lib/byebug/commands/frame.rb:90:in `print_frame'
        C:/Ruby200/lib/ruby/gems/2.0.0/gems/byebug-1.4.2/lib/byebug/commands/frame.rb:85:in `block in print_backtrace'
        C:/Ruby200/lib/ruby/gems/2.0.0/gems/byebug-1.4.2/lib/byebug/commands/frame.rb:84:in `each'
        C:/Ruby200/lib/ruby/gems/2.0.0/gems/byebug-1.4.2/lib/byebug/commands/frame.rb:84:in `print_backtrace'
        C:/Ruby200/lib/ruby/gems/2.0.0/gems/byebug-1.4.2/lib/byebug/commands/frame.rb:169:in `execute'
        C:/Ruby200/lib/ruby/gems/2.0.0/gems/byebug-1.4.2/lib/byebug/processor.rb:265:in `one_cmd'
        C:/Ruby200/lib/ruby/gems/2.0.0/gems/byebug-1.4.2/lib/byebug/processor.rb:249:in `block (2 levels) in process_comm
        C:/Ruby200/lib/ruby/gems/2.0.0/gems/byebug-1.4.2/lib/byebug/processor.rb:248:in `each'
        C:/Ruby200/lib/ruby/gems/2.0.0/gems/byebug-1.4.2/lib/byebug/processor.rb:248:in `block in process_commands'
        C:/Ruby200/lib/ruby/gems/2.0.0/gems/byebug-1.4.2/lib/byebug/processor.rb:241:in `catch'
        C:/Ruby200/lib/ruby/gems/2.0.0/gems/byebug-1.4.2/lib/byebug/processor.rb:241:in `process_commands'
        C:/Ruby200/lib/ruby/gems/2.0.0/gems/byebug-1.4.2/lib/byebug/processor.rb:158:in `at_line'
        (eval):5:in `block in at_line'
        (eval):3:in `synchronize'
        (eval):3:in `at_line'
        C:/Ruby200/lib/ruby/gems/2.0.0/gems/byebug-1.4.2/lib/byebug/context.rb:52:in `at_line'
        C:/Grits/thread_trial.rb:10:in `<top (required)>'
        C:/Ruby200/lib/ruby/gems/2.0.0/gems/byebug-1.4.2/bin/byebug:82:in `debug_load'
        C:/Ruby200/lib/ruby/gems/2.0.0/gems/byebug-1.4.2/bin/byebug:82:in `debug_program'
        C:/Ruby200/lib/ruby/gems/2.0.0/gems/byebug-1.4.2/bin/byebug:251:in `block in <top (required)>'
        C:/Ruby200/lib/ruby/gems/2.0.0/gems/byebug-1.4.2/bin/byebug:249:in `loop'
        C:/Ruby200/lib/ruby/gems/2.0.0/gems/byebug-1.4.2/bin/byebug:249:in `<top (required)>'
        C:/Ruby200/bin/byebug:23:in `load'
        C:/Ruby200/bin/byebug:23:in `<main>'The program finished.

This may already be related to the open issue #7.

Following about my system:

  • Windows 7
  • Ruby Build: ruby 2.0.0p247 (2013-06-27) [i386-mingw32]
  • Gem Version: 2.0.3
  • DevKit Version: DevKit-mingw64-32-4.7.2-20130224-1151-sfx.exe

IGNORED_FILES slows down startup

I recently switched to Pry and also installed the pry-byebug gem for debugger integration, but noticed that Pry startup sometimes takes several seconds to almost half a minute. After some digging I found that the byebug gem does a recursive search of the current directory in its initialization, which explains my problem since my Pry shortcut runs in my home directory :)

It would be great to do this search more efficiently, or delay it until Byebug is used for the first time.

Break on application-code only

Hi,

Byebug is great and it seems to be a lot less buggy than debugger so thumbs up! However, the issue I'm running into is that whenever I step in, byebug (and also debugger) would step in too deep, or into a chunk of code that's somewhere deep in the gem. Obviously I don't want to step thru any gem code or external library but focus only on my current application's code.

My question/suggestion is that if there's a way to filter or skip over external library, or a setting to step into the next line that belongs to a script within the current application. For example, step into a method call will skip over any Rails's internal script or any currently-used gem and stop at the next line of the file that's inside the application. This will greatly reduce the tediousness of stepping into the app and help pin-pointing the issue. Currently it's quite time consuming to setup the correct breakpoint, and usually it's a hit-or-miss and having to run the test suite multiple times just to figure out the correct breakpoint placement.

Something like a configuration to list the path or locations to resume the debugger when stepping in automatically would be a great start.

Calling "next" pushes the frame onto the stack - incorrectly reports the backtrace

Hello,

I noticed that calling "next" in a loop incorrectly pushes the frame onto the stack. You can see this by running the following program with byebug.

def hi
    5.times do |foo|
        next
    end
end

hi
byebug
a = 3

The execution is as follows

[1, 9] in C:/Users/kjmcinto/Desktop/foo.rb
=> 1: def hi
   2:   5.times do |foo|
   3:           next
   4:   end
   5: end
   6:
   7: hi
   8: byebug
   9: a = 3
(byebug) c
[1, 9] in C:/Users/kjmcinto/Desktop/foo.rb
   1: def hi
   2:   5.times do |foo|
   3:           next
   4:   end
   5: end
   6:
   7: hi
   8: byebug
=> 9: a = 3
(byebug) backtrace
--> #0  <main> at C:/Users/kjmcinto/Desktop/foo.rb:9
    #1  Object.hi at C:/Users/kjmcinto/Desktop/foo.rb:3
    #2  Object.hi at C:/Users/kjmcinto/Desktop/foo.rb:3
    #3  Integer.times at C:/Users/kjmcinto/Desktop/foo.rb:2
    #4  Object.hi at C:/Users/kjmcinto/Desktop/foo.rb:2
    #5  <main> at C:/Users/kjmcinto/Desktop/foo.rb:7
(byebug)

I would expect something else, like

(byebug) backtrace
--> #0  <main> at C:/Users/kjmcinto/Desktop/foo.rb:9

"caller (0)" correctly reports the stack-trace, however the output includes the byebug output.

Other Information:

  • byebug (1.2.0)
  • OS (Windows 7, 64bit)
  • "gem env" output as follows
RubyGems Environment:
  - RUBYGEMS VERSION: 2.0.0
  - RUBY VERSION: 2.0.0 (2013-02-24 patchlevel 0) [i386-mingw32]
  - INSTALLATION DIRECTORY: C:/Ruby200/lib/ruby/gems/2.0.0
  - RUBY EXECUTABLE: C:/Ruby200/bin/ruby.exe
  - EXECUTABLE DIRECTORY: C:/Ruby200/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86-mingw32
  - GEM PATHS:
     - C:/Ruby200/lib/ruby/gems/2.0.0
     - C:/Users/kjmcinto.AMR/.gem/ruby/2.0.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
     - :sources => ["http://rubygems.org/"]
     - "http_proxy" => "http://proxy.fm.intel.com:911/"
     - "benchmark" => false
  - REMOTE SOURCES:
     - http://rubygems.org/

How to connect to remote debugging session without debugger

Hello, please pardon this potentially dumb question:

I'm coming from debugger. I see that since v1.8.0 byebug has remote debugging facilities, however I'm still unsure how I connect from the command line without using both byebug and the debugger gem.

If I use both byebug and debugger, I can connect easily:

# in remote process
Byebug.start_server

# on console using debugger
> rdebug -c 

Is there a way I can connect without using debugger?

Thanks!

Support code syntax highlighting

How I impress with byebug and it works well, but if we could get the code syntax highlighting, it will be great. I have tried pry-byebug, but it seems it hasn't supported the latest version from byebug yet.

Atom editor plugin

Have you heard if any efforts towards building an Atom editor plugin for byebug? #15 makes it sound possible. I'd be interested in hacking something together as a fun project, but wanted to get your thoughts on it first.

๐Ÿป for this awesome gem.

byebug reports an internal error when the inspect method raises.

Example code:

require 'rubygems'
require 'byebug'

class Foo
  def inspect
    raise "Broken"
  end
end

@foo = Foo.new
byebug
puts "Bar"

Output:

iblue@alchemist ~/byebug-bug $ ruby ./bug.rb 

[3, 12] in ./bug.rb
    3: 
    4: class Foo
    5:   def inspect
    6:     raise "Broken"
    7:   end
    8: end
    9: 
   10: @foo = Foo.new
   11: byebug
=> 12: puts "Bar"

(byebug) p @foo
INTERNAL ERROR!!! Broken
    ./bug.rb:6:in `inspect'
    /home/iblue/.rvm/gems/ruby-2.0.0-p247/gems/byebug-2.0.0/lib/byebug/commands/eval.rb:52:in `block in execute'
    /home/iblue/.rvm/gems/ruby-2.0.0-p247/gems/byebug-2.0.0/lib/byebug/commands/eval.rb:21:in `run_with_binding'
    /home/iblue/.rvm/gems/ruby-2.0.0-p247/gems/byebug-2.0.0/lib/byebug/commands/eval.rb:51:in `execute'
    /home/iblue/.rvm/gems/ruby-2.0.0-p247/gems/byebug-2.0.0/lib/byebug/processor.rb:216:in `one_cmd'
    /home/iblue/.rvm/gems/ruby-2.0.0-p247/gems/byebug-2.0.0/lib/byebug/processor.rb:202:in `block (2 levels) in process_commands'
    /home/iblue/.rvm/gems/ruby-2.0.0-p247/gems/byebug-2.0.0/lib/byebug/processor.rb:201:in `each'
    /home/iblue/.rvm/gems/ruby-2.0.0-p247/gems/byebug-2.0.0/lib/byebug/processor.rb:201:in `block in process_commands'
    /home/iblue/.rvm/gems/ruby-2.0.0-p247/gems/byebug-2.0.0/lib/byebug/processor.rb:194:in `catch'
    /home/iblue/.rvm/gems/ruby-2.0.0-p247/gems/byebug-2.0.0/lib/byebug/processor.rb:194:in `process_commands'
    /home/iblue/.rvm/gems/ruby-2.0.0-p247/gems/byebug-2.0.0/lib/byebug/processor.rb:112:in `at_line'
    (eval):5:in `block in at_line'
    (eval):3:in `synchronize'
    (eval):3:in `at_line'
    /home/iblue/.rvm/gems/ruby-2.0.0-p247/gems/byebug-2.0.0/lib/byebug/context.rb:59:in `at_line'
    ./bug.rb:12:in `<main>'Bar

Byebug just reports an internal error and continues executing the code (note the "Bar" at the end). Instead it should just show that @foo.inspect raises and should not continue with the code.

The example may seem arbitrary, but in some cases inspect may raise an exception. For example in Sequel, when an SQL query bound to a Model contains more or less parameters than placeholders and it tries to output the SQL query in inspect.

Sourcing of ~/.rdebugrc not supported

It would be great if byebug supports sourcing the ~/.rdebugrc file. Mine looks like this:

set autoeval
set autolist
set autoreload
set listsize 20

When I break into byebug, the list size is always at 10 until I run the set listsize 20 command manually.

INTERNAL ERROR!!! A copy of #<Class:Byebug> has been removed

When trying to set a breakpoint, below exceptions are thrown. I can reproduce it with my app but have no idea how to show the problem to you.

Is this a bug of byebug?


INTERNAL ERROR!!! A copy of # has been removed from the module tree but is still active!
        ~/.rvm/gems/ruby-2.0.0-p353@rails4/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:446:in `load_missing_constant'
        ~/.rvm/gems/ruby-2.0.0-p353@rails4/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:184:in `const_missing'
        ~/.rvm/gems/ruby-2.0.0-p353@rails4/gems/byebug-2.7.0/lib/byebug.rb:64:in `add_breakpoint'
        ~/.rvm/gems/ruby-2.0.0-p353@rails4/gems/byebug-2.7.0/lib/byebug/commands/breakpoints.rb:70:in `execute'
        ~/.rvm/gems/ruby-2.0.0-p353@rails4/gems/byebug-2.7.0/lib/byebug/command_processor.rb:200:in `one_cmd'
        ~/.rvm/gems/ruby-2.0.0-p353@rails4/gems/byebug-2.7.0/lib/byebug/command_processor.rb:186:in `block (2 levels) in process_commands'
        ~/.rvm/gems/ruby-2.0.0-p353@rails4/gems/byebug-2.7.0/lib/byebug/command_processor.rb:185:in `each'
        ~/.rvm/gems/ruby-2.0.0-p353@rails4/gems/byebug-2.7.0/lib/byebug/command_processor.rb:185:in `block in process_commands'
        ~/.rvm/gems/ruby-2.0.0-p353@rails4/gems/byebug-2.7.0/lib/byebug/command_processor.rb:178:in `catch'
        ~/.rvm/gems/ruby-2.0.0-p353@rails4/gems/byebug-2.7.0/lib/byebug/command_processor.rb:178:in `process_commands'
        ~/.rvm/gems/ruby-2.0.0-p353@rails4/gems/byebug-2.7.0/lib/byebug/command_processor.rb:93:in `at_line'
        ~/.rvm/gems/ruby-2.0.0-p353@rails4/gems/byebug-2.7.0/lib/byebug/command_processor.rb:53:in `block in at_line'
        ~/.rvm/gems/ruby-2.0.0-p353@rails4/gems/byebug-2.7.0/lib/byebug/command_processor.rb:51:in `synchronize'
        ~/.rvm/gems/ruby-2.0.0-p353@rails4/gems/byebug-2.7.0/lib/byebug/command_processor.rb:51:in `at_line'
        ~/.rvm/gems/ruby-2.0.0-p353@rails4/gems/byebug-2.7.0/lib/byebug/context.rb:82:in `at_line'
        ~/.rvm/gems/ruby-2.0.0-p353@rails4/gems/actionpack-4.0.2/lib/action_controller/metal.rb:129:in `session'

Remote debugging support

Please support remote debugging, i.e. the ability to attach a debugger console to an existing process. The debugger gem supports this. This feature is essential for Ruby processes that don't have a terminal, e.g. Ruby apps run under Phusion Passenger.

Unable to install 2.7.0

Attempting to install via "sudo gem install byebug" on a late 2013 MacBookPro running OS X v10.9.2

Building native extensions.  This could take a while...
ERROR:  Error installing byebug:
    ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
creating Makefile

make "DESTDIR="
compiling breakpoint.c
compiling byebug.c
compiling context.c
context.c:622:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
1 warning generated.
compiling locker.c
compiling threads.c
linking shared-object byebug/byebug.bundle
clang: error: unknown argument: '-multiply_definedsuppress' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
make: *** [byebug.bundle] Error 1

Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/byebug-2.7.0 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/gems/byebug-2.7.0/ext/byebug/gem_make.out

Byebug continues when next command is used.

Often when stopped at a byebug debugger in my code, I will input next ('n'), but my server continues execution as though I clicked continue. I have tried with several different servers: puma, webrick, and thin, and all have this problem. However, it does not seem to be a problem when running a rails console or when I replace byebug in my server code with the new ruby 2.0 debugger.

screen shot 2013-11-15 at 1 47 13 pm

IRB completion seems broken

byebug 2.7.0
rails 3.2.17
irb 0.9.6
ruby 2.1.1

When I'm in a debugging session in one of my rails (3.2.17) initializers and hit Tab, I get the following exception.

lINTERNAL ERROR!!! undefined method `workspace' for nil:NilClass
    /home/benni/.rbenv/versions/2.1.1/lib/ruby/2.1.0/irb/completion.rb:39:in `block in <module:InputCompletor>'
    /home/benni/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/byebug-2.7.0/lib/byebug/interfaces/local_interface.rb:70:in `call'
    /home/benni/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/byebug-2.7.0/lib/byebug/interfaces/local_interface.rb:70:in `readline'
    /home/benni/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/byebug-2.7.0/lib/byebug/interfaces/local_interface.rb:70:in `readline'
    /home/benni/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/byebug-2.7.0/lib/byebug/interfaces/local_interface.rb:25:in `read_command'
    /home/benni/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/byebug-2.7.0/lib/byebug/command_processor.rb:175:in `process_commands'
    /home/benni/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/byebug-2.7.0/lib/byebug/command_processor.rb:93:in `at_line'
    /home/benni/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/byebug-2.7.0/lib/byebug/command_processor.rb:53:in `block in at_line'
    /home/benni/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/byebug-2.7.0/lib/byebug/command_processor.rb:51:in `synchronize'
    /home/benni/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/byebug-2.7.0/lib/byebug/command_processor.rb:51:in `at_line'
    /home/benni/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/byebug-2.7.0/lib/byebug/context.rb:82:in `at_line'

[New Feature Request] Threading in ByeBug

Is there an ETA for establishing thread support in the debugger? As in that I get to choose which thread I am debugging in a multi-threaded program.

Right now, the stack trace for a breakpoint includes all the context switches between threads.

Stack frame off by one?

Using byebug with my Rails 4 app (Ruby 2), and whenever I hit a breakpoint, it appears I'm always one level deeper in the stack than where the 'byebug' statement is in my code.

Has anyone else seen this and know a fix? e.g. my stack output will be:

--> #0  ActionController::StrongParameters.params
      at /Users/joe/.rvm/gems/ruby-2.1.0@proj/gems/actionpack-4.0.3/lib/action_controller/metal/strong_parameters.rb:515
    #1  Api::V1::UsersController.device at /Users/joe/workspace/proj/app/controllers/api/v1/users_controller.rb:137
    #2  ActionController::ImplicitRender.send_action(method#String, *args#Array)

even though my breakpoint is at stack frame 1, so I always have to issue an 'up' command to get to the right place.

INTERNAL ERROR!!! invalid byte sequence in UTF-8

Steps to reproduce the error:
rails g scaffold posts
then run the test as bellow,

$ byebug ruby -Itest test/controllers/posts_controller_test.rb -n test_should_get_index
/home/pan/.rbenv/versions/2.1.1/gemsets/rails4_1/gems/byebug-3.1.2/bin/byebug:220: warning: already initialized constant Byebug::PROG_SCRIPT
/home/pan/.rbenv/versions/2.1.1/gemsets/rails4_1/gems/byebug-3.1.2/lib/byebug.rb:21: warning: previous definition of PROG_SCRIPT was here

[1, 10] in /home/pan/.rbenv/versions/2.1.1/bin/ruby
**INTERNAL ERROR!!! invalid byte sequence in UTF-8**
        /home/pan/.rbenv/versions/2.1.1/gemsets/rails4_1/gems/byebug-3.1.2/lib/byebug/interface.rb:27:in `gsub'
        /home/pan/.rbenv/versions/2.1.1/gemsets/rails4_1/gems/byebug-3.1.2/lib/byebug/interface.rb:27:in `escape'
        /home/pan/.rbenv/versions/2.1.1/gemsets/rails4_1/gems/byebug-3.1.2/lib/byebug/interfaces/local_interface.rb:21:in `print'
        /home/pan/.rbenv/versions/2.1.1/gemsets/rails4_1/gems/byebug-3.1.2/lib/byebug/commands/list.rb:100:in `block in display_list'
        /home/pan/.rbenv/versions/2.1.1/gemsets/rails4_1/gems/byebug-3.1.2/lib/byebug/commands/list.rb:97:in `upto'
        /home/pan/.rbenv/versions/2.1.1/gemsets/rails4_1/gems/byebug-3.1.2/lib/byebug/commands/list.rb:97:in `display_list'
        /home/pan/.rbenv/versions/2.1.1/gemsets/rails4_1/gems/byebug-3.1.2/lib/byebug/commands/list.rb:21:in `execute'
        /home/pan/.rbenv/versions/2.1.1/gemsets/rails4_1/gems/byebug-3.1.2/lib/byebug/processors/command_processor.rb:126:in `block in always_run'
        /home/pan/.rbenv/versions/2.1.1/gemsets/rails4_1/gems/byebug-3.1.2/lib/byebug/processors/command_processor.rb:126:in `each'
        /home/pan/.rbenv/versions/2.1.1/gemsets/rails4_1/gems/byebug-3.1.2/lib/byebug/processors/command_processor.rb:126:in `always_run'
        /home/pan/.rbenv/versions/2.1.1/gemsets/rails4_1/gems/byebug-3.1.2/lib/byebug/processors/command_processor.rb:155:in `process_commands'
        /home/pan/.rbenv/versions/2.1.1/gemsets/rails4_1/gems/byebug-3.1.2/lib/byebug/processors/command_processor.rb:89:in `at_line'
        /home/pan/.rbenv/versions/2.1.1/gemsets/rails4_1/gems/byebug-3.1.2/lib/byebug/processors/command_processor.rb:49:in `block in at_line'
        /home/pan/.rbenv/versions/2.1.1/gemsets/rails4_1/gems/byebug-3.1.2/lib/byebug/processors/command_processor.rb:47:in `synchronize'
        /home/pan/.rbenv/versions/2.1.1/gemsets/rails4_1/gems/byebug-3.1.2/lib/byebug/processors/command_processor.rb:47:in `at_line'
        /home/pan/.rbenv/versions/2.1.1/gemsets/rails4_1/gems/byebug-3.1.2/lib/byebug/context.rb:78:in `at_line'
        /home/pan/.rbenv/versions/2.1.1/bin/ruby:1:in `<top (required)>'
        /home/pan/.rbenv/versions/2.1.1/gemsets/rails4_1/gems/byebug-3.1.2/bin/byebug:70:in `debug_load'
        /home/pan/.rbenv/versions/2.1.1/gemsets/rails4_1/gems/byebug-3.1.2/bin/byebug:70:in `debug_program'
        /home/pan/.rbenv/versions/2.1.1/gemsets/rails4_1/gems/byebug-3.1.2/bin/byebug:246:in `block in <top (required)>'
        /home/pan/.rbenv/versions/2.1.1/gemsets/rails4_1/gems/byebug-3.1.2/bin/byebug:245:in `loop'
        /home/pan/.rbenv/versions/2.1.1/gemsets/rails4_1/gems/byebug-3.1.2/bin/byebug:245:in `<top (required)>'
        /home/pan/.rbenv/versions/2.1.1/gemsets/rails4_1/bin/byebug:23:in `load'
        /home/pan/.rbenv/versions/2.1.1/gemsets/rails4_1/bin/byebug:23:in `<main>'#<NameError: uninitialized constant ELF>
["/home/pan/.rbenv/versions/2.1.1/bin/ruby:1:in `<top (required)>'", "/home/pan/.rbenv/versions/2.1.1/gemsets/rails4_1/gems/byebug-3.1.2/bin/byebug:70:in `debug_load'", "/home/pan/.rbenv/versions/2.1.1/gemsets/rails4_1/gems/byebug-3.1.2/bin/byebug:70:in `debug_program'", "/home/pan/.rbenv/versions/2.1.1/gemsets/rails4_1/gems/byebug-3.1.2/bin/byebug:246:in `block in <top (required)>'", "/home/pan/.rbenv/versions/2.1.1/gemsets/rails4_1/gems/byebug-3.1.2/bin/byebug:245:in `loop'", "/home/pan/.rbenv/versions/2.1.1/gemsets/rails4_1/gems/byebug-3.1.2/bin/byebug:245:in `<top (required)>'", "/home/pan/.rbenv/versions/2.1.1/gemsets/rails4_1/bin/byebug:23:in `load'", "/home/pan/.rbenv/versions/2.1.1/gemsets/rails4_1/bin/byebug:23:in `<main>'"]

Rails debugging - byebug starts on production environment

If I forget a "byebug" command in the code and it gets deployed to production, byebug stops on the breakpoint.

When I used debugger gem it used to skip "debugger" commands.
I tried Byebug.stop() in config/environments/production.rb - didn't work.

Is there any way I can make byebug disabled for production?

Thanks.

Puma + Rails + byebug wrong context

If I use byebug (1.3.1) with puma and rails 4 the context is set to the wrong value in the debugger:

rails s Puma -u

   10:   def password_auth
   11:     byebug
=> 12:     self.resource = build_resource(sign_up_params)
   ...
(byebug) self
#<Puma::ThreadPool::AutoTrim:0x007fbfe2e9d208 @pool=#<Puma::ThreadPool:0x007fbfe2e9e2e8 @cond=#<ConditionVariable:0x007fbfe2e9e1d0 @waiters={}, @waiters_mutex=#<Mutex:0x007fbfe2e9e0b8>>, @mutex=#<Mutex:0x007fbfe2e9df78>, @todo=[], @spawned=1, @waiting=0, @min=0, @max=16, @block=#<Proc:0x007fbfe2e9e298@/Users/glebm/.rvm/gems/ruby-2.0.0-p195@zuigo/gems/puma-2.0.1/lib/puma/server.rb:128>, @extra=[Puma::IOBuffer], @shutdown=false, @trim_requested=0, @workers=[#<Thread:0x007fbfde6655f8 run>], @auto_trim=#<Puma::ThreadPool::AutoTrim:0x007fbfe2e9d208 ...>>, @timeout=1, @running=true, @thread=#<Thread:0x007fbfe2e9cfd8 sleep>>

Remote debugging with Unicorn

Hi, I'm trying to setup remote debugging with Unicorn without success.

I haven't been able to find any documentation about how to achieve it.

If I set up Byebug.start_server in the before_hook it starts the debugger but then I can't connect to the workers.

If I try on after_hook it says the ports are already in use.

Any help would be greatly appreciated.

Thanks

Initializing Objects and the Stack Trace

Consider the following code and run with byebug

class Foo
    def initialize(param1,param2,param3)
        @param1 = param1
        @param2 = param2
        @param3 = param3
        b(param1,param2)
    end
end

def a(paramater)
    return Foo.new(paramater, "mostStuff", "blah")
end

def b(otherParamater, somethingElse)
    byebug
    hi = paramater
    return hi
end

a("yo")

When calling the backtrace, the wrong stack is yielded - a class instance is pushed onto the call stack (see number 2 on the stack below).

(byebug) backtrace
--> #0  Object.b(otherParamater#String, somethingElse#String)
      at C:/Grits/thread_trial.rb:16
    #1  Foo.initialize(param1#String, param2#String, param3#String)
      at C:/Grits/thread_trial.rb:6
    #2  Class.new(frame_no#Fixnum) at C:/Grits/thread_trial.rb:11
    #3  Object.a(paramater#String) at C:/Grits/thread_trial.rb:11
    #4  <top (required)> at C:/Grits/thread_trial.rb:21

This may once again related to the TracePoint API bugs. ByeBug version that this is found with is 1.6.1 on Windows 7. Does not exist with byebug 1.3.0

Byebug.start breaks Timeout::timeout

Failing test here: https://github.com/jordoh/byebug/tree/failing_timeout_test

ruby -v
ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin12.3.0]

Test:

Byebug.start do
  Timeout::timeout(60) {}
end

Output:

Error:
TestTimeout#test_0001_call to "Timeout::timeout" after "Byebug.start" does not raise:
TypeError: no implicit conversion from nil to integer
    /Users/jordan/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/timeout.rb:57:in `block in timeout'

Problems Compiling ByeBug 1.5.0/1.6.0

When trying to install/compile ByeBug 1.5.0/1.6.0 on Windows 7, I get the following output

C:\>gem install byebug -v 1.6.0
Building native extensions.  This could take a while...
ERROR:  Error installing byebug:
        ERROR: Failed to build gem native extension.

    C:/Ruby200/bin/ruby.exe extconf.rb
creating Makefile

make "DESTDIR="
generating byebug-i386-mingw32.def
compiling breakpoint.c
In file included from c:/Ruby200/include/ruby-2.0.0/ruby/defines.h:153:0,
                 from c:/Ruby200/include/ruby-2.0.0/ruby/ruby.h:70,
                 from c:/Ruby200/include/ruby-2.0.0/ruby.h:33,
                 from ./byebug.h:4,
                 from breakpoint.c:1:
c:/Ruby200/include/ruby-2.0.0/ruby/win32.h: In function 'rb_w32_pow':
c:/Ruby200/include/ruby-2.0.0/ruby/win32.h:787:5: error: implicit declaration of function '_controlfp' [-Werror=implicit-function-declaration]
c:/Ruby200/include/ruby-2.0.0/ruby/win32.h:788:16: error: '_PC_64' undeclared (first use in this function)
c:/Ruby200/include/ruby-2.0.0/ruby/win32.h:788:16: note: each undeclared identifier is reported only once for each function it appears in
c:/Ruby200/include/ruby-2.0.0/ruby/win32.h:788:24: error: '_MCW_PC' undeclared (first use in this function)
cc1.exe: all warnings being treated as errors
make: *** [breakpoint.o] Error 1


Gem files will remain installed in C:/Ruby200/lib/ruby/gems/2.0.0/gems/byebug-1.6.0 for inspection.
Results logged to C:/Ruby200/lib/ruby/gems/2.0.0/gems/byebug-1.6.0/ext/byebug/gem_make.out

This issue did not occur with byebug version <= 1.4.2

Following about my system:

  • Windows 7 - 64 bit
  • Ruby Build: ruby 2.0.0p247 (2013-06-27) [i386-mingw32]
  • Gem Version: 2.0.3
  • DevKit Version: DevKit-mingw64-32-4.7.2-20130224-1151-sfx.exe

INTERNAL ERROR!!! wrong number of arguments (0 for 1)

Seem to have run into a bug with calling Byebug in this application: https://gist.github.com/trenchwarfare/7145075

INTERNAL ERROR!!! wrong number of arguments (0 for 1)
    redflag2.rb:7:in `block (2 levels) in <main>'
    /Users/czempel/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/bundler/gems/byebug-319be9a74c72/lib/byebug/processor.rb:132:in `block in always_run'
    /Users/czempel/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/bundler/gems/byebug-319be9a74c72/lib/byebug/processor.rb:132:in `select'
    /Users/czempel/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/bundler/gems/byebug-319be9a74c72/lib/byebug/processor.rb:132:in `always_run'
    /Users/czempel/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/bundler/gems/byebug-319be9a74c72/lib/byebug/processor.rb:177:in `process_commands'
    /Users/czempel/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/bundler/gems/byebug-319be9a74c72/lib/byebug/processor.rb:106:in `at_line'
    (eval):5:in `block in at_line'
    (eval):3:in `synchronize'
    (eval):3:in `at_line'
    /Users/czempel/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/bundler/gems/byebug-319be9a74c72/lib/byebug/context.rb:77:in `at_line'
    redflag2.rb:30:in `<main>'Setting up sky

Hopped into Byebug/processor.rb on line 132 and got rid of the select to have it just return Command.commands like so:

        event_cmds = Command.commands

That fixed the problem, but there's probably a better solution than just deleting this.

There should be some way to start debugging by adding a require.

It would save a lot of time to be able to, for instance, do this:

ruby -r byebug/autostart bin/myscript.rb

Which would break on the first line of the script and allow me to set breakpoints. I dislike having to edit my files to start debugging, then have to remember to remove all the debug statements afterwards.

I imagine this would be trivial to implement as well :-)

'next' command not stepping over a line?

Apologies if I'm not understanding something, but it looks like 'next' isn't working right... it's stepping into Rails' association functions. I'm also having a similar problem with the 'debugger' gem:

'next' in byebug:

2.0.0-p247 :017 > reload!; Course.new.debuggertest
Reloading...
[1, 10] in /home/httpd/vhosts/site.org/app/models/course.rb
    1: class Course < ActiveRecord::Base
    2:   has_many :subjects, :class_name => 'CourseCurricularSubject', :foreign_key => :course_id, :dependent => :destroy, :autosave => true
    3:
    4:   def debuggertest
    5:     byebug
=>  6:     puts 'Line 2'
    7:     subject = subjects.first
    8:     puts 'Line 4'
    9:   end
   10: end
(byebug) next
Line 2
[1, 10] in /home/httpd/vhosts/site.org/app/models/course.rb
    1: class Course < ActiveRecord::Base
    2:   has_many :subjects, :class_name => 'CourseCurricularSubject', :foreign_key => :course_id, :dependent => :destroy, :autosave => true
    3:
    4:   def debuggertest
    5:     byebug
    6:     puts 'Line 2'
=>  7:     subject = subjects.first
    8:     puts 'Line 4'
    9:   end
   10: end
(byebug) next
[333, 342] in /home/user/.rvm/gems/ruby-2.0.0-p247@rails32/gems/activerecord-3.2.13/lib/active_record/associations/collection_association.rb
   333:       def load_target
   334:         if find_target?
   335:           @target = merge_target_lists(find_target, target)
   336:         end
   337:
=> 338:         loaded!
   339:         target
   340:       end
   341:
   342:       def add_to_target(record)
(byebug) 

'step' in byebug:

2.0.0-p247 :001 > reload!; Course.new.debuggertest
Reloading...
[1, 10] in /home/httpd/vhosts/site.org/app/models/course.rb
    1: class Course < ActiveRecord::Base
    2:   has_many :subjects, :class_name => 'CourseCurricularSubject', :foreign_key => :course_id, :dependent => :destroy, :autosave => true
    3:
    4:   def debuggertest
    5:     byebug
=>  6:     puts 'Line 2'
    7:     subject = subjects.first
    8:     puts 'Line 4'
    9:   end
   10: end
(byebug) step
Line 2
[1, 10] in /home/httpd/vhosts/site.org/app/models/course.rb
    1: class Course < ActiveRecord::Base
    2:   has_many :subjects, :class_name => 'CourseCurricularSubject', :foreign_key => :course_id, :dependent => :destroy, :autosave => true
    3:
    4:   def debuggertest
    5:     byebug
    6:     puts 'Line 2'
=>  7:     subject = subjects.first
    8:     puts 'Line 4'
    9:   end
   10: end
(byebug) step
[39, 48] in /home/user/.rvm/gems/ruby-2.0.0-p247@rails32/gems/activerecord-3.2.13/lib/active_record/associations/builder/association.rb
   39:       end
   40:
   41:       def define_readers
   42:         name = self.name
   43:         mixin.redefine_method(name) do |*params|
=> 44:           association(name).reader(*params)
   45:         end
   46:       end
   47:
   48:       def define_writers
(byebug)

'next' in debugger:

2.0.0-p247 :002 > reload!; Course.new.debuggertest
Reloading...
/home/httpd/vhosts/site.org/app/models/course.rb:7
puts 'Line 2'

[2, 11] in /home/httpd/vhosts/site.org/app/models/course.rb
   2    has_many :subjects, :class_name => 'CourseCurricularSubject', :foreign_key => :course_id, :dependent => :destroy, :autosave => true
   3
   4    def debuggertest
   5      require 'debugger'
   6      binding.debugger
=> 7      puts 'Line 2'
   8      subject = subjects.first
   9      puts 'Line 4'
   10    end
   11  end
(rdb:1) next
Line 2
/home/httpd/vhosts/site.org/app/models/course.rb:8
subject = subjects.first

[3, 12] in /home/httpd/vhosts/site.org/app/models/course.rb
   3
   4    def debuggertest
   5      require 'debugger'
   6      binding.debugger
   7      puts 'Line 2'
=> 8      subject = subjects.first
   9      puts 'Line 4'
   10    end
   11  end
(rdb:1) next
/home/user/.rvm/gems/ruby-2.0.0-p247@rails32/gems/activerecord-3.2.13/lib/active_record/associations/builder/association.rb:44
association(name).reader(*params)

[39, 48] in /home/user/.rvm/gems/ruby-2.0.0-p247@rails32/gems/activerecord-3.2.13/lib/active_record/associations/builder/association.rb
   39        end
   40
   41        def define_readers
   42          name = self.name
   43          mixin.redefine_method(name) do |*params|
=> 44            association(name).reader(*params)
   45          end
   46        end
   47
   48        def define_writers
(rdb:1) 

'step' in debugger:

2.0.0-p247 :001 > reload!; Course.new.debuggertest
Reloading...
/home/httpd/vhosts/site.org/app/models/course.rb:7
puts 'Line 2'

[2, 11] in /home/httpd/vhosts/site.org/app/models/course.rb
   2    has_many :subjects, :class_name => 'CourseCurricularSubject', :foreign_key => :course_id, :dependent => :destroy, :autosave => true
   3  
   4    def debuggertest
   5      require 'debugger'
   6      binding.debugger
=> 7      puts 'Line 2'
   8      subject = subjects.first
   9      puts 'Line 4'
   10    end
   11  end
(rdb:1) step
Line 2
/home/httpd/vhosts/site.org/app/models/course.rb:8
subject = subjects.first

[3, 12] in /home/httpd/vhosts/site.org/app/models/course.rb
   3  
   4    def debuggertest
   5      require 'debugger'
   6      binding.debugger
   7      puts 'Line 2'
=> 8      subject = subjects.first
   9      puts 'Line 4'
   10    end
   11  end
(rdb:1) step
/home/user/.rvm/gems/ruby-2.0.0-p247@rails32/gems/activerecord-3.2.13/lib/active_record/associations/builder/association.rb:44
association(name).reader(*params)

[39, 48] in /home/user/.rvm/gems/ruby-2.0.0-p247@rails32/gems/activerecord-3.2.13/lib/active_record/associations/builder/association.rb
   39        end
   40  
   41        def define_readers
   42          name = self.name
   43          mixin.redefine_method(name) do |*params|
=> 44            association(name).reader(*params)
   45          end
   46        end
   47  
   48        def define_writers
(rdb:1) 

Terminal echoing permanently turned off

This happens when a byebug session is active and a Unicorn request times out. It also seems to happen when a request comes in while another request is being debugged. Seen on iTerm 2 running tmux.

To replicate:

  • Create new Rails project and run the server
  • bundle exec rails g resource Thing
  • Add byebug to ThingController#index method
  • Visit /things. Byebug will become active in the Rails server console
  • Wait a minute. You'll see E, ERROR -- : worker=0 PID:7102 timeout (61s > 60s), killing
  • Hit ctrl-c. Now your terminal echo is off. (Type "reset" in shell to restore it.)

require_relative error: byebug.so

Using Rails 4.01 and Ruby 2.0.0p247 and Mac OSX 10.9 Mavericks I am having a problem loading and calling byebug anywhere inside of my app. Rest of our team has same issue.

The issue also happens when not even calling byebug and prevents all rake/rspec commands from being executed (same error).

/Users/richardjortega/.rvm/gems/ruby-2.0.0-p247@ta-web/gems/byebug-2.3.1/lib/byebug.rb:1:in `require_relative': cannot load such file -- /Users/richardjortega/.rvm/gems/ruby-2.0.0-p247@ta-web/gems/byebug-2.3.1/lib/byebug.so (LoadError)
    from /Users/richardjortega/.rvm/gems/ruby-2.0.0-p247@ta-web/gems/byebug-2.3.1/lib/byebug.rb:1:in `<top (required)>'
    from /Users/richardjortega/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
    from /Users/richardjortega/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
    from /Users/richardjortega/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
    from /Users/richardjortega/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
    from /Users/richardjortega/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
    from /Users/richardjortega/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
    from /Users/richardjortega/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
    from /Users/richardjortega/Dropbox/Code/trueability/config/application.rb:6:in `<top (required)>'
    from /Users/richardjortega/Dropbox/Code/trueability/config/environment.rb:2:in `require'
    from /Users/richardjortega/Dropbox/Code/trueability/config/environment.rb:2:in `<top (required)>'
    from /Users/richardjortega/Dropbox/Code/trueability/spec/spec_helper.rb:80:in `require'
    from /Users/richardjortega/Dropbox/Code/trueability/spec/spec_helper.rb:80:in `<top (required)>'
    from /Users/richardjortega/Dropbox/Code/trueability/spec/controllers/positions_controller_spec.rb:1:in `require'
    from /Users/richardjortega/Dropbox/Code/trueability/spec/controllers/positions_controller_spec.rb:1:in `<top (required)>'
    from /Users/richardjortega/.rvm/gems/ruby-2.0.0-p247@ta-web/gems/rspec-core-2.14.7/lib/rspec/core/configuration.rb:896:in `load'
    from /Users/richardjortega/.rvm/gems/ruby-2.0.0-p247@ta-web/gems/rspec-core-2.14.7/lib/rspec/core/configuration.rb:896:in `block in load_spec_files'
    from /Users/richardjortega/.rvm/gems/ruby-2.0.0-p247@ta-web/gems/rspec-core-2.14.7/lib/rspec/core/configuration.rb:896:in `each'
    from /Users/richardjortega/.rvm/gems/ruby-2.0.0-p247@ta-web/gems/rspec-core-2.14.7/lib/rspec/core/configuration.rb:896:in `load_spec_files'
    from /Users/richardjortega/.rvm/gems/ruby-2.0.0-p247@ta-web/gems/rspec-core-2.14.7/lib/rspec/core/command_line.rb:22:in `run'
    from /Users/richardjortega/.rvm/gems/ruby-2.0.0-p247@ta-web/gems/rspec-core-2.14.7/lib/rspec/core/runner.rb:77:in `rescue in run'
    from /Users/richardjortega/.rvm/gems/ruby-2.0.0-p247@ta-web/gems/rspec-core-2.14.7/lib/rspec/core/runner.rb:73:in `run'
    from /Users/richardjortega/.rvm/gems/ruby-2.0.0-p247@ta-web/gems/rspec-core-2.14.7/lib/rspec/core/runner.rb:17:in `block in autorun'

"No live threads left" with Timeout

I'm not sure if this is a byebug issue, but it seems there's some issue with threads or Timeout library.

It comes up in minitest based unit testing, where if I run a series of tests and debug one of them, the others all have a timeout-related error. Also in libraries using timeout, such as some HTTP clients. If I try to run the library in byebug command line, it throws this exception.

[1, 5] in ./test.rb
   1: #!/usr/bin/env ruby
   2: require 'byebug'
   3: require 'timeout'
   4: byebug
=> 5: true

(byebug) Timeout::timeout(1) {}
WARNING: No backtrace available!!/home/project/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/timeout.rb:95:in `join': No live threads left. Deadlock? (fatal)
        from /home/project/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/timeout.rb:95:in `ensure in block in timeout'
        from /home/project/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/timeout.rb:95:in `block in timeout'
        from /home/project/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/timeout.rb:35:in `block in catch'
        from /home/project/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/timeout.rb:35:in `catch'
        from /home/project/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/timeout.rb:35:in `catch'
        from /home/project/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/timeout.rb:106:in `timeout'
        from ./test.rb:5:in `<main>'
        from /home/project/.rvm/gems/ruby-2.1.1/gems/byebug-3.1.2/lib/byebug/command.rb:114:in `eval'
        from /home/project/.rvm/gems/ruby-2.1.1/gems/byebug-3.1.2/lib/byebug/command.rb:114:in `bb_warning_eval'
        from /home/project/.rvm/gems/ruby-2.1.1/gems/byebug-3.1.2/lib/byebug/commands/eval.rb:29:in `block in execute'
        from /home/project/.rvm/gems/ruby-2.1.1/gems/byebug-3.1.2/lib/byebug/commands/eval.rb:7:in `run_with_binding'
        from /home/project/.rvm/gems/ruby-2.1.1/gems/byebug-3.1.2/lib/byebug/commands/eval.rb:25:in `execute'
        from /home/project/.rvm/gems/ruby-2.1.1/gems/byebug-3.1.2/lib/byebug/processors/command_processor.rb:198:in `one_cmd'
        from /home/project/.rvm/gems/ruby-2.1.1/gems/byebug-3.1.2/lib/byebug/processors/command_processor.rb:179:in `block (2 levels) in process_commands'
        from /home/project/.rvm/gems/ruby-2.1.1/gems/byebug-3.1.2/lib/byebug/processors/command_processor.rb:178:in `each'
        from /home/project/.rvm/gems/ruby-2.1.1/gems/byebug-3.1.2/lib/byebug/processors/command_processor.rb:178:in `block in process_commands'
        from /home/project/.rvm/gems/ruby-2.1.1/gems/byebug-3.1.2/lib/byebug/processors/command_processor.rb:171:in `catch'
        from /home/project/.rvm/gems/ruby-2.1.1/gems/byebug-3.1.2/lib/byebug/processors/command_processor.rb:171:in `process_commands'
        from /home/project/.rvm/gems/ruby-2.1.1/gems/byebug-3.1.2/lib/byebug/processors/command_processor.rb:89:in `at_line'
        from /home/project/.rvm/gems/ruby-2.1.1/gems/byebug-3.1.2/lib/byebug/processors/command_processor.rb:49:in `block in at_line'
        from /home/project/.rvm/gems/ruby-2.1.1/gems/byebug-3.1.2/lib/byebug/processors/command_processor.rb:47:in `synchronize'
        from /home/project/.rvm/gems/ruby-2.1.1/gems/byebug-3.1.2/lib/byebug/processors/command_processor.rb:47:in `at_line'
        from /home/project/.rvm/gems/ruby-2.1.1/gems/byebug-3.1.2/lib/byebug/context.rb:78:in `at_line'
        from ./test.rb:5:in `<main>'

Rails debugging flag (-u) not working

So I finally got a chance to try out byebug for debugging my Ruby 2.0.0 Rails 3.2.x apps, and like the fact next does not behave like step. However, I noticed that if I uninstalled the debugger gem and then installed byebug, and fired up WEBrick, I get the following error:

$ rails server -u
=> Booting WEBrick
=> Rails 3.2.13 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
You need to install ruby-debug to run the server in debugging mode. With gems, use 'gem install ruby-debug'
Exiting

But if I put the line gem "debugger" back into my Gemfile before gem "byebug" and run bundle install, then it works just fine.

Pry has support for debugger, but not for byebug

pry-debugger integrates pry and debugger. I guess it'd be nice to have pry-byebug.

Honestly, though, I'm just using byebug as a stopgap until debugger is fixed for OSX. byebug seems nice, but a little crashy. There doesn't seem to be a compelling reason to use byebug.

Problem installin byebug

When I do "gem install byebug" this error appears:

Building native extensions.  This could take a while...
ERROR:  Error installing byebug:
    ERROR: Failed to build gem native extension.

    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
creating Makefile

make "DESTDIR="
compiling breakpoint.c
compiling byebug.c
compiling context.c
context.c:622:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
1 warning generated.
compiling locker.c
compiling threads.c
linking shared-object byebug/byebug.bundle
clang: error: unknown argument: '-multiply_definedsuppress' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
make: *** [byebug.bundle] Error 1


Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/byebug-2.7.0 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/gems/byebug-2.7.0/ext/byebug/gem_make.out

uninitialized constant StringIO error with ByeBug 1.8

Installed byebug 1.8.0 and it currently fails to execute. Program that I tried to run was a simple "Hello World" program. Byebug 1.7.0 executes without failing

Error I get is the following:

C:\>byebug foo.rb
DL is deprecated, please use Fiddle
C:/Ruby200/lib/ruby/gems/2.0.0/gems/byebug-1.8.0/bin/byebug:229:in `<top (required)>': uninitialized constant StringIO (NameError)
        from C:/Ruby200/bin/byebug:23:in `load'
        from C:/Ruby200/bin/byebug:23:in `<main>'

Ruby Version: ruby 2.0.0p247 (2013-06-27) [i386-mingw32]
OS: Windows 7 64-bit
DevKit: mingw64-32-4.7.2

Support for Spork/DebugThread

Hello!

Spork uses the DebugThread, which you seem not to have on your c ext. Why have you removed it? Can we consider putting it back in?

Cheers! ๐Ÿป

Possible to jump to a line?

I really wish I could back up two lines and re-execute them. Does byebug support setting the program counter, similar to gdb's jump command?

Alas, I just don't see a way to do it.

Thanks for a stable and super pleasant debugging tool!

gcc: error: unrecognized command line option '-Wshorten-64-to-32'

$ gem install byebug
Building native extensions. This could take a while...
ERROR: Error installing byebug:
ERROR: Failed to build gem native extension.

/Users/david/.rvm/rubies/ruby-2.0.0-p247/bin/ruby extconf.rb

creating Makefile

make "DESTDIR="
compiling breakpoint.c
gcc: error: unrecognized command line option '-Wshorten-64-to-32'
make: *** [breakpoint.o] Error 1

Gem files will remain installed in /Users/david/.rvm/gems/ruby-2.0.0-p247/gems/byebug-2.5.0 for inspection.
Results logged to /Users/david/.rvm/gems/ruby-2.0.0-p247/gems/byebug-2.5.0/ext/byebug/gem_make.out

Backspace fails when using Open3

Shout out to Deivid: Long time, no talk :). Here is an interesting bug...

require 'open3'

include Open3

Open3.popen2e('echo Hello') do |input, stdOutErr, waitThread|
   byebug
end

Try entering a series of characters, and then pressing backspace. You are unable to press backspace on the command prompt and have it register on the interface (buffer flushing problem?). Pressing enter does register the inputs.

For example, I type in byebug at the breakpoint "stdErrf", then I try to erase the 'f' with backspace, the interface does not update. However, if I press enter, the value of stdErr is returned as the underlying workings registered the keyboard input, just not the interface.

Additional Info:

Ruby Version: ruby 2.0.0p247 (2013-06-27) [i386-mingw32]
OS: Windows 7, Intel Processor
Byebug Version: 2.7.0

IDE Support

I'd like to use byebug with RubyMine. RubyMine ships with debase, and uses ruby-debug-ide to talk to it.

I have been able to hack my way to get RubyMine to load byebug instead of debase, but then the IDE times out when trying to create a remote debugging connection.

I think this is probably pretty close to working...Anyway, here are my hacked changed to ruby-debug-ide.rb starting at line 8.

  #require 'debase'
  require 'byebug'

  module Byebug
    class << self
      # Called by ruby-debug-ide, code copied from debase
      attr_accessor :keep_frame_binding
    end

    class Command
      # Called by ruby-debug-ide
      def self.control
        # The AddBreakpoint command (where is that coming from) doesn't understand allow_in_control
        if respond_to?(:allow_in_control)
          allow_in_control
        else
          false
        end
      end
    end

    # Called by ruby-debug-ide, code copied from debase
    class DebugThread < Thread
      def self.inherited
        raise RuntimeError.new("Can't inherit Debugger::DebugThread class")
      end
    end
  end

  # Code copied from debase
  ::Debugger = ::Byebug
end

Invoking from within code fails

Probably an error on my part, but ...

Invoking byebug from shell works fine, e.g.

byebug -- myprogram.rb --option1

However inserting the command

byebug

in ruby code results in, for example:

[root@ip-10-0-1-100 deploy]# ruby sshtest.bb.rb
sshtest.bb.rb:9:in <main>': undefined local variable or methodbyebug' for main:Object (NameError)

Code looks like:

[root@ip-10-0-1-100 deploy]# cat sshtest.bb.rb
require 'net/http'
require 'json'
require 'rexml/document'

require 'net/ssh'
require 'net/ssh/multi'

connect_fail_retries = 0;
byebug
begin
puts "before do",connect_fail_retries
...

What obvious thing am I missing?
Documentation says to just insert

/lib/byebug/remote.rb:56:in `initialize': Address already in use - bind(2) (Errno::EADDRINUSE)

In /initializers/byebug.rb I have following code.

if (Rails.env.development? || Rails.env.test?) && !$rails_rake_task
  require 'byebug'
  Byebug.settings[:autoeval] = true
  Byebug.settings[:autolist] = 1
  Byebug.wait_connection = true
  Byebug.start_server
end

I use pow as server. When I open app on myapp.dev/ and than try to fire up rails console in Terminal I get error:

~/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/bundler/gems/byebug-a6030f5d2dc0/lib/byebug/remote.rb:56:in `initialize': Address already in use - bind(2) (Errno::EADDRINUSE)

If pow is not running rails console fires up as is should.

How can I avoid this error?

remote debugging?

Is there any sort of support for remote debugging? It would be nice if I could debug programs that were started with say, foreman.

cannot get it to work with pow

Hi,

If I put the 'byebug' statement in one of my views in the Rails app, I get problems in the browser... mostly it's just loading indefinitelly and after some time I get:

Proxy Error

The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request GET /websites/187/backlinks.

Reason: Error reading from remote server

Am I doing something wrong?

I use: ruby-2.0.0-p247 and byebug 2.5.0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.