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
134};
135
144WASM_API_EXTERN wasm_trap_t *wasmtime_trap_new(const char *msg, size_t msg_len);
145
154
164WASM_API_EXTERN bool wasmtime_trap_code(const wasm_trap_t *,
166
175WASM_API_EXTERN const wasm_name_t *
177
186WASM_API_EXTERN const wasm_name_t *
188
189#ifdef __cplusplus
190} // extern "C"
191#endif
192
193#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_BACKPRESSURE_OVERFLOW
Backpressure-related intrinsics overflowed the built-in counter.
Definition: trap.h:129
@ WASMTIME_TRAP_CODE_NO_ASYNC_RESULT
Definition: trap.h:70
@ WASMTIME_TRAP_CODE_CANNOT_RESUME_THREAD
Cannot resume a thread which is not suspended.
Definition: trap.h:133
@ 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_WAITABLE_SET_DROP_HAS_WAITERS
waitable-set.drop invoked on a waitable set with waiters.
Definition: trap.h:121
@ WASMTIME_TRAP_CODE_INVALID_DISCRIMINANT
A component used an invalid discriminant when lowering a variant value.
Definition: trap.h:108
@ WASMTIME_TRAP_CODE_THREAD_NEW_INDIRECT_UNINITIALIZED
thread.new-indirect invoked with an uninitialized function reference.
Definition: trap.h:127
@ 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_TASK_CANCEL_NOT_CANCELLED
task.cancel invoked in an invalid way.
Definition: trap.h:113
@ 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_SUBTASK_CANCEL_AFTER_TERMINAL
subtask.cancel invoked after it already finished.
Definition: trap.h:117
@ 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_TASK_CANCEL_OR_RETURN_TWICE
task.cancel or task.return called too many times
Definition: trap.h:115
@ WASMTIME_TRAP_CODE_THREAD_NEW_INDIRECT_INVALID_TYPE
thread.new-indirect invoked with a function that has an invalid type.
Definition: trap.h:125
@ 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_SUBTASK_DROP_NOT_RESOLVED
subtask.drop invoked on a subtask that hasn't resolved yet.
Definition: trap.h:123
@ 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_TASK_RETURN_INVALID
task.return invoked with an invalid type.
Definition: trap.h:119
@ WASMTIME_TRAP_CODE_UNSUPPORTED_CALLBACK_CODE
Invalid code returned from callback of async-lifted function.
Definition: trap.h:131
@ 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.