github.com/Rookout/GoSDK@v0.1.48/pkg/services/assembler/internal/objabi/funcid.go (about)

     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.assembler file.
     4  
     5  package objabi
     6  
     7  import (
     8  	"github.com/Rookout/GoSDK/pkg/services/assembler/internal/abi"
     9  	"strings"
    10  )
    11  
    12  var funcIDs = map[string]abi.FuncID{
    13  	"abort":              abi.FuncID_abort,
    14  	"asmcgocall":         abi.FuncID_asmcgocall,
    15  	"asyncPreempt":       abi.FuncID_asyncPreempt,
    16  	"cgocallback":        abi.FuncID_cgocallback,
    17  	"debugCallV2":        abi.FuncID_debugCallV2,
    18  	"gcBgMarkWorker":     abi.FuncID_gcBgMarkWorker,
    19  	"rt0_go":             abi.FuncID_rt0_go,
    20  	"goexit":             abi.FuncID_goexit,
    21  	"gogo":               abi.FuncID_gogo,
    22  	"gopanic":            abi.FuncID_gopanic,
    23  	"handleAsyncEvent":   abi.FuncID_handleAsyncEvent,
    24  	"main":               abi.FuncID_runtime_main,
    25  	"mcall":              abi.FuncID_mcall,
    26  	"morestack":          abi.FuncID_morestack,
    27  	"mstart":             abi.FuncID_mstart,
    28  	"panicwrap":          abi.FuncID_panicwrap,
    29  	"runfinq":            abi.FuncID_runfinq,
    30  	"sigpanic":           abi.FuncID_sigpanic,
    31  	"systemstack_switch": abi.FuncID_systemstack_switch,
    32  	"systemstack":        abi.FuncID_systemstack,
    33  
    34  	
    35  	"deferreturn":       abi.FuncIDWrapper,
    36  	"runOpenDeferFrame": abi.FuncIDWrapper,
    37  	"deferCallSave":     abi.FuncIDWrapper,
    38  }
    39  
    40  
    41  
    42  func GetFuncID(name string, isWrapper bool) abi.FuncID {
    43  	if isWrapper {
    44  		return abi.FuncIDWrapper
    45  	}
    46  	if strings.HasPrefix(name, "runtime.") {
    47  		if id, ok := funcIDs[name[len("runtime."):]]; ok {
    48  			return id
    49  		}
    50  	}
    51  	return abi.FuncIDNormal
    52  }