MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime-go / Frames

Method Frames

trap.go:133–152  ·  view source on GitHub ↗

Frames returns the wasm function frames that make up this trap

()

Source from the content-addressed store, hash-verified

131
132// Frames returns the wasm function frames that make up this trap
133func (t *Trap) Frames() []*Frame {
134 frames := &frameList{owner: t}
135 C.wasm_trap_trace(t.ptr(), &frames.vec)
136 runtime.KeepAlive(t)
137 runtime.SetFinalizer(frames, func(frames *frameList) {
138 C.wasm_frame_vec_delete(&frames.vec)
139 })
140
141 ret := make([]*Frame, int(frames.vec.size))
142 base := unsafe.Pointer(frames.vec.data)
143 var ptr *C.wasm_frame_t
144 for i := 0; i < int(frames.vec.size); i++ {
145 ptr := *(**C.wasm_frame_t)(unsafe.Pointer(uintptr(base) + unsafe.Sizeof(ptr)*uintptr(i)))
146 ret[i] = &Frame{
147 _ptr: ptr,
148 _owner: frames,
149 }
150 }
151 return ret
152}
153
154func (f *Frame) ptr() *C.wasm_frame_t {
155 ret := f._ptr

Callers 2

TestTrapFramesFunction · 0.80
TestTrapModuleNameFunction · 0.80

Calls 1

ptrMethod · 0.95

Tested by 2

TestTrapFramesFunction · 0.64
TestTrapModuleNameFunction · 0.64