package gocore
import "golang.org/x/debug/internal/gocore"
Index ¶
- Constants
- type Field
- type Frame
- func (f *Frame) Func() *Func
- func (f *Frame) Max() core.Address
- func (f *Frame) Min() core.Address
- func (f *Frame) PC() core.Address
- func (f *Frame) Parent() *Frame
- func (f *Frame) Roots() []*Root
- type Func
- type Goroutine
- func (g *Goroutine) Addr() core.Address
- func (g *Goroutine) Frames() []*Frame
- func (g *Goroutine) Stack() int64
- type Kind
- type Object
- type Process
- func Core(proc *core.Process) (p *Process, err error)
- func (p *Process) Addr(x Object) core.Address
- func (p *Process) BuildVersion() string
- func (p *Process) DynamicType(t *Type, a core.Address) *Type
- func (p *Process) FindFunc(pc core.Address) *Func
- func (p *Process) FindObject(a core.Address) (Object, int64)
- func (p *Process) ForEachObject(fn func(x Object) bool)
- func (p *Process) ForEachPtr(x Object, fn func(int64, Object, int64) bool)
- func (p *Process) ForEachReversePtr(y Object, fn func(x Object, r *Root, i, j int64) bool)
- func (p *Process) ForEachRoot(fn func(r *Root) bool)
- func (p *Process) ForEachRootPtr(r *Root, fn func(int64, Object, int64) bool)
- func (p *Process) Globals() []*Root
- func (p *Process) Goroutines() []*Goroutine
- func (p *Process) IsPtr(a core.Address) bool
- func (p *Process) Process() *core.Process
- func (p *Process) Size(x Object) int64
- func (p *Process) Stats() *Statistic
- func (p *Process) Type(x Object) (*Type, int64)
- type Root
- type Statistic
- func (s *Statistic) Children() iter.Seq[*Statistic]
- func (s *Statistic) Sub(chain ...string) *Statistic
- type Type
Constants ¶
Types ¶
type Field ¶
A Field represents a single field of a struct type.
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 }
A Frame represents the local variables of a single Go function invocation. (Note that in the presence of inlining, a Frame may contain local variables for more than one Go function invocation.)
func (*Frame) Func ¶
Func returns the function for which this frame is an activation record.
func (*Frame) Max ¶
Max returns the maximum address of this frame.
func (*Frame) Min ¶
Min returns the minimum address of this frame.
func (*Frame) PC ¶
PC returns the program counter of the next instruction to be executed by this frame.
func (*Frame) Parent ¶
Parent returns the parent frame of f, or nil if it is the top of the stack.
func (*Frame) Roots ¶
Roots returns a list of all the garbage collection roots in the frame.
type Func ¶
type Func struct {
// contains filtered or unexported fields
}
A Func represents a Go function.
func (*Func) Entry ¶
Entry returns the address of the entry point of f.
func (*Func) Name ¶
Name returns the name of the function, as reported by DWARF. Names are opaque; do not depend on the format of the returned name.
type Goroutine ¶
type Goroutine struct {
// contains filtered or unexported fields
}
func (*Goroutine) Addr ¶
Addr returns the address of the runtime.g that identifies this goroutine.
func (*Goroutine) Frames ¶
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 ¶
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, map, unsafe.Pointer KindIface KindEface KindSlice KindString KindStruct KindFunc )
func (Kind) String ¶
type Object ¶
An Object represents a single reachable object in the Go heap. Unreachable (garbage) objects are not represented as Objects.
type Process ¶
type Process struct {
// contains filtered or unexported fields
}
A Process represents the state of a Go process that core dumped.
func Core ¶
Core takes a loaded core file and extracts Go information from it.
func (*Process) Addr ¶
Addr returns the starting address of x.
func (*Process) BuildVersion ¶
BuildVersion returns the Go version that was used to build the inferior binary.
func (*Process) DynamicType ¶
DynamicType returns the concrete type stored in the interface type t at address a. If the interface is nil, returns nil.
func (*Process) FindFunc ¶
FindFunc returns the function which contains the code at address pc, if any.
func (*Process) FindObject ¶
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) ForEachObject ¶
ForEachObject calls fn with each object in the Go heap. If fn returns false, ForEachObject returns immediately.
func (*Process) ForEachPtr ¶
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. (TODO: implement)
func (*Process) ForEachReversePtr ¶
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.
func (*Process) ForEachRoot ¶
ForEachRoot calls fn with each garbage collection root. If fn returns false, ForEachRoot returns immediately.
func (*Process) ForEachRootPtr ¶
ForEachRootPtr behaves like ForEachPtr but it starts with a Root instead of an Object.
func (*Process) Globals ¶
func (*Process) Goroutines ¶
func (*Process) IsPtr ¶
IsPtr reports whether the inferior at address a contains a pointer.
func (*Process) Process ¶
Process returns the core.Process used to construct this Process.
func (*Process) Size ¶
Size returns the size of x in bytes.
func (*Process) Stats ¶
Stats returns a breakdown of the program's memory use by category.
func (*Process) Type ¶
Type returns the type and repeat count for the object x. x contains at least repeat copies of the returned type.
type Root ¶
type Root struct { Name string Type *Type // always non-nil // Frame, if non-nil, points to the frame in which this root lives. // Roots with non-nil Frame fields refer to local variables on a stack. // A stack root might be a large type, with some of its fields live and // others dead. Consult Frame.Live to find out which pointers in a stack // root are live. Frame *Frame // contains filtered or unexported fields }
A Root is an area of memory that might have pointers into the Go heap.
func (*Root) Addr ¶
Addr returns the address of the root, if it has one.
func (*Root) HasAddress ¶
HasAddress returns true if the root is simple and contiguous, and can be described with just a single address.
type Statistic ¶
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 (*Statistic) Children ¶
func (*Statistic) Sub ¶
type Type ¶
type Type struct { Name string Size int64 Kind Kind // common dwarf types. // 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. Types are not necessarily canonical. Names are opaque; do not depend on the format of the returned name.
func (*Type) HasField ¶
func (*Type) String ¶
Source Files ¶
dominator.go dwarf.go goroutine.go module.go object.go process.go region.go reverse.go root.go type.go
- Version
- v0.0.0-20250223200816-04bfb7cc7686 (latest)
- Published
- Feb 23, 2025
- Platform
- linux/amd64
- Imports
- 20 packages
- Last checked
- 1 month ago –
Tools for package owners.