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
112};
113
122WASM_API_EXTERN wasm_trap_t *wasmtime_trap_new(const char *msg, size_t msg_len);
123
132
142WASM_API_EXTERN bool wasmtime_trap_code(const wasm_trap_t *,
144
153WASM_API_EXTERN const wasm_name_t *
155
164WASM_API_EXTERN const wasm_name_t *
166
167#ifdef __cplusplus
168} // extern "C"
169#endif
170
171#endif // WASMTIME_TRAP_H
A list of bytes.
Definition: wasm.h:102
Opaque struct representing a frame of a wasm stack trace.
Opaque struct representing a wasm trap.
WASM_API_EXTERN const wasm_name_t * wasmtime_frame_module_name(const wasm_frame_t *)
Returns a human-readable name for this frame's module.
WASM_API_EXTERN const wasm_name_t * wasmtime_frame_func_name(const wasm_frame_t *)
Returns a human-readable name for this frame's function.
WASM_API_EXTERN wasm_trap_t * wasmtime_trap_new_code(wasmtime_trap_code_t code)
Creates a new trap from the given trap code.
WASM_API_EXTERN bool wasmtime_trap_code(const wasm_trap_t *, wasmtime_trap_code_t *code)
Attempts to extract the trap code from this trap.
wasmtime_trap_code_enum
Trap codes for instruction traps.
Definition: trap.h:26
@ WASMTIME_TRAP_CODE_DEBUG_ASSERT_EQUAL_CODE_UNITS
Definition: trap.h:96
@ WASMTIME_TRAP_CODE_TABLE_OUT_OF_BOUNDS
An out-of-bounds access to a table.
Definition: trap.h:35
@ WASMTIME_TRAP_CODE_BAD_CONVERSION_TO_INTEGER
Failed float-to-int conversion.
Definition: trap.h:45
@ WASMTIME_TRAP_CODE_INTEGER_DIVISION_BY_ZERO
An integer division by zero.
Definition: trap.h:43
@ WASMTIME_TRAP_CODE_NO_ASYNC_RESULT
Definition: trap.h:70
@ WASMTIME_TRAP_CODE_INTEGER_OVERFLOW
An integer arithmetic operation caused an overflow.
Definition: trap.h:41
@ WASMTIME_TRAP_CODE_STRING_OUT_OF_BOUNDS
A component tried to lift or lower a string past the end of its memory.
Definition: trap.h:104
@ WASMTIME_TRAP_CODE_INVALID_DISCRIMINANT
A component used an invalid discriminant when lowering a variant value.
Definition: trap.h:108
@ WASMTIME_TRAP_CODE_ATOMIC_WAIT_NON_SHARED_MEMORY
Definition: trap.h:54
@ WASMTIME_TRAP_CODE_ARRAY_OUT_OF_BOUNDS
Attempt to access beyond the bounds of an array.
Definition: trap.h:58
@ WASMTIME_TRAP_CODE_INTERRUPT
Execution has potentially run too long and may be interrupted.
Definition: trap.h:49
@ WASMTIME_TRAP_CODE_UNALIGNED_POINTER
Definition: trap.h:111
@ WASMTIME_TRAP_CODE_CONTINUATION_ALREADY_CONSUMED
Attempt to resume a continuation twice.
Definition: trap.h:74
@ WASMTIME_TRAP_CODE_ALLOCATION_TOO_LARGE
Attempted an allocation that was too large to succeed.
Definition: trap.h:60
@ WASMTIME_TRAP_CODE_DEBUG_ASSERT_POINTER_ALIGNED
Definition: trap.h:99
@ WASMTIME_TRAP_CODE_HEAP_MISALIGNED
Definition: trap.h:33
@ WASMTIME_TRAP_CODE_ASYNC_DEADLOCK
Definition: trap.h:81
@ WASMTIME_TRAP_CODE_INDIRECT_CALL_TO_NULL
Indirect call to a null table entry.
Definition: trap.h:37
@ WASMTIME_TRAP_CODE_CANNOT_ENTER_COMPONENT
Definition: trap.h:67
@ WASMTIME_TRAP_CODE_UNHANDLED_TAG
We are suspending to a tag for which there is no active handler.
Definition: trap.h:72
@ WASMTIME_TRAP_CODE_MEMORY_OUT_OF_BOUNDS
An out-of-bounds memory access.
Definition: trap.h:30
@ WASMTIME_TRAP_CODE_OUT_OF_FUEL
Execution has run out of the configured fuel amount.
Definition: trap.h:51
@ WASMTIME_TRAP_CODE_CANNOT_BLOCK_SYNC_TASK
Definition: trap.h:88
@ WASMTIME_TRAP_CODE_NULL_REFERENCE
Call to a null reference.
Definition: trap.h:56
@ WASMTIME_TRAP_CODE_CANNOT_LEAVE_COMPONENT
Definition: trap.h:85
@ WASMTIME_TRAP_CODE_UNREACHABLE_CODE_REACHED
Code that was supposed to have been unreachable was reached.
Definition: trap.h:47
@ WASMTIME_TRAP_CODE_BAD_SIGNATURE
Signature mismatch on indirect call.
Definition: trap.h:39
@ WASMTIME_TRAP_CODE_DISABLED_OPCODE
Definition: trap.h:77
@ WASMTIME_TRAP_CODE_CAST_FAILURE
Attempted to cast a reference to a type that it is not an instance of.
Definition: trap.h:62
@ WASMTIME_TRAP_CODE_DEBUG_ASSERT_UPPER_BITS_UNSET
Definition: trap.h:102
@ WASMTIME_TRAP_CODE_LIST_OUT_OF_BOUNDS
A component tried to lift or lower a list past the end of its memory.
Definition: trap.h:106
@ WASMTIME_TRAP_CODE_INVALID_CHAR
A component tried to lift a char with an invalid bit pattern.
Definition: trap.h:90
@ WASMTIME_TRAP_CODE_STACK_OVERFLOW
The current stack space was exhausted.
Definition: trap.h:28
@ WASMTIME_TRAP_CODE_DEBUG_ASSERT_STRING_ENCODING_FINISHED
Definition: trap.h:93
uint8_t wasmtime_trap_code_t
Code of an instruction trap.
Definition: trap.h:21
WASM_API_EXTERN wasm_trap_t * wasmtime_trap_new(const char *msg, size_t msg_len)
Creates a new trap with the given message.