wasmer
wasmer copied to clipboard
JIT step through debugging support
It would be really nice if wasmer implemented the interfaces required to register jit'ed code with attached debuggers.
Motivation
I am currently working on making a scripting runtime for a game engine using wasm. For me personally, the ability to use tools such as breakpoints and line by line stepping is an essential part my coding strategy. It's a required feature for me. I also value performance greatly, when choosing between using wasmer and wasmtime that the main thing I was comparing, however. The (as far as I can tell) lack of debugger support is a complete deal breaker. With wasmtime this is a single Boolean you set in the config to enable this feature.
Proposed solution
In LLVM, at least through the C++ API when using the Orc JIT runtime you call the function llvm::JITEventListener::createGDBRegistrationListener()
and pass the result to llvm::orc::RTDyldObjectLinkingLayer::registerJITEventListener()
and that's all that's needed to have it register any debug info in a compiled module with an attached debugger. I'm not sure how you're running code after it's compiled, but if you're using a JIT runtime from the LLVM project it should be trivial to implement.
I would assume that cranelift has something similar, since wasmtime already has this functionality.
Alternatives
It's possible you already have this implemented, I tried figuring out your wasm-debug repo as it seems to do something similar to what I want, but there is no documentation on the usage of it's contents. If you do already have this functionality, please document it.
All I need is one of the backends to support this feature, as I was already planning to make swapping backends a feature in my project. Explaining in my docs to "use this backend to enable debugger support" is perfectly fine.
My current plans
My current plan is to create a generic interface for interacting with a web assemby runtime, and then to first implement a backend for wasmtime (as debugging support is more important than speed short term) and then later on to add another implementation of this interface for the speed and greater range of supported platforms. It would be amazing if I could focus on just one runtime, but at the moment that is not possible.