Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetCache ¶
SetCache sets name, file and line for the PC. It allows to work with PC in another binary the same as in original.
func SetCacheBytes ¶ added in v0.4.0
Types ¶
type PC ¶
type PC uintptr
PC is a program counter alias. Function name, file name and line can be obtained from it but only in the same binary where Caller or FuncEntry was called.
func Caller ¶
Caller returns information about the calling goroutine's stack. The argument s is the number of frames to ascend, with 0 identifying the caller of Caller.
It's hacked version of runtime.Caller with no allocs.
func CallerOnce ¶
func FuncEntry ¶ added in v0.5.0
FuncEntry returns information about the calling goroutine's stack. The argument s is the number of frames to ascend, with 0 identifying the caller of Caller.
It's hacked version of runtime.Callers -> runtime.CallersFrames -> Frames.Next -> Frame.Entry with no allocs.
func FuncEntryFromFunc ¶ added in v0.5.0
func FuncEntryFromFunc(f interface{}) PC
func FuncEntryOnce ¶ added in v0.5.0
func (PC) NameFileLine ¶
NameFileLine returns function name, file and line number for location.
This works only in the same binary where location was captured.
This functions is a little bit modified version of runtime.(*Frames).Next().
type PCs ¶
type PCs []PC
PCs is a stack trace. It's quiet the same as runtime.CallerFrames but more efficient.
func Callers ¶
Callers returns callers stack trace.
It's hacked version of runtime.Callers -> runtime.CallersFrames -> Frames.Next -> Frame.Entry with only one alloc (resulting slice).
func CallersFill ¶
CallersFill puts callers stack trace into provided slice.
It's hacked version of runtime.Callers -> runtime.CallersFrames -> Frames.Next -> Frame.Entry with no allocs.
func (PCs) FormatString ¶
FormatString formats PCs as list of type_name (file.go:line)
Works only in the same binary where Caller of FuncEntry was called. Or if PC.SetCache was called.