lua-users home
lua-l archive

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


Hi,

Has anyone tried to implement a time travelling debugger for Lua, like in Elm and other languages: https://youtu.be/PUv66718DII?t=153

It seems there was an attempt here: https://news.ycombinator.com/item?id=10704065 

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.

Thanks,
Abhijit