in , ,

Debugging WebAssembly Outside of the Browser – Mozilla Hacks – the Web developer blog, Hacker News

Debugging WebAssembly Outside of the Browser – Mozilla Hacks – the Web developer blog, Hacker News


WebAssembly has begun to establish itselfoutside of the browservia dedicated runtimes like Mozilla’sWasmtimeand Fastly’sLucet. While the promise of a new, universal format for programs is appealing, it also comes with new challenges. For instance, how do you debug .wasm binaries?

At Mozilla, we’ve been prototyping ways to enable source-level debugging of. Wasmfiles using traditional tools likeGDBandLLDB.

Thescreencastbelow shows an example debugging session. Specifically, it demonstrates using Wasmtime and LLDB to inspect a program originally written in Rust, but compiled to WebAssembly.

This type of source-level debugging was previously impossible. And while the implementation details are subject to change, the developer experience — attaching a normal debugger to Wasmtime — will remain the same.

By allowing developers to examine programs in the same execution environment as a production WebAssembly program, Wasmtime’s debugging support makes it easier to catch and diagnose bugs that may not arise in a native build of the same code. For example, theWebAssembly System Interface(WASI) treats filesystem access more strictly than traditional Unix-style permissions. This could create issues that only manifest in WebAssembly runtimes.

Mozilla is proactively working to ensure that WebAssembly’s development tools are capable, complete, and ready to go as WebAssembly expands beyond the browser.

Please try it out and let us know what you think.

Note:Debugging using Wasmtime and LLDB should work out of the box on Linux with Rust programs, or with C / C projects built via theWASI SDK.

Debugging on macOS currently requiresbuilding and signinga more recent version of LLDB.

Unfortunately, LLDB for Windows does not yet supportJIT debugging.

Thanks to Lin Clark, Till Schneidereit, and Yury Delendik for their assistance on this post, and for their work on WebAssembly debugging.

    

Engineer with Mozilla Developer Relations, former Mozilla Persona developer.

                    

More articles by Dan Callahan…

                  

  

              

Brave Browser

Payeer

Read More

What do you think?

Leave a Reply

Your email address will not be published. Required fields are marked *

GIPHY App Key not set. Please check settings

Rust in Large Organizations Notes, Hacker News

Rust in Large Organizations Notes, Hacker News

Pixel 4 Soli motion gestures will only work in these countries – XDA Developers, Xda-developers.com

Pixel 4 Soli motion gestures will only work in these countries – XDA Developers, Xda-developers.com