-
Notifications
You must be signed in to change notification settings - Fork 19
Add breakpoint
VM instruction
#198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
package
access control for BinaryInstructionDecoder
breakpoint
VM instruction
FWIW, LLDB and other runtimes (like WARM) expect/use unreachable (0x00, unconditional trap) for breakpoints. What's the motivation for using 0xFF instead? Corresponding code in LLDB: https://github.com/llvm/llvm-project/blob/c16d25282e7169cb8a19d9fa385cf7220dd65ac5/lldb/source/Target/Platform.cpp#L2079 |
That's a fair point, I initially didn't know LLDB and WAMR settled on 0x00 and thought that we'd like this to be distinct from the the usual trap instruction that's executed after all in Swift's |
Thinking about it more, this PR would have to be significantly modified to use 0x00 ( mutating func visitUnreachable() throws -> Output {
emit(.unreachable)
try markUnreachable()
} |
This is a preparation for a future internal breakpoint instruction, for which we need `visitUnknown` of `BinaryInstructionDecoder` to be available in the `WasmKit` module. Bumped `swift-tools-version` to 6.0 to get proper support for `package` in SwiftPM enabled.
This reverts commit ab876e6.
4da98fd
to
665ae2a
Compare
Per a discussion, following options are available for enabling breakpoints in WasmKit:
We've decided to proceed with Option 2, where a special
breakpoint
instruction is added to the VM, which is translated from 0xFF Wasm binary code. This code can never be supplied by the user, as it isn't enabled in the parser. In a future PR we'll providepublic
methods on module instances likefunc enableBreakpoint
that flips this instruction in in-memory module source and recompiles the corresponding function to VM bytecode with the newbreakpoint
instruction.