package main
import (
"fmt"
"runtime"
)
func main() {
aa()
}
func aa() {
bb()
}
func bb() {
cc("hello")
}
func cc0(s string) {
callers := make([]uintptr, 8)
runtime.Callers(1, callers)
frames := runtime.CallersFrames(callers)
for {
f, ok := frames.Next()
if !ok {
break
}
fmt.Println("--")
fmt.Println("f: ", f)
fmt.Println("f: ", f.Entry)
fmt.Println("f: ", f.File)
fmt.Println("f: ", f.Func)
fmt.Println("f: ", f.Function)
}
}
func cc(s string) {
callers := make([]uintptr, 8)
runtime.Callers(1, callers)
frames := runtime.CallersFrames(callers)
f, _ := frames.Next()
fmt.Println("--")
fmt.Println("f: ", f)
fmt.Println("f: ", f.Entry)
fmt.Println("f: ", f.File)
fmt.Println("f: ", f.Func)
fmt.Println("f: ", f.Function)
}
No comments:
Post a Comment