package pkgbits
import (
"fmt"
"runtime"
"strings"
)
func fmtFrames(pcs ...uintptr ) []string {
res := make ([]string , 0 , len (pcs ))
walkFrames (pcs , func (file string , line int , name string , offset uintptr ) {
name = strings .TrimPrefix (name , "cmd/compile/internal/noder." )
res = append (res , fmt .Sprintf ("%s:%v: %s +0x%v" , file , line , name , offset ))
})
return res
}
type frameVisitor func (file string , line int , name string , offset uintptr )
func walkFrames(pcs []uintptr , visit frameVisitor ) {
if len (pcs ) == 0 {
return
}
frames := runtime .CallersFrames (pcs )
for {
frame , more := frames .Next ()
visit (frame .File , frame .Line , frame .Function , frame .PC -frame .Entry )
if !more {
return
}
}
}
type SyncMarker int
const (
_ SyncMarker = iota
SyncEOF
SyncBool
SyncInt64
SyncUint64
SyncString
SyncValue
SyncVal
SyncRelocs
SyncReloc
SyncUseReloc
SyncPublic
SyncPos
SyncPosBase
SyncObject
SyncObject1
SyncPkg
SyncPkgDef
SyncMethod
SyncType
SyncTypeIdx
SyncTypeParamNames
SyncSignature
SyncParams
SyncParam
SyncCodeObj
SyncSym
SyncLocalIdent
SyncSelector
SyncPrivate
SyncFuncExt
SyncVarExt
SyncTypeExt
SyncPragma
SyncExprList
SyncExprs
SyncExpr
SyncExprType
SyncAssign
SyncOp
SyncFuncLit
SyncCompLit
SyncDecl
SyncFuncBody
SyncOpenScope
SyncCloseScope
SyncCloseAnotherScope
SyncDeclNames
SyncDeclName
SyncStmts
SyncBlockStmt
SyncIfStmt
SyncForStmt
SyncSwitchStmt
SyncRangeStmt
SyncCaseClause
SyncCommClause
SyncSelectStmt
SyncDecls
SyncLabeledStmt
SyncUseObjLocal
SyncAddLocal
SyncLinkname
SyncStmt1
SyncStmtsEnd
SyncLabel
SyncOptLabel
SyncMultiExpr
SyncRType
SyncConvRTTI
)
The pages are generated with Golds v0.7.0-preview . (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu .
PR and bug reports are welcome and can be submitted to the issue list .
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds .