4 ms·
Of course those would have to be side-effect free, or somehow "sandboxed". It seems like debug printers should be pure functions but you never know what sort o
by progbits 3y ago
Of course those would have to be side-effect free, or somehow "sandboxed".
It seems like debug printers should be pure functions but you never know what sort of weird stuff people do.
- eklitzke 3y agoEven just formatting something as a string will likely require memory allocation for all but the most trivial cases, and memory allocation is not side effect free.
- yencabulator 3y agoTake the already-frozen process, make a clone with CoW memory, switch the clone to a sandbox that forbids most syscalls, run the pretty-printer function(s) in the clone process, abort if pretty-printing takes too long (hung on lock, infinite loop due to corrupt data structure, etc)? Lots of devils in the details, but that sounds possible.
- mark_undoio 3y agoYou're quite right, it's very possible. The product I work on does pretty much exactly this - we need it because our debugger time travels and we can't allow history to be altered! I wrote some words here: https://medium.com/time-travel-debugging/calling-functions-in-the-past-4bb03bdc124d https://medium.com/time-travel-debugging/calling-functions-i... But it's basically exactly what you propose. We didn't sandbox the syscalls but you could do that too.