2026-08-19 12:43 UTC
it's actually amazing how many stupid hacks you can do to make an interactive programming environment out of c
you can live-reload with dlopen
you can keep function pointers when live-reloading by generating stubs containing an indirect jump, and replacing its address when you reload the shared library
you can roll back to previous state of the program by taking snapshots of memory
you can use segmentation fault handler or linux's userfaultfd to only take snapshots of memory pages that were actually written to since last time
with memory snapshots you can achieve full time-travel debugging by strictly defining the side-effectful / IO functions your program uses, and just recording what they return
you can also run the interactive live-reloadable parts as webassembly or something
Replies (0)
No replies.