In this article, you can learn about WASM, why it’s difficult to debug, and some workarounds you can use when debugging WASM.

WebAssembly, (or WASM), allows developers to use code gathered from languages like Rust, C or C+ within an internet browser at close to native speeds.

WASM can also be successfully utilized as a lightweight docker replacement for platforms that require fast sandboxing. An interface that is platform independent such as standard WASI can enable file system access, basic functions such as the standard input and output, and other similar functions.

Despite the many benefits, debugging WASM can be difficult, as real bugs are growing more complicated to reproduce. Source maps can be used to find reliable stack traces, to see what they truly look like and to achieve reliable file names in WASM.

In this article, we will talk about WASM, why it’s difficult to debug, and some workarounds you can use when debugging WASM that involve source maps and stack unwinding.

What is WebAssembly?

WASM is code for modern web browsers that relies on language with a very compact binary format, and provides other coding languages with a compilation target so they can work on the web. It works in tandem with JavaScript, sharing many functions. As a result of this, even developers who don’t know how to write WASM code can still use it. WASM’s compatibility is especially attractive considering 75% of web developers report using JavaScript for the majority of their coding needs.

Not all functions can be accessed in the same memory space, hence the utilization of stacking in the program. DWARF is useful for debugging other programs, but is also not fully functional with WASM in any current execution engines. Over a year ago, changes in DWARF were implemented to permit understanding of WebAssembly. This came along with major modifications to the LLVM backend for WASM.

Ultimately, mastering different types of code and their debugging methods is important for developers, especially those working in the cloud and in the Software-as-a-Service (SaaS) industry specifically. That’s because SaaS allows data to be accessed from any device with a browser and relies on code that makes up an application hosted in the browser’s server. Code that is compatible in different browsers and is bug-free ultimately enhances customer experience and increases customer retention.

#wasm #webassembly #web-development

How to Debug WASM and Achieve a Reliable Stack Trace
2.00 GEEK