1
2
3
4
5 package objabi
6
7 import "strings"
8
9
10 type FuncFlag uint8
11
12
13 const (
14 FuncFlag_TOPFRAME = 1 << iota
15 FuncFlag_SPWRITE
16 FuncFlag_ASM
17 )
18
19
20
21
22
23 type FuncID uint8
24
25
26 const (
27 FuncID_normal FuncID = iota
28 FuncID_abort
29 FuncID_asmcgocall
30 FuncID_asyncPreempt
31 FuncID_cgocallback
32 FuncID_debugCallV2
33 FuncID_gcBgMarkWorker
34 FuncID_goexit
35 FuncID_gogo
36 FuncID_gopanic
37 FuncID_handleAsyncEvent
38 FuncID_mcall
39 FuncID_morestack
40 FuncID_mstart
41 FuncID_panicwrap
42 FuncID_rt0_go
43 FuncID_runfinq
44 FuncID_runtime_main
45 FuncID_sigpanic
46 FuncID_systemstack
47 FuncID_systemstack_switch
48 FuncID_wrapper
49 )
50
51 var funcIDs = map[string]FuncID{
52 "abort": FuncID_abort,
53 "asmcgocall": FuncID_asmcgocall,
54 "asyncPreempt": FuncID_asyncPreempt,
55 "cgocallback": FuncID_cgocallback,
56 "debugCallV2": FuncID_debugCallV2,
57 "gcBgMarkWorker": FuncID_gcBgMarkWorker,
58 "go": FuncID_rt0_go,
59 "goexit": FuncID_goexit,
60 "gogo": FuncID_gogo,
61 "gopanic": FuncID_gopanic,
62 "handleAsyncEvent": FuncID_handleAsyncEvent,
63 "main": FuncID_runtime_main,
64 "mcall": FuncID_mcall,
65 "morestack": FuncID_morestack,
66 "mstart": FuncID_mstart,
67 "panicwrap": FuncID_panicwrap,
68 "runfinq": FuncID_runfinq,
69 "sigpanic": FuncID_sigpanic,
70 "switch": FuncID_systemstack_switch,
71 "systemstack": FuncID_systemstack,
72
73
74 "deferreturn": FuncID_wrapper,
75 "runOpenDeferFrame": FuncID_wrapper,
76 "deferCallSave": FuncID_wrapper,
77 }
78
79
80
81 func GetFuncID(name string, isWrapper bool) FuncID {
82 if isWrapper {
83 return FuncID_wrapper
84 }
85 if strings.HasPrefix(name, "runtime.") {
86 if id, ok := funcIDs[name[len("runtime."):]]; ok {
87 return id
88 }
89 }
90 return FuncID_normal
91 }
92
View as plain text