| 1 | // Copyright 2021 The Go Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
| 5 | package pkgbitsscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/ |
| 6 | |
| 7 | import ( |
| 8 | "fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/" |
| 9 | "runtimescip-go gomod github.com/golang/go/src go1.25.0 runtime/" |
| 10 | "stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/" |
| 11 | ) |
| 12 | |
| 13 | // fmtFrames formats a backtrace for reporting reader/writer desyncs. |
| 14 | func fmtFramesscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/fmtFrames().(pcs ...uintptr) []string { |
| 15 | res := make([]string, 0, len(pcs)) |
| 16 | walkFramesscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/walkFrames().(pcs, func(file string, line int, name string, offset uintptr) { |
| 17 | // Trim package from function name. It's just redundant noise. |
| 18 | name = stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.TrimPrefixscip-go gomod github.com/golang/go/src go1.25.0 strings/TrimPrefix().(name, "cmd/compile/internal/noder.") |
| 19 | |
| 20 | res = append(res, fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Sprintf().("%s:%v: %s +0x%v", file, line, name, offset)) |
| 21 | }) |
| 22 | return res |
| 23 | } |
| 24 | |
| 25 | type frameVisitorscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/frameVisitor# func(file string, line int, name string, offset uintptr) |
| 26 | |
| 27 | // walkFrames calls visit for each call frame represented by pcs. |
| 28 | // |
| 29 | // pcs should be a slice of PCs, as returned by runtime.Callers. |
| 30 | func walkFramesscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/walkFrames().(pcs []uintptr, visit frameVisitorscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/frameVisitor#) { |
| 31 | if len(pcs) == 0 { |
| 32 | return |
| 33 | } |
| 34 | |
| 35 | frames := runtimescip-go gomod github.com/golang/go/src go1.25.0 runtime/.CallersFramesscip-go gomod github.com/golang/go/src go1.25.0 runtime/CallersFrames().(pcs) |
| 36 | for { |
| 37 | frame, more := frames.Nextscip-go gomod github.com/golang/go/src go1.25.0 runtime/Frames#Next().() |
| 38 | visit(frame.Filescip-go gomod github.com/golang/go/src go1.25.0 runtime/Frame#File., frame.Linescip-go gomod github.com/golang/go/src go1.25.0 runtime/Frame#Line., frame.Functionscip-go gomod github.com/golang/go/src go1.25.0 runtime/Frame#Function., frame.PCscip-go gomod github.com/golang/go/src go1.25.0 runtime/Frame#PC.-frame.Entryscip-go gomod github.com/golang/go/src go1.25.0 runtime/Frame#Entry.) |
| 39 | if !more { |
| 40 | return |
| 41 | } |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | // SyncMarker is an enum type that represents markers that may be |
| 46 | // written to export data to ensure the reader and writer stay |
| 47 | // synchronized. |
| 48 | type SyncMarkerscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncMarker# int |
| 49 | |
| 50 | //go:generate stringer -type=SyncMarker -trimprefix=Sync |
| 51 | |
| 52 | const ( |
| 53 | _ SyncMarkerscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncMarker# = iota |
| 54 | |
| 55 | // Public markers (known to go/types importers). |
| 56 | |
| 57 | // Low-level coding markers. |
| 58 | SyncEOFscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncEOF. |
| 59 | SyncBoolscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncBool. |
| 60 | SyncInt64scip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncInt64. |
| 61 | SyncUint64scip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncUint64. |
| 62 | SyncStringscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncString. |
| 63 | SyncValuescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncValue. |
| 64 | SyncValscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncVal. |
| 65 | SyncRelocsscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncRelocs. |
| 66 | SyncRelocscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncReloc. |
| 67 | SyncUseRelocscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncUseReloc. |
| 68 | |
| 69 | // Higher-level object and type markers. |
| 70 | SyncPublicscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncPublic. |
| 71 | SyncPosscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncPos. |
| 72 | SyncPosBasescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncPosBase. |
| 73 | SyncObjectscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncObject. |
| 74 | SyncObject1scip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncObject1. |
| 75 | SyncPkgscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncPkg. |
| 76 | SyncPkgDefscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncPkgDef. |
| 77 | SyncMethodscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncMethod. |
| 78 | SyncTypescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncType. |
| 79 | SyncTypeIdxscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncTypeIdx. |
| 80 | SyncTypeParamNamesscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncTypeParamNames. |
| 81 | SyncSignaturescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncSignature. |
| 82 | SyncParamsscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncParams. |
| 83 | SyncParamscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncParam. |
| 84 | SyncCodeObjscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncCodeObj. |
| 85 | SyncSymscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncSym. |
| 86 | SyncLocalIdentscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncLocalIdent. |
| 87 | SyncSelectorscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncSelector. |
| 88 | |
| 89 | // Private markers (only known to cmd/compile). |
| 90 | SyncPrivatescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncPrivate. |
| 91 | |
| 92 | SyncFuncExtscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncFuncExt. |
| 93 | SyncVarExtscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncVarExt. |
| 94 | SyncTypeExtscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncTypeExt. |
| 95 | SyncPragmascip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncPragma. |
| 96 | |
| 97 | SyncExprListscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncExprList. |
| 98 | SyncExprsscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncExprs. |
| 99 | SyncExprscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncExpr. |
| 100 | SyncExprTypescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncExprType. |
| 101 | SyncAssignscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncAssign. |
| 102 | SyncOpscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncOp. |
| 103 | SyncFuncLitscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncFuncLit. |
| 104 | SyncCompLitscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncCompLit. |
| 105 | |
| 106 | SyncDeclscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncDecl. |
| 107 | SyncFuncBodyscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncFuncBody. |
| 108 | SyncOpenScopescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncOpenScope. |
| 109 | SyncCloseScopescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncCloseScope. |
| 110 | SyncCloseAnotherScopescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncCloseAnotherScope. |
| 111 | SyncDeclNamesscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncDeclNames. |
| 112 | SyncDeclNamescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncDeclName. |
| 113 | |
| 114 | SyncStmtsscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncStmts. |
| 115 | SyncBlockStmtscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncBlockStmt. |
| 116 | SyncIfStmtscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncIfStmt. |
| 117 | SyncForStmtscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncForStmt. |
| 118 | SyncSwitchStmtscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncSwitchStmt. |
| 119 | SyncRangeStmtscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncRangeStmt. |
| 120 | SyncCaseClausescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncCaseClause. |
| 121 | SyncCommClausescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncCommClause. |
| 122 | SyncSelectStmtscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncSelectStmt. |
| 123 | SyncDeclsscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncDecls. |
| 124 | SyncLabeledStmtscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncLabeledStmt. |
| 125 | SyncUseObjLocalscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncUseObjLocal. |
| 126 | SyncAddLocalscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncAddLocal. |
| 127 | SyncLinknamescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncLinkname. |
| 128 | SyncStmt1scip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncStmt1. |
| 129 | SyncStmtsEndscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncStmtsEnd. |
| 130 | SyncLabelscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncLabel. |
| 131 | SyncOptLabelscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncOptLabel. |
| 132 | |
| 133 | SyncMultiExprscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncMultiExpr. |
| 134 | SyncRTypescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncRType. |
| 135 | SyncConvRTTIscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/pkgbits`/SyncConvRTTI. |
| 136 | ) |