github.com/pkujhd/goloader@v0.0.0-20240411034752-1a28096bd7bd/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  )
     9  
    10  func initInline(objFunc *goobj.Func, Func *FuncInfo, pkgpath string, fd *readAtSeeker) (err error) {
    11  	for _, inl := range objFunc.InlTree {
    12  		inline := InlTreeNode{
    13  			Parent:   int64(inl.Parent),
    14  			File:     inl.File,
    15  			Line:     int64(inl.Line),
    16  			Func:     inl.Func.Name,
    17  			ParentPC: int64(inl.ParentPC),
    18  		}
    19  		inline.Func = ReplacePkgPath(inline.Func, pkgpath)
    20  		Func.InlTree = append(Func.InlTree, inline)
    21  	}
    22  	Func.PCInline, err = fd.BytesAt(objFunc.PCInline.Offset, objFunc.PCInline.Size)
    23  	return err
    24  }