github.com/bytedance/mockey@v1.2.10/internal/monkey/inst/generic_extra_race.go (about)

     1  //go:build race
     2  // +build race
     3  
     4  /*
     5   * Copyright 2022 ByteDance Inc.
     6   *
     7   * Licensed under the Apache License, Version 2.0 (the "License");
     8   * you may not use this file except in compliance with the License.
     9   * You may obtain a copy of the License at
    10   *
    11   *     http://www.apache.org/licenses/LICENSE-2.0
    12   *
    13   * Unless required by applicable law or agreed to in writing, software
    14   * distributed under the License is distributed on an "AS IS" BASIS,
    15   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    16   * See the License for the specific language governing permissions and
    17   * limitations under the License.
    18   */
    19  
    20  package inst
    21  
    22  import (
    23  	"reflect"
    24  	_ "unsafe"
    25  )
    26  
    27  //go:linkname racefuncenter runtime.racefuncenter
    28  func racefuncenter(callpc uintptr)
    29  
    30  // not implemented & never used
    31  ////go:linkname racefuncenterfp runtime.racefuncenterfp
    32  // func racefuncenterfp(fp uintptr)
    33  
    34  //go:linkname racefuncexit runtime.racefuncexit
    35  func racefuncexit()
    36  
    37  //go:linkname raceread runtime.raceread
    38  func raceread(addr uintptr)
    39  
    40  //go:linkname racewrite runtime.racewrite
    41  func racewrite(addr uintptr)
    42  
    43  //go:linkname racereadrange runtime.racereadrange
    44  func racereadrange(addr, size uintptr)
    45  
    46  //go:linkname racewriterange runtime.racewriterange
    47  func racewriterange(addr, size uintptr)
    48  
    49  //go:linkname racereadrangepc1 runtime.racereadrangepc1
    50  func racereadrangepc1(addr, size, pc uintptr)
    51  
    52  //go:linkname racewriterangepc1 runtime.racewriterangepc1
    53  func racewriterangepc1(addr, size, pc uintptr)
    54  
    55  //go:linkname racecallbackthunk runtime.racecallbackthunk
    56  func racecallbackthunk(uintptr)
    57  
    58  func init() {
    59  	proxyCallRace = map[uintptr]string{
    60  		reflect.ValueOf(racefuncenter).Pointer(): "racefuncenter",
    61  		// reflect.ValueOf(racefuncenterfp).Pointer():   "racefuncenterfp", // not implemented & never used
    62  		reflect.ValueOf(racefuncexit).Pointer():      "racefuncexit",
    63  		reflect.ValueOf(raceread).Pointer():          "raceread",
    64  		reflect.ValueOf(racewrite).Pointer():         "racewrite",
    65  		reflect.ValueOf(racereadrange).Pointer():     "racereadrange",
    66  		reflect.ValueOf(racewriterange).Pointer():    "racewriterange",
    67  		reflect.ValueOf(racereadrangepc1).Pointer():  "racereadrangepc1",
    68  		reflect.ValueOf(racewriterangepc1).Pointer(): "racewriterangepc1",
    69  		reflect.ValueOf(racecallbackthunk).Pointer(): "racecallbackthunk",
    70  	}
    71  }