byebug icon indicating copy to clipboard operation
byebug copied to clipboard

Possible to jump to a line?

Open bronson opened this issue 10 years ago • 16 comments

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!

bronson avatar Apr 05 '14 09:04 bronson

No, it doesn't. I never implemented the jump command cause it seemed difficult to implement. Sorry.... :(

deivid-rodriguez avatar Apr 05 '14 16:04 deivid-rodriguez

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.

bronson avatar Apr 06 '14 01:04 bronson

Actually, let's leave it open so I remember that a least one user wants this!

deivid-rodriguez avatar Apr 06 '14 07:04 deivid-rodriguez

By the way, debugger gem includes a jump command so that can be a starting point for someone willing to implement this.

deivid-rodriguez avatar Apr 07 '14 11:04 deivid-rodriguez

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

awwaiid avatar Jun 07 '14 14:06 awwaiid

Interesting. As I understand it, this allows you to "rollback" next commands, right?

deivid-rodriguez avatar Jun 12 '14 14:06 deivid-rodriguez

Would be great if that feature will exist someday :+1:

lucasldemello avatar Sep 30 '14 10:09 lucasldemello

I also want it :+1:

nafaabout avatar Dec 18 '14 16:12 nafaabout

+1

george-carlin avatar Apr 24 '15 08:04 george-carlin

+1

Edderic avatar Aug 28 '15 14:08 Edderic

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.

awwaiid avatar Aug 28 '15 14:08 awwaiid

Cool, @awwaiid. Will check it out!

Edderic avatar Aug 28 '15 15:08 Edderic

Cool, I'll follow your work!

deivid-rodriguez avatar Aug 28 '15 16:08 deivid-rodriguez

This is also useful to skip a line of code in the forward direction.

MaxPleaner avatar Dec 14 '16 19:12 MaxPleaner

+1

marcello-telles avatar Sep 16 '22 15:09 marcello-telles

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.

awwaiid avatar Sep 16 '22 20:09 awwaiid