Caterpillar

Daily Thought - 2024-04-18

< back to list

Let's talk about debuggers. I think there's a core set of features that you would expect from one: set breakpoint, continue execution, step over this expression, step into this function call... you know, the well-known stuff. But what about stepping backwards?

I think to make Caterpillar truly interactive, this is a feature we need. No more, "oops, stepped too far; guess I'll have to restart". Instead, just rewind the program whenever you want. Maybe make a change to the code. Step forward again to observe your change. Repeat until you're happy.

I think this might be quite straight-forward to implement: For every instruction that gets executed, log the instructions that would undo its effect into a ring buffer. When stepping back, execute instructions from that ring buffer. But I think there is more to consider beyond this naive implementation, and that's what I'd like to write about over the next few days.

<< previous thoughtnext thought >>