Help us shape the future of Go! Take the 2026 Go Developer Survey

objectfile

package
v0.23.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 17, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotInitialized = errors.New("file is not initialized")
	ErrAlreadyClosed  = errors.New("file is already closed")
)

Functions

This section is empty.

Types

type Cache

type Cache[K comparable, V any] interface {
	Add(K, V)
	Get(K) (V, bool)
	Peek(K) (V, bool)
	Remove(K)
	Purge()
}

type ObjectFile

type ObjectFile struct {
	BuildID string

	Path    string
	Size    int64
	Modtime time.Time

	// If exists, will be released when the parent ObjectFile is released.
	// Go GC with a finalizer works correctly even with cyclic references.
	DebugFile *ObjectFile
	// contains filtered or unexported fields
}

ObjectFile represents an executable or library file. It handles the lifetime of the underlying file descriptor.

func (*ObjectFile) ELF added in v0.20.0

func (o *ObjectFile) ELF() (*elf.File, func(), error)

ELF returns the ELF file for the object file. Parallel reads are allowed.

func (*ObjectFile) Reader added in v0.20.0

func (o *ObjectFile) Reader() (*io.SectionReader, func(), error)

Reader returns a reader for the file. Parallel reads are NOT allowed. The caller must call the returned function when done with the reader.

type Pool added in v0.20.0

type Pool struct {
	// contains filtered or unexported fields
}

func NewPool added in v0.20.0

func NewPool(logger log.Logger, reg prometheus.Registerer, poolSize int, profilingDuration time.Duration) *Pool

func (*Pool) Close added in v0.20.0

func (p *Pool) Close() error

Close closes the pool and all the files in it.

func (*Pool) NewFile added in v0.20.0

func (p *Pool) NewFile(f *os.File) (_ *ObjectFile, err error)

NewFile creates a new ObjectFile reference from an existing file. The returned reference should be released after use. The file will be closed when the reference is released.

func (*Pool) Open added in v0.20.0

func (p *Pool) Open(path string) (*ObjectFile, error)

Open opens the specified executable or library file from the given path. And creates a new ObjectFile reference. The returned reference should be released after use. The file will be closed when the reference is released.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL