lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Has anyone tried to implement a time travelling debugger for Lua, like in Elm and other languages:

It seems there was an attempt here: 

So a useful case maybe to hit a breakpoint and change a variable's value. Then resume execution to see what happens. If it doesn't work out then reverting the virtual machine to the same state as it was when the machine hit the breakpoint. And again changing the value to something more suitable and executing forward.

Is it possible to save the Lua VM state and restore it or can it be done with some changes to lvm.c? It seems saving the stack and global state should be enough. Any userdata may be tricky.

I guess variables changes can be tracked by inserting local _ENVs within all functions and their entire value set saved. But executing forward and being able to return to a previous point requires snapshotting the LVM state.