Documentation
¶
Overview ¶
Package core provides functions for reading core dumps and examining their contained heaps.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RawAllocSample ¶
type RawAllocSample struct {
Addr uint64 // address of object
Prof *RawMemProfEntry // record of allocation site
}
RawAllocSample represents a memory profiler allocation sample.
type RawDefer ¶
type RawDefer struct {
Addr uint64 // address of the defer record
GAddr uint64 // address of the containing goroutine's descriptor
ArgP uint64 // stack pointer giving the args for defer (TODO: is this right?)
PC uint64 // PC of the defer instruction
FnAddr uint64 // function to be run (a FuncVal*)
FnPC uint64 // PC of the defered function's entry point
LinkAddr uint64 // address of the next defer record in this chain
}
RawDefer represents a defer.
type RawDump ¶
type RawDump struct {
Params *RawParams
MemStats *runtime.MemStats
HeapObjects []RawSegment // heap objects sorted by Addr, low-to-high
GlobalSegments []RawSegment // data, bss, and noptrbss segments
OSThreads []*RawOSThread
Goroutines []*RawGoroutine
StackFrames []*RawStackFrame
OtherRoots []*RawOtherRoot
Finalizers []*RawFinalizer
Defers []*RawDefer
Panics []*RawPanic
TypeFromItab map[uint64]uint64 // map from itab address to the type address that itab represents
TypeFromAddr map[uint64]*RawType // map from RawType.Addr to RawType
MemProfMap map[uint64]*RawMemProfEntry
AllocSamples []*RawAllocSample
// contains filtered or unexported fields
}
RawDump provides raw access to the heap records in a core file. The raw records in this file are described by other structs named Raw{*}. All []byte slices are direct references to the underlying mmap'd file. These references will become invalid as soon as the RawDump is closed.
func (*RawDump) FindSegment ¶
func (r *RawDump) FindSegment(addr uint64) *RawSegment
FindSegment returns the segment that contains the given address, or nil of no segment contains the address.
type RawFinalizer ¶
type RawFinalizer struct {
IsQueued bool // if true, the object is unreachable and the finalizer is ready to run
ObjAddr uint64 // address of the object to finalize
ObjTypeAddr uint64 // address of the descriptor for typeof(obj)
FnAddr uint64 // function to be run (a FuncVal*)
FnArgTypeAddr uint64 // address of the descriptor for the type of the function argument
FnPC uint64 // PC of finalizer entry point
}
RawFinalizer represents a finalizer.
type RawGoroutine ¶
type RawGoroutine struct {
GAddr uint64 // address of the goroutine descriptor
SP uint64 // current stack pointer (lowest address in the currently running frame)
GoID uint64 // goroutine ID
GoPC uint64 // PC of the go statement that created this goroutine
Status uint64
IsSystem bool // true if started by the system
IsBackground bool // always false in go1.7
WaitSince uint64 // time the goroutine started waiting, in nanoseconds since the Unix epoch
WaitReason string
CtxtAddr uint64 // address of the scheduling ctxt
MAddr uint64 // address of the OS thread descriptor (M)
TopDeferAddr uint64 // address of the top defer record
TopPanicAddr uint64 // address of the top panic record
}
RawGoroutine represents a goroutine structure.
type RawMemProfEntry ¶
type RawMemProfEntry struct {
Size uint64 // size of the allocated object
NumAllocs uint64 // number of allocations
NumFrees uint64 // number of frees
Stacks []RawMemProfFrame // call stacks
}
RawMemProfEntry represents a memory profiler entry.
type RawMemProfFrame ¶
type RawMemProfFrame struct {
Func []byte // string left as []byte reference to save memory
File []byte // string left as []byte reference to save memory
Line uint64
}
RawMemProfFrame represents a memory profiler frame.
type RawOSThread ¶
type RawOSThread struct {
MAddr uint64 // address of the OS thread descriptor (M)
GoID uint64 // go's internal ID for the thread
ProcID uint64 // kernel's ID for the thread
}
RawOSThread represents an OS thread.
type RawOtherRoot ¶
RawOtherRoot represents the other roots not in RawDump's other fields.
type RawPanic ¶
type RawPanic struct {
Addr uint64 // address of the panic record
GAddr uint64 // address of the containing goroutine's descriptor
ArgTypeAddr uint64 // type of the panic arg
ArgAddr uint64 // address of the panic arg
DeferAddr uint64 // address of the defer record that is currently running
LinkAddr uint64 // address of the next panic record in this chain
}
RawPanic represents a panic.
type RawParams ¶
type RawParams struct {
ByteOrder binary.ByteOrder // byte order of all memory in this dump
PtrSize uint64 // in bytes
HeapStart uint64 // heap start address
HeapEnd uint64 // heap end address (this is the last byte in the heap + 1)
GoArch string // GOARCH of the runtime library that generated this dump
GoExperiment string // GOEXPERIMENT of the toolchain that build the runtime library
NCPU uint64 // number of physical cpus available to the program
}
RawParams holds metadata about the program that generated the dump.
type RawPtrFields ¶
type RawPtrFields struct {
// contains filtered or unexported fields
}
RawPtrFields represents a pointer field.
func (RawPtrFields) Offsets ¶
func (r RawPtrFields) Offsets() []uint64
Offsets decodes the list of ptr field offsets.
type RawSegment ¶
type RawSegment struct {
Addr uint64 // base address of the segment
Data []byte // data for this segment
PtrFields RawPtrFields // offsets of ptr fields within this segment
}
RawSegment represents a segment of memory.
func (RawSegment) Contains ¶
func (r RawSegment) Contains(addr uint64) bool
Contains returns true if the segment contains the given address.
func (RawSegment) ContainsRange ¶
func (r RawSegment) ContainsRange(addr, size uint64) bool
ContainsRange returns true if the segment contains the range [addr, addr+size).
func (RawSegment) Size ¶
func (r RawSegment) Size() uint64
Size returns the size of the segment in bytes.
func (RawSegment) Slice ¶
func (r RawSegment) Slice(offset, size uint64) *RawSegment
Slice takes a slice of the given segment. Panics if [offset,offset+size) is out-of-bounds. The resulting RawSegment.PtrOffsets will clipped and translated into the new segment.
type RawStackFrame ¶
type RawStackFrame struct {
Name string
Depth uint64 // 0 = bottom of stack (currently running frame)
CalleeSP uint64 // stack pointer of the child frame (or 0 for the bottom-most frame)
EntryPC uint64 // entry PC for the function
PC uint64 // current PC being executed
NextPC uint64 // for callers, where the function resumes (if anywhere) after the callee is done
Segment RawSegment // local vars (Segment.Addr is the stack pointer, i.e., lowest address in the frame)
}
RawStackFrame represents a stack frame.
type RawType ¶
type RawType struct {
Addr uint64 // address of the type descriptor
Size uint64 // in bytes
Name string // not necessarily unique
// If true, this type is equivalent to a single pointer, so ifaces can store
// this type directly in the data field (without indirection).
DirectIFace bool
}
RawType repesents the Go runtime's representation of a type.