frames_go1.go 476 B

123456789101112131415161718192021
  1. // Copyright 2021 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. //go:build !go1.7
  5. // +build !go1.7
  6. // TODO(mdempsky): Remove after #44505 is resolved
  7. package pkgbits
  8. import "runtime"
  9. func walkFrames(pcs []uintptr, visit frameVisitor) {
  10. for _, pc := range pcs {
  11. fn := runtime.FuncForPC(pc)
  12. file, line := fn.FileLine(pc)
  13. visit(file, line, fn.Name(), pc-fn.Entry())
  14. }
  15. }