duktape icon indicating copy to clipboard operation
duktape copied to clipboard

Possibility of disabling circular stack traversal during context dump?

Open lyptt opened this issue 5 years ago • 1 comments

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.

lyptt avatar Feb 24 '19 00:02 lyptt

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.

svaarala avatar Feb 24 '19 14:02 svaarala