Duktape has built-in debugger support as an option you can enable during compilation. Debugger support adds about 10kB of code footprint and has very minimal memory footprint.
The debugger is based on the following main concepts:
The most appropriate debug transport varies a lot between debug targets; it can be Wi-Fi, Bluetooth, a serial line, a stream embedded into a custom management protocol, etc. Although there is no "standard" transport, a TCP connection is a useful default. The Duktape distributable includes all the pieces you need to get started with debugging using a TCP transport:
duk
) using
the TCP transport: --debugger
optionThe Node.js based debugger web UI (duk_debug.js
) can connect
to the Duktape command line, but can also talk directly with any other target
implementing a TCP transport. You can also customize it to use a different
transport or use a proxy which converts between TCP and your custom transport.
It's also possible to write your own debug client from scratch and e.g.
integrate it to a custom IDE. You can integrate directly with a debug target
using the binary debug protocol, or use the JSON proxy provided by
duk_debug.js
.
For more details on the implementation and how to get started, see: