MCPcopy Index your code
hub / github.com/go-errors/errors / NewStackFrame

Function NewStackFrame

stackframe.go:28–41  ·  view source on GitHub ↗

NewStackFrame popoulates a stack frame object from the program counter.

(pc uintptr)

Source from the content-addressed store, hash-verified

26
27// NewStackFrame popoulates a stack frame object from the program counter.
28func NewStackFrame(pc uintptr) (frame StackFrame) {
29
30 frame = StackFrame{ProgramCounter: pc}
31 if frame.Func() == nil {
32 return
33 }
34 frame.Package, frame.Name = packageAndName(frame.Func())
35
36 // pc -1 because the program counters we use are usually return addresses,
37 // and we want to show the line that corresponds to the function call
38 frame.File, frame.LineNumber = frame.Func().FileLine(pc - 1)
39 return
40
41}
42
43// Func returns the function that contained this frame.
44func (frame *StackFrame) Func() *runtime.Func {

Callers 1

StackFramesMethod · 0.85

Calls 2

packageAndNameFunction · 0.85
FuncMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…