github.com/stealthrocket/wzprof@v0.2.1-0.20230830205924-5fa86be5e5b3/internal/goruntime/symtab.go (about) 1 package goruntime 2 3 // Copied verbatim from the Go runtime code. Source: 4 // https://github.com/golang/go/blob/b950cc8f11dc31cc9f6cfbed883818a7aa3abe94/src/internal/abi/symtab.go 5 6 // Copyright (c) 2009 The Go Authors. All rights reserved. 7 // 8 // Redistribution and use in source and binary forms, with or without 9 // modification, are permitted provided that the following conditions are met: 10 // 11 // * Redistributions of source code must retain the above copyright notice, 12 // this list of conditions and the following disclaimer. 13 // * Redistributions in binary form must reproduce the above copyright 14 // notice, this list of conditions and the following disclaimer in the 15 // documentation and/or other materials provided with the distribution. 16 // * Neither the name of Google Inc. nor the names of its contributors may be 17 // used to endorse or promote products derived from this software without 18 // specific prior written permission. 19 // 20 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 24 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 // POSSIBILITY OF SUCH DAMAGE. 31 32 type FuncID uint8 33 34 const ( 35 // If you add a FuncID, you probably also want to add an entry to the map in 36 // ../../cmd/internal/objabi/funcid.go. 37 38 FuncIDNormal FuncID = iota // not a special function 39 FuncID_abort 40 FuncID_asmcgocall 41 FuncID_asyncPreempt 42 FuncID_cgocallback 43 FuncID_debugCallV2 44 FuncID_gcBgMarkWorker 45 FuncID_goexit 46 FuncID_gogo 47 FuncID_gopanic 48 FuncID_handleAsyncEvent 49 FuncID_mcall 50 FuncID_morestack 51 FuncID_mstart 52 FuncID_panicwrap 53 FuncID_rt0_go 54 FuncID_runfinq 55 FuncID_runtime_main 56 FuncID_sigpanic 57 FuncID_systemstack 58 FuncID_systemstack_switch 59 FuncIDWrapper // any autogenerated code (hash/eq algorithms, method wrappers, etc.) 60 ) 61 62 const ( 63 PCDATA_UnsafePoint = 0 64 PCDATA_StackMapIndex = 1 65 PCDATA_InlTreeIndex = 2 66 PCDATA_ArgLiveIndex = 3 67 68 FUNCDATA_ArgsPointerMaps = 0 69 FUNCDATA_LocalsPointerMaps = 1 70 FUNCDATA_StackObjects = 2 71 FUNCDATA_InlTree = 3 72 FUNCDATA_OpenCodedDeferInfo = 4 73 FUNCDATA_ArgInfo = 5 74 FUNCDATA_ArgLiveInfo = 6 75 FUNCDATA_WrapInfo = 7 76 ) 77 78 // A FuncFlag records bits about a function, passed to the runtime. 79 type FuncFlag uint8 80 81 const ( 82 // FuncFlagTopFrame indicates a function that appears at the top of its stack. 83 // The traceback routine stop at such a function and consider that a 84 // successful, complete traversal of the stack. 85 // Examples of TopFrame functions include goexit, which appears 86 // at the top of a user goroutine stack, and mstart, which appears 87 // at the top of a system goroutine stack. 88 FuncFlagTopFrame FuncFlag = 1 << iota 89 90 // FuncFlagSPWrite indicates a function that writes an arbitrary value to SP 91 // (any write other than adding or subtracting a constant amount). 92 // The traceback routines cannot encode such changes into the 93 // pcsp tables, so the function traceback cannot safely unwind past 94 // SPWrite functions. Stopping at an SPWrite function is considered 95 // to be an incomplete unwinding of the stack. In certain contexts 96 // (in particular garbage collector stack scans) that is a fatal error. 97 FuncFlagSPWrite 98 99 // FuncFlagAsm indicates that a function was implemented in assembly. 100 FuncFlagAsm 101 )