c-api: add wasmtime_trap_code (#3086)
Eventually this should be added to the wasmtime-go binding, addressing https://github.com/bytecodealliance/wasmtime-go/issues/63. Added a snippet to examples/interrupt.c to verify that this works as expected in manual testing. Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
This commit is contained in:
@@ -42,6 +42,14 @@ impl fmt::Display for TrapReason {
|
||||
/// A trap code describing the reason for a trap.
|
||||
///
|
||||
/// All trap instructions have an explicit trap code.
|
||||
///
|
||||
/// The code can be accessed from the c-api, where the possible values are translated
|
||||
/// into enum values defined there:
|
||||
///
|
||||
/// * `wasm_trap_code` in c-api/src/trap.rs, and
|
||||
/// * `wasmtime_trap_code_enum` in c-api/include/wasmtime/trap.h.
|
||||
///
|
||||
/// These need to be kept in sync.
|
||||
#[non_exhaustive]
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Debug, Hash)]
|
||||
pub enum TrapCode {
|
||||
|
||||
Reference in New Issue
Block a user