Documentation
¶
Index ¶
- Constants
- func BuiltinIdx(name string, abi int) int
- func BuiltinName(i int) (string, int)
- func NBuiltin() int
- type Aux
- type FingerprintType
- type FuncInfo
- func (a *FuncInfo) Read(b []byte)
- func (*FuncInfo) ReadArgs(b []byte) uint32
- func (*FuncInfo) ReadFile(b []byte, filesoff uint32, k uint32) SymRef
- func (*FuncInfo) ReadFuncInfoLengths(b []byte) FuncInfoLengths
- func (*FuncInfo) ReadFuncdataoff(b []byte, funcdataofffoff uint32, k uint32) int64
- func (*FuncInfo) ReadInlTree(b []byte, inltreeoff uint32, k uint32) InlTreeNode
- func (*FuncInfo) ReadLocals(b []byte) uint32
- func (*FuncInfo) ReadPcdata(b []byte, pcdataoffset uint32, k uint32) (uint32, uint32)
- func (*FuncInfo) ReadPcfile(b []byte) (uint32, uint32)
- func (*FuncInfo) ReadPcinline(b []byte, pcdataoffset uint32) (uint32, uint32)
- func (*FuncInfo) ReadPcline(b []byte) (uint32, uint32)
- func (*FuncInfo) ReadPcsp(b []byte) (uint32, uint32)
- func (a *FuncInfo) Write(w *bytes.Buffer)
- type FuncInfoLengths
- type Header
- type ImportedPkg
- type InlTreeNode
- type Reader
- func (r *Reader) Autolib() []ImportedPkg
- func (r *Reader) Aux(i int, j int) *Aux
- func (r *Reader) AuxOff(i int, j int) uint32
- func (r *Reader) Auxs(i int) []Aux
- func (r *Reader) BytesAt(off uint32, len int) []byte
- func (r *Reader) Data(i int) []byte
- func (r *Reader) DataOff(i int) uint32
- func (r *Reader) DataSize(i int) int
- func (r *Reader) DwarfFile(i int) string
- func (r *Reader) Fingerprint() FingerprintType
- func (r *Reader) Flags() uint32
- func (r Reader) Header() Header
- func (r *Reader) NAux(i int) int
- func (r *Reader) NDwarfFile() int
- func (r *Reader) NNonpkgdef() int
- func (r *Reader) NNonpkgref() int
- func (r *Reader) NPkg() int
- func (r *Reader) NRefName() int
- func (r *Reader) NReloc(i int) int
- func (r *Reader) NSym() int
- func (r *Reader) PcdataBase() uint32
- func (r *Reader) Pkg(i int) string
- func (r *Reader) Pkglist() []string
- func (r *Reader) ReadOnly() bool
- func (r *Reader) RefName(i int) *RefName
- func (r *Reader) Reloc(i int, j int) *Reloc
- func (r *Reader) RelocOff(i int, j int) uint32
- func (r *Reader) Relocs(i int) []Reloc
- func (r *Reader) StringAt(off uint32, len uint32) string
- func (r *Reader) StringRef(off uint32) string
- func (r *Reader) Sym(i int) *Sym
- func (r *Reader) SymOff(i int) uint32
- type RefName
- type Reloc
- func (r *Reloc) Add() int64
- func (r *Reloc) Off() int32
- func (r *Reloc) Set(off int32, size uint8, typ uint8, add int64, sym SymRef)
- func (r *Reloc) SetAdd(x int64)
- func (r *Reloc) SetOff(x int32)
- func (r *Reloc) SetSiz(x uint8)
- func (r *Reloc) SetSym(x SymRef)
- func (r *Reloc) SetType(x uint8)
- func (r *Reloc) Siz() uint8
- func (r *Reloc) Sym() SymRef
- func (r *Reloc) Type() uint8
- func (r *Reloc) Write(w *Writer)
- type Sym
- func (s *Sym) ABI() uint16
- func (s *Sym) Align() uint32
- func (s *Sym) Dupok() bool
- func (s *Sym) Flag() uint8
- func (s *Sym) IsGoType() bool
- func (s *Sym) Leaf() bool
- func (s *Sym) Local() bool
- func (s *Sym) Name(r *Reader) string
- func (s *Sym) NoSplit() bool
- func (s *Sym) ReflectMethod() bool
- func (s *Sym) SetABI(x uint16)
- func (s *Sym) SetAlign(x uint32)
- func (s *Sym) SetFlag(x uint8)
- func (s *Sym) SetName(x string, w *Writer)
- func (s *Sym) SetSiz(x uint32)
- func (s *Sym) SetType(x uint8)
- func (s *Sym) Siz() uint32
- func (s *Sym) TopFrame() bool
- func (s *Sym) Type() uint8
- func (s *Sym) Typelink() bool
- func (s *Sym) Write(w *Writer)
- type SymRef
- type Writer
- func (w *Writer) AddString(s string)
- func (w *Writer) Bytes(s []byte)
- func (w *Writer) Offset() uint32
- func (w *Writer) RawString(s string)
- func (w *Writer) StringRef(s string)
- func (w *Writer) Uint16(x uint16)
- func (w *Writer) Uint32(x uint32)
- func (w *Writer) Uint64(x uint64)
- func (w *Writer) Uint8(x uint8)
Constants ¶
const ( PkgIdxNone = (1<<31 - 1) - iota // Non-package symbols PkgIdxBuiltin // Predefined symbols // TODO: not used for now, we could use it for compiler-generated symbols like runtime.newobject PkgIdxSelf // Symbols defined in the current package PkgIdxInvalid = 0 )
Package Index.
const ( BlkAutolib = iota BlkPkgIdx BlkDwarfFile BlkSymdef BlkNonpkgdef BlkNonpkgref BlkRelocIdx BlkAuxIdx BlkDataIdx BlkReloc BlkAux BlkData BlkPcdata BlkRefName BlkEnd NBlk )
Blocks
const ( SymFlagDupok = 1 << iota SymFlagLocal SymFlagTypelink SymFlagLeaf SymFlagNoSplit SymFlagReflectMethod SymFlagGoType SymFlagTopFrame )
const ( AuxGotype = iota AuxFuncInfo AuxFuncdata AuxDwarfInfo AuxDwarfLoc AuxDwarfRanges AuxDwarfLines )
Aux Type
const AuxSize = 1 + 8
const Magic = "\x00go115ld"
const (
)
const RefNameSize = 8 + stringRefSize
const RelocSize = 4 + 1 + 1 + 8 + 8
const SymABIstatic = ^uint16(0)
const SymSize = stringRefSize + 2 + 1 + 1 + 4 + 4
Variables ¶
This section is empty.
Functions ¶
func BuiltinIdx ¶
BuiltinIdx returns the index of the builtin with the given name and abi, or -1 if it is not a builtin.
func BuiltinName ¶
BuiltinName returns the name and ABI of the i-th builtin symbol.
Types ¶
type FingerprintType ¶
type FingerprintType [8]byte
func (FingerprintType) IsZero ¶
func (fp FingerprintType) IsZero() bool
type FuncInfo ¶
type FuncInfo struct {
Args uint32
Locals uint32
Pcsp uint32
Pcfile uint32
Pcline uint32
Pcinline uint32
Pcdata []uint32
PcdataEnd uint32
Funcdataoff []uint32
File []SymRef // TODO: just use string?
InlTree []InlTreeNode
}
FuncInfo is serialized as a symbol (aux symbol). The symbol data is the binary encoding of the struct below.
TODO: make each pcdata a separate symbol?
func (*FuncInfo) ReadFuncInfoLengths ¶
func (*FuncInfo) ReadFuncInfoLengths(b []byte) FuncInfoLengths
func (*FuncInfo) ReadFuncdataoff ¶
func (*FuncInfo) ReadInlTree ¶
func (*FuncInfo) ReadInlTree(b []byte, inltreeoff uint32, k uint32) InlTreeNode
func (*FuncInfo) ReadLocals ¶
func (*FuncInfo) ReadPcdata ¶
return start and end offsets.
func (*FuncInfo) ReadPcfile ¶
return start and end offsets.
func (*FuncInfo) ReadPcinline ¶
return start and end offsets.
func (*FuncInfo) ReadPcline ¶
return start and end offsets.
type FuncInfoLengths ¶
type FuncInfoLengths struct {
NumPcdata uint32
PcdataOff uint32
NumFuncdataoff uint32
FuncdataoffOff uint32
NumFile uint32
FileOff uint32
NumInlTree uint32
InlTreeOff uint32
Initialized bool
}
FuncInfoLengths is a cache containing a roadmap of offsets and lengths for things within a serialized FuncInfo. Each length field stores the number of items (e.g. files, inltree nodes, etc), and the corresponding "off" field stores the byte offset of the start of the items in question.
type Header ¶
type Header struct {
Magic string
Fingerprint FingerprintType
Flags uint32
Offsets [NBlk]uint32
}
File header. TODO: probably no need to export this.
type ImportedPkg ¶
type ImportedPkg struct {
Pkg string
Fingerprint FingerprintType
}
Autolib
func (*ImportedPkg) Write ¶
func (p *ImportedPkg) Write(w *Writer)
type InlTreeNode ¶
InlTreeNode is the serialized form of FileInfo.InlTree.
func (*InlTreeNode) Read ¶
func (inl *InlTreeNode) Read(b []byte) []byte
Read an InlTreeNode from b, return the remaining bytes.
func (*InlTreeNode) Write ¶
func (inl *InlTreeNode) Write(w *bytes.Buffer)
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
func NewReaderFromBytes ¶
func (*Reader) Autolib ¶
func (r *Reader) Autolib() []ImportedPkg
func (*Reader) Fingerprint ¶
func (r *Reader) Fingerprint() FingerprintType
func (*Reader) NDwarfFile ¶
func (*Reader) NNonpkgdef ¶
func (*Reader) NNonpkgref ¶
func (*Reader) PcdataBase ¶
AuxDataBase returns the base offset of the aux data block.
func (*Reader) RefName ¶
RefName returns a pointer to the i-th referenced symbol name. Note: here i is not a local symbol index, just a counter.
type RefName ¶
type RefName [RefNameSize]byte
Referenced symbol name.
Serialized format:
RefName struct {
Sym symRef
Name string
}
type Reloc ¶
Relocation.
Serialized format:
Reloc struct {
Off int32
Siz uint8
Type uint8
Add int64
Sym SymRef
}
type Sym ¶
Symbol definition.
Serialized format:
Sym struct {
Name string
ABI uint16
Type uint8
Flag uint8
Siz uint32
Align uint32
}