github.com/eh-steve/goloader@v0.0.0-20240111193454-90ff3cfdae39/obj/inlinetree.1.12.go (about)

     1  //go:build go1.12 && !go1.16
     2  // +build go1.12,!go1.16
     3  
     4  package obj
     5  
     6  import (
     7  	"cmd/objfile/goobj"
     8  	"strings"
     9  )
    10  
    11  func initInline(objFunc *goobj.Func, Func *FuncInfo, pkgpath string, fd *readAtSeeker) (err error) {
    12  	for _, inl := range objFunc.InlTree {
    13  		inline := InlTreeNode{
    14  			Parent:   int64(inl.Parent),
    15  			File:     inl.File,
    16  			Line:     int64(inl.Line),
    17  			Func:     inl.Func.Name,
    18  			ParentPC: int64(inl.ParentPC),
    19  		}
    20  		inline.Func = strings.Replace(inline.Func, EmptyPkgPath, pkgpath, -1)
    21  		Func.InlTree = append(Func.InlTree, inline)
    22  	}
    23  	Func.PCInline, err = fd.BytesAt(objFunc.PCInline.Offset, objFunc.PCInline.Size)
    24  	return err
    25  }