gocore

package
v0.0.0-...-e033642 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2017 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Field

type Field struct {
	Name string
	Off  int64
	Type *Type
}

A Field represents a single field of a struct type.

type Flags

type Flags uint8
const (
	FlagTypes Flags = 1 << iota
	FlagReverse
)

type Frame

type Frame struct {

	// Set of locations that contain a live pointer. Note that this set
	// may contain locations outside the frame (in particular, the args
	// for the frame).
	Live map[core.Address]bool
	// contains filtered or unexported fields
}

func (*Frame) Func

func (f *Frame) Func() *Func

Func returns the function for which this frame is an activation record.

func (*Frame) Max

func (f *Frame) Max() core.Address

Max returns the maximum address of this frame.

func (*Frame) Min

func (f *Frame) Min() core.Address

Min returns the minimum address of this frame.

func (*Frame) PC

func (f *Frame) PC() core.Address

PC returns the program counter of the next instruction to be executed by this frame.

func (*Frame) Parent

func (f *Frame) Parent() *Frame

Parent returns the parent frame of f, or nil if it is the top of the stack.

func (*Frame) Roots

func (f *Frame) Roots() []*Root

Roots returns a list of all the garbage collection roots in the frame.

type Func

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

func (*Func) Entry

func (f *Func) Entry() core.Address

Entry returns the address of the entry point of f.

func (*Func) Name

func (f *Func) Name() string

type Goroutine

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

func (*Goroutine) Addr

func (g *Goroutine) Addr() core.Address

Addr returns the address of the runtime.g that identifies this goroutine.

func (*Goroutine) Frames

func (g *Goroutine) Frames() []*Frame

Frames returns the list of frames on the stack of the Goroutine. The first frame is the most recent one. This list is post-optimization, so any inlined calls, tail calls, etc. will not appear.

func (*Goroutine) Stack

func (g *Goroutine) Stack() int64

Stack returns the total allocated stack for g.

type Kind

type Kind uint8
const (
	KindNone Kind = iota
	KindBool
	KindInt
	KindUint
	KindFloat
	KindComplex
	KindArray
	KindPtr // includes chan, func, map, unsafe.Pointer
	KindIface
	KindEface
	KindSlice
	KindString
	KindStruct
	KindFunc //TODO?
)

func (Kind) String

func (k Kind) String() string

type Object

type Object core.Address

An Object represents a single object in the Go heap.

type Process

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

func Core

func Core(proc *core.Process, flags Flags) (p *Process, err error)

Core takes a loaded core file and extracts Go information from it. flags is a bitmask of data that should be extracted from the core.

func (*Process) Addr

func (p *Process) Addr(x Object) core.Address

Addr returns the starting address of x.

func (*Process) BuildVersion

func (p *Process) BuildVersion() string

BuildVersion returns the Go version that was used to build the inferior binary.

func (*Process) FindFunc

func (p *Process) FindFunc(pc core.Address) *Func

FindFunc returns the function which contains the code at address pc, if any.

func (*Process) FindObject

func (p *Process) FindObject(a core.Address) (Object, int64)

FindObject finds the object containing a. Returns that object and the offset within that object to which a points. Returns 0,0 if a doesn't point to a live heap object.

func (*Process) ForEachFreeRegion

func (p *Process) ForEachFreeRegion(fn func(core.Address, int64) bool)

ForEachFreeRegion calls fn with each free region in the Go heap. It calls fn with:

the address of the start of the free region
the size of the free region

If fn returns false, ForEachFreeRegion returns immediately. A free region is one which could satisfy an allocation of the reported size or less. Free regions do not include garbage objects (those which aren't reachable, but haven't been noticed as unreachable yet by the runtime).

func (*Process) ForEachObject

func (p *Process) ForEachObject(fn func(x Object) bool)

ForEachObject calls fn with each object in the Go heap. If fn returns false, ForEachObject returns immediately.

func (*Process) ForEachPtr

func (p *Process) ForEachPtr(x Object, fn func(int64, Object, int64) bool)

ForEachPtr calls fn for all heap pointers it finds in x. It calls fn with:

the offset of the pointer slot in x
the pointed-to object y
the offset in y where the pointer points.

If fn returns false, ForEachPtr returns immediately. For an edge from an object to its finalizer, the first argument passed to fn will be -1.

func (*Process) ForEachReversePtr

func (p *Process) ForEachReversePtr(y Object, fn func(x Object, r *Root, i, j int64) bool)

ForEachReversePtr calls fn for all pointers it finds pointing to y. It calls fn with:

the object or root which points to y (exactly one will be non-nil)
the offset i in that object or root where the pointer appears.
the offset j in y where the pointer points.

If fn returns false, ForEachReversePtr returns immediately. FlagReverse must have been passed to Core when p was constructed.

func (*Process) ForEachRoot

func (p *Process) ForEachRoot(fn func(r *Root) bool)

ForEachRoot calls fn with each garbage collection root. If fn returns false, ForEachRoot returns immediately.

func (*Process) ForEachRootPtr

func (p *Process) ForEachRootPtr(r *Root, fn func(int64, Object, int64) bool)

ForEachRootPtr behaves like ForEachPtr but it starts with a Root instead of an Object.

func (*Process) Globals

func (p *Process) Globals() []*Root

func (*Process) Goroutines

func (p *Process) Goroutines() []*Goroutine

func (*Process) IsPtr

func (p *Process) IsPtr(a core.Address) bool

IsPtr reports whether the inferior at address a contains a pointer.

func (*Process) Process

func (p *Process) Process() *core.Process

Process returns the core.Process used to construct this Process.

func (*Process) Size

func (p *Process) Size(x Object) int64

Size returns the size of x in bytes.

func (*Process) Stats

func (p *Process) Stats() *Stats

Stats returns a breakdown of the program's memory use by category.

func (*Process) Type

func (p *Process) Type(x Object) (*Type, int64)

Type returns the type and repeat count for the object x. x contains at least repeat copies of the returned type. FlagTypes must have been passed to Core when p was constructed.

type Root

type Root struct {
	Name string
	Addr core.Address
	Type *Type
	// Frame, if non-nil, points to the frame in which this root lives.
	// Roots with non-nil Frame fields should use Frame.Live to filter the live pointers in this Root.
	Frame *Frame
}

A Root is an area of memory that might have pointers into the heap.

type Stats

type Stats struct {
	Name     string
	Size     int64
	Children []*Stats
}

A Stats struct is the node of a tree representing the entire memory usage of the Go program. Children of a node break its usage down by category. We maintain the invariant that, if there are children, Size == sum(c.Size for c in Children).

func (*Stats) Child

func (s *Stats) Child(name string) *Stats

type Type

type Type struct {
	Size int64
	Kind Kind

	// Fields only valid for a subset of kinds.
	Count  int64   // for kind == KindArray
	Elem   *Type   // for kind == Kind{Ptr,Array,Slice,String}. nil for unsafe.Pointer. Always uint8 for KindString.
	Fields []Field // for kind == KindStruct
	// contains filtered or unexported fields
}

A Type is the representation of the type of a Go object.

func (*Type) String

func (t *Type) String() string

Jump to

Keyboard shortcuts

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