github.com/haraldrudell/parl@v0.4.176/pruntime/frame.go (about)

     1  /*
     2  © 2022–present Harald Rudell <harald.rudell@gmail.com> (https://haraldrudell.github.io/haraldrudell/)
     3  ISC License
     4  */
     5  
     6  package pruntime
     7  
     8  // Frame represents an executing code location, ie. a code line in source code
     9  //   - parl.Frame is similar to [runtime.Frame] returned by [runtime.CallersFrames]
    10  //     but has only basic types, ie. it can be printed, stored and transferred
    11  //   - a lis of Frame is returned by [Stack.Frames]
    12  type Frame interface {
    13  	// the code location for this frame, never nil
    14  	Loc() (location *CodeLocation)
    15  	// function argument values like “(1, 0x14000113040)”
    16  	//	- values of basic types like int are displayed
    17  	//	- most types appear as a pointer value “0x…”
    18  	Args() (args string)
    19  	// prints the Frame suitable to be part of a stack trace
    20  	//   - fully qualified package name with function or type and method
    21  	//     and argument values
    22  	//   - absolute path to source file and line number
    23  	//
    24  	// output:
    25  	//
    26  	//	github.com/haraldrudell/parl/pdebug.TestFrame(0x1400014a340)␤
    27  	//	␠␠frame_test.go:15
    28  	String() (s string)
    29  }