How do I scale the stack when debugging with byebug?

微笑、不失礼 提交于 2019-12-06 04:16:23

Answer for byebug >= 1.5.0

Printing and moving around the callstack in situations like this one should just work and the OP wouldn't have this issue.

Answer for byebug < 1.5.0 (also applicable to debugger or ruby-debug)

Byebug won't start tracking down callstack information until Byebug.start is called, which is internally called by the byebug command. So by the time you get the debugging prompt, only one callstack frame has been saved, that's why you get that message:

Warning: saved frames may be incomplete; compare with caller(0)

and that's why you can't move up or down: there's only one frame.

To properly navigate the stack, you need to start Byebug higher up, by dropping Byebug.start wherever you want to start tracking down callstack info. For example, before line 56 in google_geocoding_validation_engine_spec.rb. If you want full stack information, you can run byebug from the outset, by running the byebug executable:

byebug rake

or however you are running your specs.

If you still have issues, please let me know!

Hope this helps.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!