Michal Iskierko 6d31343205 feat: Waku v2 bridge
Issue #12610
2024-02-22 17:07:59 +01:00

24 lines
362 B
Go

package missinggo
import (
"fmt"
"io"
"runtime"
)
func WriteStack(w io.Writer, stack []uintptr) {
for _, pc := range stack {
if pc == 0 {
break
}
pc--
f := runtime.FuncForPC(pc)
if f.Name() == "runtime.goexit" {
continue
}
file, line := f.FileLine(pc)
fmt.Fprintf(w, "# %s:\t%s:%d\n", f.Name(), file, line)
}
fmt.Fprintf(w, "\n")
}