name: duk_debugger_attach proto: | void duk_debugger_attach(duk_context *ctx, duk_debug_read_function read_cb, duk_debug_write_function write_cb, duk_debug_peek_function peek_cb, duk_debug_read_flush_function read_flush_cb, duk_debug_write_flush_function write_flush_cb, duk_debug_request_function request_cb, duk_debug_detached_function detached_cb, void *udata); summary: |

Attach a debugger to the Duktape heap. The debugger will automatically enter paused state when the attach is complete. If debugger support is not compiled into Duktape, throws an error. See debugger.rst for more information on debugger integration. The callbacks are as follows, optional callbacks may be NULL:

CallbackRequiredDescription
read_cbYesDebug transport read callback
write_cbYesDebug transport write callback
peek_cbNoDebug transport peek callback, strongly recommended but optional
read_flush_cbNoDebug transport read flush callback
write_flush_cbNoDebug transport write flush callback
request_cbNoApplication specific command (AppRequest) callback, NULL indicates no AppRequest support
detached_cbNoDebugger detached callback

Important: The callbacks are not allowed to call any Duktape API functions (doing so may cause memory unsafe behavior) except for the following:

The duk_debugger_attach_custom() and duk_debugger_attach() API calls were merged in Duktape 2.x.
example: | duk_debugger_attach(ctx, my_read_cb, my_write_cb, my_peek_cb, NULL, NULL, NULL, my_detached_cb, my_udata); tags: - debugger seealso: - duk_debugger_detach - duk_debugger_cooperate - duk_debugger_notify # Introduced in 1.2.0 but incompatible change in 2.0.0. introduced: 1.2.0