Source file src/cmd/compile/internal/noder/frames_go17.go

     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  
     5  //go:build go1.7
     6  // +build go1.7
     7  
     8  package noder
     9  
    10  import "runtime"
    11  
    12  func walkFrames(pcs []uintptr, visit frameVisitor) {
    13  	if len(pcs) == 0 {
    14  		return
    15  	}
    16  
    17  	frames := runtime.CallersFrames(pcs)
    18  	for {
    19  		frame, more := frames.Next()
    20  		visit(frame.File, frame.Line, frame.Function, frame.PC-frame.Entry)
    21  		if !more {
    22  			return
    23  		}
    24  	}
    25  }
    26  

View as plain text