debug: fix print stack for wasm

This commit is contained in:
visualfc
2025-07-01 11:28:48 +08:00
parent f0728c4fe0
commit 013f2ef00d
4 changed files with 52 additions and 7 deletions

View File

@@ -62,13 +62,7 @@ func Rethrow(link *Defer) {
if ptr := excepKey.Get(); ptr != nil {
if link == nil {
TracePanic(*(*any)(ptr))
debug.StackTrace(0, func(fr *debug.Frame) bool {
var info debug.Info
debug.Addrinfo(unsafe.Pointer(fr.PC), &info)
c.Fprintf(c.Stderr, c.Str("[0x%08X %s+0x%x, SP = 0x%x]\n"), fr.PC, fr.Name, fr.Offset, fr.SP)
return true
})
debug.PrintStack(2)
c.Free(ptr)
c.Exit(2)
} else {