Wasmtime
trap.h
Go to the documentation of this file.
1
7#ifndef WASMTIME_TRAP_H
8#define WASMTIME_TRAP_H
9
10#include <wasm.h>
11
12#ifdef __cplusplus
13extern "C" {
14#endif
15
21typedef uint8_t wasmtime_trap_code_t;
22
49};
50
59WASM_API_EXTERN wasm_trap_t *wasmtime_trap_new(const char *msg, size_t msg_len);
60
70WASM_API_EXTERN bool wasmtime_trap_code(const wasm_trap_t*, wasmtime_trap_code_t *code);
71
79WASM_API_EXTERN bool wasmtime_trap_exit_status(const wasm_trap_t*, int *status);
80
89WASM_API_EXTERN const wasm_name_t *wasmtime_frame_func_name(const wasm_frame_t*);
90
100
101
102#ifdef __cplusplus
103} // extern "C"
104#endif
105
106#endif // WASMTIME_TRAP_H
A list of bytes.
Definition: wasm.h:96
Opaque struct representing a frame of a wasm stack trace.
Opaque struct representing a wasm trap.
const wasm_name_t * wasmtime_frame_module_name(const wasm_frame_t *)
Returns a human-readable name for this frame's module.
bool wasmtime_trap_code(const wasm_trap_t *, wasmtime_trap_code_t *code)
Attempts to extract the trap code from this trap.
wasm_trap_t * wasmtime_trap_new(const char *msg, size_t msg_len)
Creates a new trap.
const wasm_name_t * wasmtime_frame_func_name(const wasm_frame_t *)
Returns a human-readable name for this frame's function.
wasmtime_trap_code_enum
Trap codes for instruction traps.
Definition: trap.h:26
@ WASMTIME_TRAP_CODE_TABLE_OUT_OF_BOUNDS
An out-of-bounds access to a table.
Definition: trap.h:34
@ WASMTIME_TRAP_CODE_BAD_CONVERSION_TO_INTEGER
Failed float-to-int conversion.
Definition: trap.h:44
@ WASMTIME_TRAP_CODE_INTEGER_DIVISION_BY_ZERO
An integer division by zero.
Definition: trap.h:42
@ WASMTIME_TRAP_CODE_INTEGER_OVERFLOW
An integer arithmetic operation caused an overflow.
Definition: trap.h:40
@ WASMTIME_TRAP_CODE_INTERRUPT
Execution has potentially run too long and may be interrupted.
Definition: trap.h:48
@ WASMTIME_TRAP_CODE_HEAP_MISALIGNED
A wasm atomic operation was presented with a not-naturally-aligned linear-memory address.
Definition: trap.h:32
@ WASMTIME_TRAP_CODE_INDIRECT_CALL_TO_NULL
Indirect call to a null table entry.
Definition: trap.h:36
@ WASMTIME_TRAP_CODE_MEMORY_OUT_OF_BOUNDS
An out-of-bounds memory access.
Definition: trap.h:30
@ WASMTIME_TRAP_CODE_UNREACHABLE_CODE_REACHED
Code that was supposed to have been unreachable was reached.
Definition: trap.h:46
@ WASMTIME_TRAP_CODE_BAD_SIGNATURE
Signature mismatch on indirect call.
Definition: trap.h:38
@ WASMTIME_TRAP_CODE_STACK_OVERFLOW
The current stack space was exhausted.
Definition: trap.h:28
bool wasmtime_trap_exit_status(const wasm_trap_t *, int *status)
Attempts to extract a WASI-specific exit status from this trap.
uint8_t wasmtime_trap_code_t
Code of an instruction trap.
Definition: trap.h:21