podman
100 строк · 2.8 Кб
1// Copyright 2018 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
5package objabi
6
7// A FuncID identifies particular functions that need to be treated
8// specially by the runtime.
9// Note that in some situations involving plugins, there may be multiple
10// copies of a particular special runtime function.
11// Note: this list must match the list in runtime/symtab.go.
12type FuncID uint8
13
14const (
15FuncID_normal FuncID = iota // not a special function
16FuncID_runtime_main
17FuncID_goexit
18FuncID_jmpdefer
19FuncID_mcall
20FuncID_morestack
21FuncID_mstart
22FuncID_rt0_go
23FuncID_asmcgocall
24FuncID_sigpanic
25FuncID_runfinq
26FuncID_gcBgMarkWorker
27FuncID_systemstack_switch
28FuncID_systemstack
29FuncID_cgocallback_gofunc
30FuncID_gogo
31FuncID_externalthreadhandler
32FuncID_debugCallV1
33FuncID_gopanic
34FuncID_panicwrap
35FuncID_handleAsyncEvent
36FuncID_asyncPreempt
37FuncID_wrapper // any autogenerated code (hash/eq algorithms, method wrappers, etc.)
38)
39
40// Get the function ID for the named function in the named file.
41// The function should be package-qualified.
42func GetFuncID(name string, isWrapper bool) FuncID {
43if isWrapper {
44return FuncID_wrapper
45}
46switch name {
47case "runtime.main":
48return FuncID_runtime_main
49case "runtime.goexit":
50return FuncID_goexit
51case "runtime.jmpdefer":
52return FuncID_jmpdefer
53case "runtime.mcall":
54return FuncID_mcall
55case "runtime.morestack":
56return FuncID_morestack
57case "runtime.mstart":
58return FuncID_mstart
59case "runtime.rt0_go":
60return FuncID_rt0_go
61case "runtime.asmcgocall":
62return FuncID_asmcgocall
63case "runtime.sigpanic":
64return FuncID_sigpanic
65case "runtime.runfinq":
66return FuncID_runfinq
67case "runtime.gcBgMarkWorker":
68return FuncID_gcBgMarkWorker
69case "runtime.systemstack_switch":
70return FuncID_systemstack_switch
71case "runtime.systemstack":
72return FuncID_systemstack
73case "runtime.cgocallback_gofunc":
74return FuncID_cgocallback_gofunc
75case "runtime.gogo":
76return FuncID_gogo
77case "runtime.externalthreadhandler":
78return FuncID_externalthreadhandler
79case "runtime.debugCallV1":
80return FuncID_debugCallV1
81case "runtime.gopanic":
82return FuncID_gopanic
83case "runtime.panicwrap":
84return FuncID_panicwrap
85case "runtime.handleAsyncEvent":
86return FuncID_handleAsyncEvent
87case "runtime.asyncPreempt":
88return FuncID_asyncPreempt
89case "runtime.deferreturn":
90// Don't show in the call stack (used when invoking defer functions)
91return FuncID_wrapper
92case "runtime.runOpenDeferFrame":
93// Don't show in the call stack (used when invoking defer functions)
94return FuncID_wrapper
95case "runtime.reflectcallSave":
96// Don't show in the call stack (used when invoking defer functions)
97return FuncID_wrapper
98}
99return FuncID_normal
100}
101