Tuesday , November 24 2020

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


Read More

About admin

Check Also

Debugging hidden memory leaks in Ruby, Hacker News

In 2015 I wrote about some of the tooling Ruby provides for diagnosing managed memory leaks. The article mostly focused on the easy managed leaks. This article covers tools and tricks you can use to attack leaks that you can not easily introspect in Ruby. In particular I will discuss mwrap, heaptrack, iseq_collector and chap.…

Leave a Reply

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