News for hackers. Stuff that matters.
Re:Leaving Mozilla by neves on Wednesday March 02, 2016 @01:49PM (#11212033)
I've never heard about rr http://rr-project.org/), his tool to record program execution and debug it afterwards. The alleged 1.2x slowdown in execution is negligible. The ability to reverse in time is almost a nirvana. I'm sad I didn't have it when I used to program C++. Hope he succeeds in his new endeavor. We'd all win big.

Does anyone knows of similar tools for Python and in-browser Javascript?

Re:Leaving Mozilla by cpeterso on Wednesday March 02, 2016 @02:57PM (#11212533)
Mozilla is prototyping a feature called "WebReplay" to support reverse-debugging of JavaScript and DOM mutation:

https://developer.mozilla.org/en-US/docs/Mozilla/Projects/We...

https://bugzilla.mozilla.org/show_bug.cgi?id=1207696

It looks like Microsoft is implementing a similar time-travel feature in Chakra:

https://github.com/Microsoft/ChakraCore/commits/TimeTravelDe...

Re:Leaving Mozilla by jc4p on Wednesday March 02, 2016 @04:09PM (#11213023)
For Python my coworker (and friend) Tom has a great project called timetravelpdb: http://everythingsysadmin.com/2014/04/time-travel-pdb.html explains a bit on it, the repo is https://github.com/TomOnTime/timetravelpdb

Basically it's an extension of pdb that allows you to jump back and forth in time.

Re:Leaving Mozilla by ninjaranter on Wednesday March 02, 2016 @02:01PM (#11212121)
Re: Javascript - If you use the'redux' (http://redux.js.org/) framework you can get something like this (https://github.com/gaearon/redux-devtools-dock-monitor)
Re:Leaving Mozilla by jeswin on Wednesday March 02, 2016 @05:43PM (#11213656)
I understand you never claimed they are similar. But to be fair (and with due credit to redux for being a great framework), all redux does is save method call arguments in an array. rr is on a different scale altogether.
Re:Leaving Mozilla by reaktivo on Wednesday March 02, 2016 @05:28PM (#11213561)
I was really impressed when finding out about Microsoft's Chakra JS engine Time travelling debugger[1], I think that's what you're looking for, haven't tried it myself though.

[1] https://youtu.be/1bfDB3YPHFI?t=304

Re:Leaving Mozilla by StevePerkins on Wednesday March 02, 2016 @03:02PM (#11212572)
If I'm understanding this correctly, then Java has had it for ages now via the "Chronon" debugger. It's the only reason why I pay for an IntelliJ Ultimate Edition license, since it comes bundled.
Re:Leaving Mozilla by microcolonel on Wednesday March 02, 2016 @03:21PM (#11212704)
There are other reversible debuggers, but even a mature one like Chronon has more overhead than this. 1.2x is basically nothing.
Re:Leaving Mozilla by easytiger on Thursday March 03, 2016 @04:54AM (#11215911)
Not if you have > 1 busy thread.
Re:Leaving Mozilla by tolmasky on Wednesday March 02, 2016 @08:07PM (#11214352)
No exactly the same thing but Tonic has similar capabilities using CRIU (checkpoint and restore in user space) for Javascript time traveling: http://blog.tonicdev.com/2015/09/10/time-traveling-in-node.j...

It's an interesting different approach because it allows you to rewind the entire machine, so you can interact with interactions between different processes, etc (happy to answer questions, I am a dev on it)

Re:Leaving Mozilla by shimon on Wednesday March 02, 2016 @03:37PM (#11212819)
If you're willing to accept things that compile to in-browser javascript, check out Elm's magical time-traveling debugger: http://debug.elm-lang.org/
Re:Leaving Mozilla by martindale on Wednesday March 02, 2016 @04:45PM (#11213286)
I'm building something like this for in-browser Javascript, but in a larger context. We're not ready for public consumption yet, but: https://fabric.fm
Re:Leaving Mozilla by jamiecollinson on Thursday March 03, 2016 @12:49AM (#11215257)
Interesting! Tried to subscribe but got an error: {"code":-5000}
Re:Leaving Mozilla by pgbovine on Wednesday March 02, 2016 @02:02PM (#11212123)
the python case is interesting ... after all, the interpreter is just another binary executable. perhaps there's a way to write a layer above rr to "step" in Python code rather than the underlying C code. same with JS (Node.js) or any other language run-time.
Re:Leaving Mozilla by pflanze on Thursday March 03, 2016 @04:20AM (#11215808)
Seems rr is using fork for its implementation. The first time I've seen this approach taken is in Ocaml's debugger.[1]

[1] http://caml.inria.fr/pub/docs/manual-ocaml/debugger.html

Re:Leaving Mozilla by xigency on Wednesday March 02, 2016 @02:22PM (#11212269)
Sounds very similar Green Hills Software's TimeMachine for embedded applications.
Re:Leaving Mozilla by dingo_bat on Wednesday March 02, 2016 @03:06PM (#11212601)
TimeMachine needs a specialized hardware probe connected via JTAG, if I'm not mistaken. The probe is powerful enough to record everything (registers, operations, etc) in its memory without affecting the embedded device. Then you can replay the info however you want, in as much detail as you like.

The feature here is more like software emulation, and it will really allow you to take the instruction pointer in reverse direction. Unlike TimeMachine which records in real time and let's you browse the recorded data as you wish, but after execution has occurred.

Re:Leaving Mozilla by yitchelle on Wednesday March 02, 2016 @04:00PM (#11212973)
My thoughts were very similar to yours. In 1992, when I started out in embedded on a Philips 8051 and debugging it was via an ICE and had direct visibility and control of the 8051.

The ICE would be connected to a bonded out version of the 8051 and I was almost able to capture every single clock cycle of 8051's execution. When I hit a failure, I would just replay the trace and see what went wrong.

It looks like the folks on the big machines have caught up :-)

Re:Leaving Mozilla by ArkyBeagle on Wednesday March 02, 2016 @10:56PM (#11214927)
I had access to a Huntsville Microsystems ICe that used a bog-standard - non-bonded-out - 68008 in harness. I had scripting tools that would capture and replay all the registers to back the machine up.

That HMI was a brilliant machine.

It's really the last debug tool I ever used besides AVR, PIC and one ARM JTAG for doing BSP work.

Re:Leaving Mozilla by ianbicking on Wednesday March 02, 2016 @02:08PM (#11212158)
Python and in-browser Javascript are also programs, in theory rr covers the entirety? But I don't know what the ergonomics are like (e.g., how much will you see program activity in your platform that you don't care about, and how well can you see the activity in the code you are debugging?)
Re:Leaving Mozilla by roca on Wednesday March 02, 2016 @05:57PM (#11213740)
Yes, rr can record python and JS execution just fine, but the debugging experience is hopeless, since right now rr just gives you gdb. With an astounding tolerance for pain you can make progress by calling JS engine functions from gdb, but nobody wants that.

This is fixable, however, and on my agenda.

Re:Leaving Mozilla by mrdrozdov on Wednesday March 02, 2016 @10:50PM (#11214905)
There is something similar in bpython called rewind. Run a few commands in the repl and then try `ctrl+r`.
Re:Leaving Mozilla by mrdrozdov on Wednesday March 02, 2016 @10:53PM (#11214913)
I wonder how it works. Assuming it must capture state at t=n, and somehow calculate the diff to get to t=n+1. Could theoretically pop diffs to get to any point in the past.
Re:Leaving Mozilla by easytiger on Thursday March 03, 2016 @04:58AM (#11215926)
Its not free, but there is http://undo-software.com/undodb/
Re:Leaving Mozilla by Zitrax on Thursday March 03, 2016 @02:06AM (#11215457)
Gdb has supported reverse debugging since 2009.
Re:Leaving Mozilla by sfink on Thursday March 03, 2016 @03:58PM (#11219986)
I've used it, and I've been using rr. gdb's reverse debugging was useful to me a few times, in extremely limited situations.

I often do my initial runs under rr, just in case I might want to debug, because it's useful most of the time and it's not enough overhead to worry about.

gdb's reverse debugging works after you narrow the range of interest down to a very small region, because otherwise its buffer will repeatedly overflow and it'll take ages.