A Partial-Multiverse Model of Time Travel for Debugging · A Partial-Multiverse Model of Time...

23
A Partial-Multiverse Model of Time Travel for Debugging RubyConf 2014 Brock Wilcox [email protected] [email protected]

Transcript of A Partial-Multiverse Model of Time Travel for Debugging · A Partial-Multiverse Model of Time...

Page 1: A Partial-Multiverse Model of Time Travel for Debugging · A Partial-Multiverse Model of Time Travel for Debugging RubyConf 2014 Brock Wilcox awwaiid@thelackthereof.org bwilcox@optoro.com

A Partial-Multiverse Modelof Time Travelfor Debugging

RubyConf 2014

Brock [email protected]@optoro.com

Page 2: A Partial-Multiverse Model of Time Travel for Debugging · A Partial-Multiverse Model of Time Travel for Debugging RubyConf 2014 Brock Wilcox awwaiid@thelackthereof.org bwilcox@optoro.com

ABSTRACT:

Ever type 'next' into your debugger and then realize you should have used 'step'? Or perhaps invoked a method that you wish you could take back? Regret no more! Just turn the clock back a few ticks and begin again! With only a few restrictions and side-effects we will learn how to construct and use a time machine.

WARNING: Time travel may cause zombies.

Page 3: A Partial-Multiverse Model of Time Travel for Debugging · A Partial-Multiverse Model of Time Travel for Debugging RubyConf 2014 Brock Wilcox awwaiid@thelackthereof.org bwilcox@optoro.com

Debuggers

Page 4: A Partial-Multiverse Model of Time Travel for Debugging · A Partial-Multiverse Model of Time Travel for Debugging RubyConf 2014 Brock Wilcox awwaiid@thelackthereof.org bwilcox@optoro.com

Byebug(demo)

Page 5: A Partial-Multiverse Model of Time Travel for Debugging · A Partial-Multiverse Model of Time Travel for Debugging RubyConf 2014 Brock Wilcox awwaiid@thelackthereof.org bwilcox@optoro.com

How does THAT work‽(demo)

Page 6: A Partial-Multiverse Model of Time Travel for Debugging · A Partial-Multiverse Model of Time Travel for Debugging RubyConf 2014 Brock Wilcox awwaiid@thelackthereof.org bwilcox@optoro.com

Sweet

Page 7: A Partial-Multiverse Model of Time Travel for Debugging · A Partial-Multiverse Model of Time Travel for Debugging RubyConf 2014 Brock Wilcox awwaiid@thelackthereof.org bwilcox@optoro.com

OK. What could be better?

Page 8: A Partial-Multiverse Model of Time Travel for Debugging · A Partial-Multiverse Model of Time Travel for Debugging RubyConf 2014 Brock Wilcox awwaiid@thelackthereof.org bwilcox@optoro.com

MAD SCIENCE

Page 9: A Partial-Multiverse Model of Time Travel for Debugging · A Partial-Multiverse Model of Time Travel for Debugging RubyConf 2014 Brock Wilcox awwaiid@thelackthereof.org bwilcox@optoro.com

The Idea

Page 10: A Partial-Multiverse Model of Time Travel for Debugging · A Partial-Multiverse Model of Time Travel for Debugging RubyConf 2014 Brock Wilcox awwaiid@thelackthereof.org bwilcox@optoro.com

fork() the universe during 'next'

Page 11: A Partial-Multiverse Model of Time Travel for Debugging · A Partial-Multiverse Model of Time Travel for Debugging RubyConf 2014 Brock Wilcox awwaiid@thelackthereof.org bwilcox@optoro.com

Suspend the child fork

Page 12: A Partial-Multiverse Model of Time Travel for Debugging · A Partial-Multiverse Model of Time Travel for Debugging RubyConf 2014 Brock Wilcox awwaiid@thelackthereof.org bwilcox@optoro.com

Keep track of all created child forks

Page 13: A Partial-Multiverse Model of Time Travel for Debugging · A Partial-Multiverse Model of Time Travel for Debugging RubyConf 2014 Brock Wilcox awwaiid@thelackthereof.org bwilcox@optoro.com

Upon 'prev', grab the most recent child fork

Page 14: A Partial-Multiverse Model of Time Travel for Debugging · A Partial-Multiverse Model of Time Travel for Debugging RubyConf 2014 Brock Wilcox awwaiid@thelackthereof.org bwilcox@optoro.com

Resume (time-travel!) the previous child fork

Page 15: A Partial-Multiverse Model of Time Travel for Debugging · A Partial-Multiverse Model of Time Travel for Debugging RubyConf 2014 Brock Wilcox awwaiid@thelackthereof.org bwilcox@optoro.com

Unix Processes & Forks(demo)

Page 16: A Partial-Multiverse Model of Time Travel for Debugging · A Partial-Multiverse Model of Time Travel for Debugging RubyConf 2014 Brock Wilcox awwaiid@thelackthereof.org bwilcox@optoro.com

So... "fork" byebug!(demo)

Page 17: A Partial-Multiverse Model of Time Travel for Debugging · A Partial-Multiverse Model of Time Travel for Debugging RubyConf 2014 Brock Wilcox awwaiid@thelackthereof.org bwilcox@optoro.com

Limitations

Page 18: A Partial-Multiverse Model of Time Travel for Debugging · A Partial-Multiverse Model of Time Travel for Debugging RubyConf 2014 Brock Wilcox awwaiid@thelackthereof.org bwilcox@optoro.com

Can only travel back to checkpoints

Page 19: A Partial-Multiverse Model of Time Travel for Debugging · A Partial-Multiverse Model of Time Travel for Debugging RubyConf 2014 Brock Wilcox awwaiid@thelackthereof.org bwilcox@optoro.com

"Partial" time-travel

Page 20: A Partial-Multiverse Model of Time Travel for Debugging · A Partial-Multiverse Model of Time Travel for Debugging RubyConf 2014 Brock Wilcox awwaiid@thelackthereof.org bwilcox@optoro.com

Zombies

Page 21: A Partial-Multiverse Model of Time Travel for Debugging · A Partial-Multiverse Model of Time Travel for Debugging RubyConf 2014 Brock Wilcox awwaiid@thelackthereof.org bwilcox@optoro.com

Might crash the multiverse throughmemory exauhstion, I guess

Page 22: A Partial-Multiverse Model of Time Travel for Debugging · A Partial-Multiverse Model of Time Travel for Debugging RubyConf 2014 Brock Wilcox awwaiid@thelackthereof.org bwilcox@optoro.com

References

https://github.com/TomOnTime/timetravelpdb

Page 23: A Partial-Multiverse Model of Time Travel for Debugging · A Partial-Multiverse Model of Time Travel for Debugging RubyConf 2014 Brock Wilcox awwaiid@thelackthereof.org bwilcox@optoro.com

THE END