byebug
byebug copied to clipboard
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!
No, it doesn't. I never implemented the jump
command cause it seemed difficult to implement. Sorry.... :(
No worries. To me, Byebug as a whole looks really difficult to implement!
Closing since it sounds like there are no immediate plans for a jump command. If ever it shows up I'd certainly use it.
Actually, let's leave it open so I remember that a least one user wants this!
By the way, debugger
gem includes a jump
command so that can be a starting point for someone willing to implement this.
I have started a fork-based timetraveling byebug extension -- here is my branch, but I'm refactoring it into a byebug plugin which I hope to gemify into byebug-timetravel.
https://github.com/awwaiid/byebug/commit/a4911d936056a15b942bac178acb9d68f5c8ee38
Interesting. As I understand it, this allows you to "rollback" next
commands, right?
Would be great if that feature will exist someday :+1:
I also want it :+1:
+1
+1
I've continued to work on one approach to this, now extracted out into a pry plugin at https://github.com/awwaiid/pry-timetravel . Recently I've figured out how to write a test suite for it, and am working on auto-snapshotting. It was easier and more general-purpose to work my approach into a pry plugin.
Cool, @awwaiid. Will check it out!
Cool, I'll follow your work!
This is also useful to skip a line of code in the forward direction.
+1
Well as a minor unhelpful update, I ran into a significant issue with the fork-based approach when working on anything that has threads .... which includes Rails which is the main app that I personally would use it on. I haven't gone back and research this in a number of years though. The approach is pretty extreme, so maybe there is a less-insane version of jumping.