summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cmd/internal/objabi/funcid.go113
-rw-r--r--src/runtime/symtab.go26
2 files changed, 61 insertions, 78 deletions
diff --git a/src/cmd/internal/objabi/funcid.go b/src/cmd/internal/objabi/funcid.go
index 1d098ee172..e921a82c0c 100644
--- a/src/cmd/internal/objabi/funcid.go
+++ b/src/cmd/internal/objabi/funcid.go
@@ -4,6 +4,8 @@
package objabi
+import "strings"
+
// A FuncID identifies particular functions that need to be treated
// specially by the runtime.
// Note that in some situations involving plugins, there may be multiple
@@ -13,88 +15,69 @@ type FuncID uint8
const (
FuncID_normal FuncID = iota // not a special function
- FuncID_runtime_main
+ FuncID_asmcgocall
+ FuncID_asyncPreempt
+ FuncID_cgocallback
+ FuncID_debugCallV1
+ FuncID_externalthreadhandler
+ FuncID_gcBgMarkWorker
FuncID_goexit
+ FuncID_gogo
+ FuncID_gopanic
+ FuncID_handleAsyncEvent
FuncID_jmpdefer
FuncID_mcall
FuncID_morestack
FuncID_mstart
+ FuncID_panicwrap
FuncID_rt0_go
- FuncID_asmcgocall
- FuncID_sigpanic
FuncID_runfinq
- FuncID_gcBgMarkWorker
- FuncID_systemstack_switch
+ FuncID_runtime_main
+ FuncID_sigpanic
FuncID_systemstack
- FuncID_cgocallback
- FuncID_gogo
- FuncID_externalthreadhandler
- FuncID_debugCallV1
- FuncID_gopanic
- FuncID_panicwrap
- FuncID_handleAsyncEvent
- FuncID_asyncPreempt
+ FuncID_systemstack_switch
FuncID_wrapper // any autogenerated code (hash/eq algorithms, method wrappers, etc.)
)
+var funcIDs = map[string]FuncID{
+ "asmcgocall": FuncID_asmcgocall,
+ "asyncPreempt": FuncID_asyncPreempt,
+ "cgocallback": FuncID_cgocallback,
+ "debugCallV1": FuncID_debugCallV1,
+ "externalthreadhandler": FuncID_externalthreadhandler,
+ "gcBgMarkWorker": FuncID_gcBgMarkWorker,
+ "go": FuncID_rt0_go,
+ "goexit": FuncID_goexit,
+ "gogo": FuncID_gogo,
+ "gopanic": FuncID_gopanic,
+ "handleAsyncEvent": FuncID_handleAsyncEvent,
+ "jmpdefer": FuncID_jmpdefer,
+ "main": FuncID_runtime_main,
+ "mcall": FuncID_mcall,
+ "morestack": FuncID_morestack,
+ "mstart": FuncID_mstart,
+ "panicwrap": FuncID_panicwrap,
+ "runfinq": FuncID_runfinq,
+ "sigpanic": FuncID_sigpanic,
+ "switch": FuncID_systemstack_switch,
+ "systemstack": FuncID_systemstack,
+
+ // Don't show in call stack but otherwise not special.
+ "deferreturn": FuncID_wrapper,
+ "runOpenDeferFrame": FuncID_wrapper,
+ "reflectcallSave": FuncID_wrapper,
+}
+
// Get the function ID for the named function in the named file.
// The function should be package-qualified.
func GetFuncID(name string, isWrapper bool) FuncID {
if isWrapper {
return FuncID_wrapper
}
- switch name {
- case "runtime.main":
- return FuncID_runtime_main
- case "runtime.goexit":
- return FuncID_goexit
- case "runtime.jmpdefer":
- return FuncID_jmpdefer
- case "runtime.mcall":
- return FuncID_mcall
- case "runtime.morestack":
- return FuncID_morestack
- case "runtime.mstart":
- return FuncID_mstart
- case "runtime.rt0_go":
- return FuncID_rt0_go
- case "runtime.asmcgocall":
- return FuncID_asmcgocall
- case "runtime.sigpanic":
- return FuncID_sigpanic
- case "runtime.runfinq":
- return FuncID_runfinq
- case "runtime.gcBgMarkWorker":
- return FuncID_gcBgMarkWorker
- case "runtime.systemstack_switch":
- return FuncID_systemstack_switch
- case "runtime.systemstack":
- return FuncID_systemstack
- case "runtime.cgocallback":
- return FuncID_cgocallback
- case "runtime.gogo":
- return FuncID_gogo
- case "runtime.externalthreadhandler":
- return FuncID_externalthreadhandler
- case "runtime.debugCallV1":
- return FuncID_debugCallV1
- case "runtime.gopanic":
- return FuncID_gopanic
- case "runtime.panicwrap":
- return FuncID_panicwrap
- case "runtime.handleAsyncEvent":
- return FuncID_handleAsyncEvent
- case "runtime.asyncPreempt":
- return FuncID_asyncPreempt
- case "runtime.deferreturn":
- // Don't show in the call stack (used when invoking defer functions)
- return FuncID_wrapper
- case "runtime.runOpenDeferFrame":
- // Don't show in the call stack (used when invoking defer functions)
- return FuncID_wrapper
- case "runtime.reflectcallSave":
- // Don't show in the call stack (used when invoking defer functions)
- return FuncID_wrapper
+ if strings.HasPrefix(name, "runtime.") {
+ if id, ok := funcIDs[name[len("runtime."):]]; ok {
+ return id
+ }
}
return FuncID_normal
}
diff --git a/src/runtime/symtab.go b/src/runtime/symtab.go
index 7667f23f1d..fc93c00c2d 100644
--- a/src/runtime/symtab.go
+++ b/src/runtime/symtab.go
@@ -308,27 +308,27 @@ type funcID uint8
const (
funcID_normal funcID = iota // not a special function
- funcID_runtime_main
+ funcID_asmcgocall
+ funcID_asyncPreempt
+ funcID_cgocallback
+ funcID_debugCallV1
+ funcID_externalthreadhandler
+ funcID_gcBgMarkWorker
funcID_goexit
+ funcID_gogo
+ funcID_gopanic
+ funcID_handleAsyncEvent
funcID_jmpdefer
funcID_mcall
funcID_morestack
funcID_mstart
+ funcID_panicwrap
funcID_rt0_go
- funcID_asmcgocall
- funcID_sigpanic
funcID_runfinq
- funcID_gcBgMarkWorker
- funcID_systemstack_switch
+ funcID_runtime_main
+ funcID_sigpanic
funcID_systemstack
- funcID_cgocallback
- funcID_gogo
- funcID_externalthreadhandler
- funcID_debugCallV1
- funcID_gopanic
- funcID_panicwrap
- funcID_handleAsyncEvent
- funcID_asyncPreempt
+ funcID_systemstack_switch
funcID_wrapper // any autogenerated code (hash/eq algorithms, method wrappers, etc.)
)