gpt4 book ai didi

ruby - Byebug 如何在没有断点的情况下继续

转载 作者:数据小太阳 更新时间:2023-10-29 07:52:05 25 4
gpt4 key购买 nike

使用 byebug gem 使我能够继续直到下一个断点:

(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

我找遍了,找不到“无断点继续”的方法。我能想到的唯一方法是删除或注释 byebug 语句,使用 q! 退出并重新启动测试。

我怎样才能在不停止 Ruby 中的其他 byebug 语句的情况下继续?

最佳答案

自 2019 年 2 月 15 日发布的 byebug 11.0.0 以来,您可以使用 continue! 或别名 c!

查看此 PR https://github.com/deivid-rodriguez/byebug/pull/524

如果您正在使用 Rails,您可能希望根据新请求将其重置,而不是添加过滤器:

# application_controller.rb
before_action do
if defined?(Byebug) && Byebug.mode == :off && Rails.env.development?
Byebug.mode = nil
end
end

关于ruby - Byebug 如何在没有断点的情况下继续,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36462112/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com