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
continue -- Runs until program ends, hits a breakpoint or reaches a line
delete -- Deletes breakpoints
disable -- Disables breakpoints or displays
display -- Evaluates expressions every time the debugger stops
down -- Moves to a lower frame in the stack trace
edit -- Edits source files
enable -- Enables breakpoints or displays
finish -- Runs the program until frame returns
frame -- Moves to a frame in the call stack
help -- Helps you using byebug
history -- Shows byebug's history of commands
info -- Shows several informations about the program being debugged
interrupt -- Interrupts the program
irb -- Starts an IRB session
kill -- Sends a signal to the current process
list -- Lists lines of source code
method -- Shows methods of an object, class or module
next -- Runs one or more lines of code
pry -- Starts a Pry session
ps -- Evaluates an expression and prettyprints & sort the result
quit -- Exits byebug
restart -- Restarts the debugged program
save -- Saves current byebug session to a file
set -- Modifies byebug settings
show -- Shows byebug settings
source -- Restores a previously saved byebug session
step -- Steps into blocks or methods one or more times
thread -- Commands to manipulate threads
tracevar -- Enables tracing of a global variable
undisplay -- Stops displaying all or some expressions when program stops
untracevar -- Stops tracing a global variable
up -- Moves to a higher frame in the stack trace
var -- Shows variables and its values
where -- Displays the backtrace
I looked all over and I cannot find a way to "continue without breakpoints". The only way I can think of is to remove or comment the byebug
statements, quit with q!
and restart the test.
How can I continue without stopping at other byebug
statements in Ruby?
Typing finish in the console exits byebug, without closing pry/rails console/rails server. Ctrl + D also works.
Byebug is a Ruby 2 debugger. It's implemented using the Ruby 2 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.
Below steps can be followed to integrate debug gem in VSCode. Install extension VSCode rdbg Ruby Debugger - Visual Studio Marketplace in your VSCode. Open the file you want to debug in the VSCode. Register the breakpoint by clicking on the line you want to set the breakpoint and press the F9 key.
To get going, simply type byebug (or debugger ) into your source file at the line you're interested in and run the program. If you're running it on a Rails application, remember to switch to your terminal window to look at debugger output.
You can use continue!
or alias c!
since byebug 11.0.0.
See this PR https://github.com/deivid-rodriguez/byebug/pull/524
If you are working with Rails, you may wanna reset it back on new request, than you can add a filter:
# application_controller.rb
before_action do
if defined?(Byebug) && Byebug.mode == :off && Rails.env.development?
Byebug.mode = nil
end
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With