MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / Trace

Class Trace

crates/c-api/include/wasmtime/trap.hh:66–95  ·  view source on GitHub ↗

* \brief An owned vector of `FrameRef` instances representing the WebAssembly * call-stack on a trap. * * This can be used to iterate over the frames of a trap and determine what was * running when a trap happened. */

Source from the content-addressed store, hash-verified

64 * running when a trap happened.
65 */
66class Trace {
67 friend class Trap;
68 friend class Error;
69
70 wasm_frame_vec_t vec;
71
72 Trace(wasm_frame_vec_t vec) : vec(vec) {}
73
74public:
75 ~Trace() { wasm_frame_vec_delete(&vec); }
76
77 Trace(const Trace &other) = delete;
78 Trace(Trace &&other) = delete;
79 Trace &operator=(const Trace &other) = delete;
80 Trace &operator=(Trace &&other) = delete;
81
82 /// Iterator used to iterate over this trace.
83 typedef const FrameRef *iterator;
84
85 /// Returns the start of iteration
86 iterator begin() const {
87 return reinterpret_cast<FrameRef *>(&vec.data[0]); // NOLINT
88 }
89 /// Returns the end of iteration
90 iterator end() const {
91 return reinterpret_cast<FrameRef *>(&vec.data[vec.size]); // NOLINT
92 }
93 /// Returns the size of this trace, or how many frames it contains.
94 size_t size() const { return vec.size; }
95};
96
97inline Trace Error::trace() const {
98 wasm_frame_vec_t frames;

Callers 3

traceMethod · 0.70
traceMethod · 0.70
post_order_dfsFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected