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

     1  package obj
     2  
     3  type Pkg struct {
     4  	Syms       map[string]*ObjSymbol
     5  	Arch       string
     6  	PkgPath    string
     7  	File       string
     8  	ImportPkgs []string
     9  	CUFiles    []string
    10  }
    11  
    12  type FuncInfo struct {
    13  	Args      uint32
    14  	Locals    uint32
    15  	FuncID    uint8
    16  	FuncFlag  uint8
    17  	StartLine int32
    18  	PCSP      []byte
    19  	PCFile    []byte
    20  	PCLine    []byte
    21  	PCInline  []byte
    22  	PCData    [][]byte
    23  	File      []string
    24  	FuncData  []string
    25  	InlTree   []InlTreeNode
    26  	CUOffset  int32
    27  }
    28  
    29  type ObjSymbol struct {
    30  	Name  string
    31  	Kind  int    // kind of symbol
    32  	DupOK bool   // are duplicate definitions okay?
    33  	Size  int64  // size of corresponding data
    34  	Data  []byte // memory image of symbol
    35  	Type  string
    36  	Reloc []Reloc
    37  	Func  *FuncInfo // additional data for functions
    38  }
    39  
    40  type InlTreeNode struct {
    41  	Parent   int64
    42  	File     string
    43  	Line     int64
    44  	Func     string
    45  	ParentPC int64
    46  }
    47  
    48  type Func struct {
    49  	PCData   []uint32
    50  	FuncData []uintptr
    51  }
    52  
    53  // copy from $GOROOT/src/cmd/internal/goobj/read.go type Sym struct
    54  type Sym struct {
    55  	Name   string
    56  	Kind   int
    57  	Offset int
    58  	Func   *Func
    59  	Reloc  []Reloc
    60  }
    61  
    62  // copy from $GOROOT/src/cmd/internal/goobj/read.go type Reloc struct
    63  type Reloc struct {
    64  	Offset  int
    65  	SymName string
    66  	Size    int
    67  	Type    int
    68  	Add     int
    69  	Epilogue
    70  }
    71  
    72  type Epilogue struct {
    73  	Offset int
    74  	Size   int
    75  }