objfile

package standard library
go1.24rc2 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2025 License: BSD-3-Clause Imports: 20 Imported by: 0

Documentation

Overview

Package objfile implements portable access to OS-specific executable files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry added in go1.10

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

func (*Entry) DWARF added in go1.10

func (e *Entry) DWARF() (*dwarf.Data, error)

DWARF returns DWARF debug data for the file, if any. This is for cmd/pprof to locate cgo functions.

func (*Entry) GOARCH added in go1.10

func (e *Entry) GOARCH() string

func (*Entry) LoadAddress added in go1.10

func (e *Entry) LoadAddress() (uint64, error)

LoadAddress returns the expected load address of the file. This differs from the actual load address for a position-independent executable.

func (*Entry) Name added in go1.10

func (e *Entry) Name() string

func (*Entry) PCLineTable added in go1.10

func (e *Entry) PCLineTable() (Liner, error)

func (*Entry) Symbols added in go1.10

func (e *Entry) Symbols() ([]Sym, error)

func (*Entry) Text added in go1.10

func (e *Entry) Text() (uint64, []byte, error)

type File

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

A File is an opened executable file.

func Open

func Open(name string) (*File, error)

Open opens the named file. The caller must call f.Close when the file is no longer needed.

func (*File) Close

func (f *File) Close() error

func (*File) DWARF added in go1.7

func (f *File) DWARF() (*dwarf.Data, error)

func (*File) Entries added in go1.10

func (f *File) Entries() []*Entry

func (*File) GOARCH

func (f *File) GOARCH() string

func (*File) LoadAddress added in go1.7

func (f *File) LoadAddress() (uint64, error)

func (*File) PCLineTable

func (f *File) PCLineTable() (Liner, error)

func (*File) Symbols

func (f *File) Symbols() ([]Sym, error)

func (*File) Text

func (f *File) Text() (uint64, []byte, error)

type Liner added in go1.8

type Liner interface {
	// Given a pc, returns the corresponding file, line, and function data.
	// If unknown, returns "",0,nil.
	PCToLine(uint64) (string, int, *gosym.Func)
}

type Reloc added in go1.8

type Reloc struct {
	Addr     uint64 // Address of first byte that reloc applies to.
	Size     uint64 // Number of bytes
	Stringer RelocStringer
}

type RelocStringer added in go1.8

type RelocStringer interface {
	// insnOffset is the offset of the instruction containing the relocation
	// from the start of the symbol containing the relocation.
	String(insnOffset uint64) string
}

type Sym

type Sym struct {
	Name   string  // symbol name
	Addr   uint64  // virtual address of symbol
	Size   int64   // size in bytes
	Code   rune    // nm code (T for text, D for data, and so on)
	Type   string  // XXX?
	Relocs []Reloc // in increasing Addr order
}

A Sym is a symbol defined in an executable file.

Jump to

Keyboard shortcuts

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