Debugging in the browser
Effectively debugging JavaScript code in the browser has not always been easy. However, development tooling has markedly improved in the browser and in editors/IDEs with built-in debugging capabilities. Unfortunately, adding WebAssembly to a web application adds an additional level of complexity to the debugging process. In this section, we will review some techniques for debugging JavaScript that utilizes Wasm as well as some of the additional capabilities Emscripten offers.
High-level overview
Debugging Emscripten's Module
is relatively straightforward. Emscripten's error messages are well formed and descriptive, so you'll usually discover what's causing the issue right away. You can view these messages in your browser's development tools console.
If you specified a .html
output when running the emcc
command, some debugging code will already be built in (Module.print
and Module.printErr
). Within the HTML file, the loading code sets the window.onerror
event to call...