github.com/Rookout/GoSDK@v0.1.48/pkg/services/go_runtime/goroutine1.15.go (about) 1 //go:build go1.15 && !go1.21 2 // +build go1.15,!go1.21 3 4 package go_runtime 5 6 import ( 7 "unsafe" 8 ) 9 10 type GPtr uintptr 11 12 13 type stkframe struct{} 14 type g struct{} 15 16 17 func Getg() GPtr 18 19 //go:linkname gentraceback runtime.gentraceback 20 func gentraceback(pc0, sp0, lr0 uintptr, gp *g, skip int, pcbuf *uintptr, max int, callback func(*stkframe, unsafe.Pointer) bool, v unsafe.Pointer, flags uint) int 21 22 23 func Callers(pc uintptr, sp uintptr, gp GPtr, pcbuf []uintptr) int { 24 return gentraceback(pc, sp, 0, (*g)(unsafe.Pointer(gp)), 0, &pcbuf[0], len(pcbuf), nil, nil, 0) 25 }