December 15, 2011 4:39 PM
Incremental innovation is hard, not impossible. I think I've come up with something that is both useful and not already implemented elsewhere1. The Internet might prove me otherwise, but I'm personally incredibly excited about this since I've always wanted to do something that is non-trivial and useful for developers.

Imagine you're debugging and a breakpoint hits. Instead of stepping forward, you can step backward. You can position your cursor at a line of code and see how you reached that line. This is more than a stack trace; it is a causal analysis report listing only lines of code that played a part in execution reaching that point (lines of code with if, switch, break, continue, method call and event handling statements2 that affected control flow).

Looking at the list in the report, you can quickly spot an item that shouldn't be on it to determine where your control flow logic went wrong.

The second part: you can highlight a variable in the editor and see all lines of code where the variable was modified till the breakpoint was hit. I suspect this part is not that unique.

There's a video further down that should help clarify what I mean.

Before that, let me tell you what this is not:

I demoed this on stage at MAX 2011 where I had Rainn Wilson constantly try to faze me (all in good faith3):

Reverse Debugging with Causal Analysis

Apart from causal analysis, one more piece was shown at MAX (and in the video above):

  • Generate a trace dump which can then be used to do post-mortem analysis (reverse debugging and all that jazz) of the application. This is exactly like Visual Studio's Intellitrace or Historical debugging.

What I'm excited about is the causal analysis and the variable modification analysis (though implementing the other bits was also fascinating).

Developer Reaction

I was floored by the reception this received, the party after MAX Sneak Peek was amazing to say the least. It was hard to be the only code related demo among magical photoshop and 3D video demos. Cheers to all the Flex and Flash developers who congratulated me personally and to all those were curious enough to ask me how it was done (even though I might not have answered your question, trust me when I tell you, I wanted to). I appreciate it.

Meta (or How I came up with this)

My work at Adobe as a developer gives me access to the source code of an IDE with code completion and refactoring support (Flash Builder) and a virtual machine (AVM) with debugging capability, the flash player. I work on the debugger, so I'm always looking out in this area. I started doing this in my spare time, when I was not working on bugs or a feature.

I initially implemented reverse debugging in Flash Builder/flash player just because I was frustrated with having to reset breakpoints and restart if a breakpoint was set too far ahead. I had read the original gdb article via slashdot long ago so I knew it should be possible. Implementing it was a challenge, time was always against me.

Seeing Reverse debugging work, the other pieces just sort of came to me while I was trying to sleep that night. I was awake up all night thinking if I would be able to do it or not and if I'm crazy to be so excited about it. From the next day on, I worked continuously to get a prototype up. It is hard to work on something when you're not really sure if it will work or not, but the feeling you get when it finally starts working is inexplicable.

When is it shipping?

I'm glad that you're interested, I can't disclose anything about that now.

Why are you writing this?

Several reasons:

  • Maybe this will help someone get an idea like I got this one. Whatever it is, go do it even if it looks impossible. Like I said, incremental innovation is hard. But not impossible.
  • There have been only very few times4 when I've actually come up with something worthy of being posted on Hacker news.

Discuss this on Hacker News

CategoryProgramming


[1] I know for sure that I thought up of this by myself, but the world being a big place, it might be more than possible that someone either already thought about it or implemented it.

[2] There are way more cases than what is listed being considered. That said, the report is always not perfect.

[3] He was nothing compared to the developer from the audience who shouted that he got a boner. That is when I'm going "Dude!" in the video.

[4] First time I considered it was when I worked on the seamless client server debugging and automatic async/sync conversion pieces (with other extremely talented engineers) demoed at MAX 2009 Sneak peeks. The second time was when I came up with Readefine and the third time was when I built visual conditional breakpoints with a live design view demoed at MAX 2010 Sneak peeks.

Copyright © 2004-2011 Anirudh Sasikumar. All rights reserved.
Last Updated: January 16, 2012 12:23 PM