github.com/pkujhd/goloader@v0.0.0-20240411034752-1a28096bd7bd/obj/funcinfo.1.20.go (about)

     1  //go:build go1.20 && !go1.23
     2  // +build go1.20,!go1.23
     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  	funcinfo.StartLine = funcinfo.ReadStartLine(b)
    18  
    19  	funcinfo.File = make([]goobj.CUFileIndex, lengths.NumFile)
    20  	for i := range funcinfo.File {
    21  		funcinfo.File[i] = funcinfo.ReadFile(b, lengths.FileOff, uint32(i))
    22  	}
    23  	funcinfo.InlTree = make([]goobj.InlTreeNode, lengths.NumInlTree)
    24  	for i := range funcinfo.InlTree {
    25  		funcinfo.InlTree[i] = funcinfo.ReadInlTree(b, lengths.InlTreeOff, uint32(i))
    26  	}
    27  	info.Args = funcinfo.Args
    28  	info.Locals = funcinfo.Locals
    29  	info.FuncID = uint8(funcinfo.FuncID)
    30  	info.FuncFlag = uint8(funcinfo.FuncFlag)
    31  	info.StartLine = funcinfo.StartLine
    32  }