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

     1  //go:build go1.17 && !go1.20
     2  // +build go1.17,!go1.20
     3  
     4  package obj
     5  
     6  import (
     7  	"cmd/objfile/goobj"
     8  )
     9  
    10  func readFuncInfo(funcinfo *goobj.FuncInfo, b []byte, info *FuncInfo) {
    11  	lengths := funcinfo.ReadFuncInfoLengths(b)
    12  
    13  	funcinfo.Args = funcinfo.ReadArgs(b)
    14  	funcinfo.Locals = funcinfo.ReadLocals(b)
    15  	funcinfo.FuncID = funcinfo.ReadFuncID(b)
    16  	funcinfo.FuncFlag = funcinfo.ReadFuncFlag(b)
    17  
    18  	funcinfo.File = make([]goobj.CUFileIndex, lengths.NumFile)
    19  	for i := range funcinfo.File {
    20  		funcinfo.File[i] = funcinfo.ReadFile(b, lengths.FileOff, uint32(i))
    21  	}
    22  	funcinfo.InlTree = make([]goobj.InlTreeNode, lengths.NumInlTree)
    23  	for i := range funcinfo.InlTree {
    24  		funcinfo.InlTree[i] = funcinfo.ReadInlTree(b, lengths.InlTreeOff, uint32(i))
    25  	}
    26  	info.Args = funcinfo.Args
    27  	info.Locals = funcinfo.Locals
    28  	info.FuncID = uint8(funcinfo.FuncID)
    29  	info.FuncFlag = uint8(funcinfo.FuncFlag)
    30  }