Documentation
¶
Overview ¶
Package process provides type and functionality for target Go processes.
Index ¶
- Constants
- Variables
- type Allocation
- type DWARF
- func (d DWARF) Entry(tag dwarf.Tag, name string) (*dwarf.Entry, error)
- func (d DWARF) EntryInChildren(tag dwarf.Tag, name string) (*dwarf.Entry, error)
- func (d DWARF) Field(e *dwarf.Entry, a dwarf.Attr) (dwarf.Field, bool)
- func (d DWARF) GoStructField(id structfield.ID) (int64, error)
- func (d DWARF) GoToEntry(tag dwarf.Tag, name string) bool
- type ID
- type Info
Constants ¶
const ( // MadvisePopulateRead is the MADV_POPULATE_READ advice flag. MadvisePopulateRead = 0x16 // MadvisePopulateWrite is the MADV_POPULATE_WRITE advice flag. MadvisePopulateWrite = 0x17 )
Variables ¶
var ErrDWARFEntry = errors.New("DWARF entry not found")
ErrDWARFEntry is returned if an entry is not found within DWARF data.
var VerDevel = semver.MustParse("0.0.0-dev")
VerDevel is the placeholder version used for modules that use the development version "(devel)".
Functions ¶
This section is empty.
Types ¶
type Allocation ¶ added in v0.22.0
Allocation represent memory that has been allocated for a process.
type DWARF ¶ added in v0.20.0
DWARF provides convenience in accessing DWARF debugging data.
func (DWARF) Entry ¶ added in v0.20.0
Entry returns the entry with a tag equal to name. ErrDWARFEntry is returned if the entry cannot be found.
func (DWARF) EntryInChildren ¶ added in v0.20.0
EntryInChildren returns the entry with a tag equal to name within the children of the current entry. ErrDWARFEntry is returned if the entry cannot be found.
func (DWARF) Field ¶ added in v0.20.0
Field returns the field from the entry e that has attribute a and true. If no field is found, an empty field is returned with false.
func (DWARF) GoStructField ¶ added in v0.20.0
func (d DWARF) GoStructField(id structfield.ID) (int64, error)
GoStructField returns the offset value of a Go struct field. If the struct field cannot be found -1 and a non-nil error will be returned.
type ID ¶ added in v0.22.0
type ID int
ID represents a process identification number.
func (ID) BuildInfo ¶ added in v0.22.0
BuildInfo returns the Go build info of the process ID executable.
func (ID) ExeLink ¶ added in v0.22.0
ExeLink returns the resolved absolute path to the linked executable being run by the process.
func (ID) ExePath ¶ added in v0.22.0
ExePath returns the file path for the executable link of the process ID.
type Info ¶ added in v0.22.0
type Info struct {
ID ID
Functions []*binary.Func
// GoVersion is the semantic version of Go run by the target process.
//
// Experimental and build information included in the version is dropped.
// If a development version of Go is used, the commit hash will be included
// in the metadata of the version.
GoVersion *semver.Version
Modules map[string]*semver.Version
// contains filtered or unexported fields
}
Info are the details about a target process.
func NewInfo ¶ added in v0.22.0
NewInfo returns a new Info with information about the process identified by id. The functions of the returned Info are filtered by relevantFuncs.
A partial Info and error may be returned for dependencies that cannot be parsed.
func (*Info) Alloc ¶ added in v0.22.0
func (i *Info) Alloc(logger *slog.Logger) (*Allocation, error)
Alloc allocates memory for the process described by Info i.
The underlying memory allocation is only successfully performed once for the instance i. Meaning, it is safe to call this multiple times. The first successful result will be returned to all subsequent calls. If an error is returned, subsequent calls will re-attempt to perform the allocation.
It is safe to call this method concurrently.
func (*Info) GetFunctionOffset ¶ added in v0.22.0
GetFunctionOffset returns the offset for of the function with name.