duktape
duktape copied to clipboard
Possibility of disabling circular stack traversal during context dump?
If you create a 'global' or 'globalThis' style binding on the global object, this creates a circular reference which breaks duk_push_context_dump
due to it doing a deep serialisation of the stack. Would it be possible to have a workaround for this?
Dumping the stack is really useful when debugging, but a lot of third party scripts rely on some kind of 'global' binding to exist.
I'm sure some workaround is possible in the serialization, either through the existing circular reference detection or simply limiting the size of the output and allowing a truncated value rather than an error in this case.
There are also some other problems with the context dump mechanism, e.g. serializing some values may have side effects. It's really just meant as a temporary debugging aid because several users had implemented such a mechanism anyway. It would be nice to resolve these so that the dumping would be actually fully side effect free.