summaryrefslogtreecommitdiffstats
path: root/src/cmd/internal/objabi/funcid.go
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-16 19:25:22 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-16 19:25:22 +0000
commitf6ad4dcef54c5ce997a4bad5a6d86de229015700 (patch)
tree7cfa4e31ace5c2bd95c72b154d15af494b2bcbef /src/cmd/internal/objabi/funcid.go
parentInitial commit. (diff)
downloadgolang-1.22-f6ad4dcef54c5ce997a4bad5a6d86de229015700.tar.xz
golang-1.22-f6ad4dcef54c5ce997a4bad5a6d86de229015700.zip
Adding upstream version 1.22.1.upstream/1.22.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/cmd/internal/objabi/funcid.go')
-rw-r--r--src/cmd/internal/objabi/funcid.go51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/cmd/internal/objabi/funcid.go b/src/cmd/internal/objabi/funcid.go
new file mode 100644
index 0000000..d9b47f1
--- /dev/null
+++ b/src/cmd/internal/objabi/funcid.go
@@ -0,0 +1,51 @@
+// Copyright 2018 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package objabi
+
+import (
+ "internal/abi"
+ "strings"
+)
+
+var funcIDs = map[string]abi.FuncID{
+ "abort": abi.FuncID_abort,
+ "asmcgocall": abi.FuncID_asmcgocall,
+ "asyncPreempt": abi.FuncID_asyncPreempt,
+ "cgocallback": abi.FuncID_cgocallback,
+ "corostart": abi.FuncID_corostart,
+ "debugCallV2": abi.FuncID_debugCallV2,
+ "gcBgMarkWorker": abi.FuncID_gcBgMarkWorker,
+ "rt0_go": abi.FuncID_rt0_go,
+ "goexit": abi.FuncID_goexit,
+ "gogo": abi.FuncID_gogo,
+ "gopanic": abi.FuncID_gopanic,
+ "handleAsyncEvent": abi.FuncID_handleAsyncEvent,
+ "main": abi.FuncID_runtime_main,
+ "mcall": abi.FuncID_mcall,
+ "morestack": abi.FuncID_morestack,
+ "mstart": abi.FuncID_mstart,
+ "panicwrap": abi.FuncID_panicwrap,
+ "runfinq": abi.FuncID_runfinq,
+ "sigpanic": abi.FuncID_sigpanic,
+ "systemstack_switch": abi.FuncID_systemstack_switch,
+ "systemstack": abi.FuncID_systemstack,
+
+ // Don't show in call stack but otherwise not special.
+ "deferreturn": abi.FuncIDWrapper,
+}
+
+// Get the function ID for the named function in the named file.
+// The function should be package-qualified.
+func GetFuncID(name string, isWrapper bool) abi.FuncID {
+ if isWrapper {
+ return abi.FuncIDWrapper
+ }
+ if strings.HasPrefix(name, "runtime.") {
+ if id, ok := funcIDs[name[len("runtime."):]]; ok {
+ return id
+ }
+ }
+ return abi.FuncIDNormal
+}