Debian Codegraph @

instrumentation/notify.go

raw symbols SCIP
1 //go:build !no_antithesis_sdk
2
3 package instrumentationscip-go gomod github.com/antithesishq/antithesis-sdk-go . `github.com/antithesishq/antithesis-sdk-go/instrumentation`/
4
5 import (
6 "fmtscip-go gomod github.com/golang/go/src go1.24.0 fmt/"
7 "osscip-go gomod github.com/golang/go/src go1.24.0 os/"
8
9 "github.com/antithesishq/antithesis-sdk-go/assertscip-go gomod github.com/antithesishq/antithesis-sdk-go . `github.com/antithesishq/antithesis-sdk-go/assert`/"
10 "github.com/antithesishq/antithesis-sdk-go/internalscip-go gomod github.com/antithesishq/antithesis-sdk-go . `github.com/antithesishq/antithesis-sdk-go/internal`/"
11 )
12
13 var (
14 moduleInitializedscip-go gomod github.com/antithesishq/antithesis-sdk-go . `github.com/antithesishq/antithesis-sdk-go/instrumentation`/moduleInitialized. = false
15 moduleOffsetscip-go gomod github.com/antithesishq/antithesis-sdk-go . `github.com/antithesishq/antithesis-sdk-go/instrumentation`/moduleOffset. uint64
16 edgesVisitedscip-go gomod github.com/antithesishq/antithesis-sdk-go . `github.com/antithesishq/antithesis-sdk-go/instrumentation`/edgesVisited. = bitSetscip-go gomod github.com/antithesishq/antithesis-sdk-go . `github.com/antithesishq/antithesis-sdk-go/instrumentation`/bitSet#{}
17 )
18
19 const instrumentor_tagscip-go gomod github.com/antithesishq/antithesis-sdk-go . `github.com/antithesishq/antithesis-sdk-go/instrumentation`/instrumentor_tag. = "github.com/antithesishq/antithesis-sdk-go/instrumentation"
20
21 // InitializeModule should be called only once from a program.
22 func InitializeModulescip-go gomod github.com/antithesishq/antithesis-sdk-go . `github.com/antithesishq/antithesis-sdk-go/instrumentation`/InitializeModule().(symbolTable string, edgeCount int) uint64 {
23 if moduleInitializedscip-go gomod github.com/antithesishq/antithesis-sdk-go . `github.com/antithesishq/antithesis-sdk-go/instrumentation`/moduleInitialized. {
24 // We cannot support incorrect workflows.
25 panic("InitializeModule() has already been called!")
26 }
27
28 executable, _ := osscip-go gomod github.com/golang/go/src go1.24.0 os/.Executablescip-go gomod github.com/golang/go/src go1.24.0 os/Executable().()
29 details := map[string]any{
30 "executable": executable,
31 "symbolTable": symbolTable,
32 "edgeCount": edgeCount,
33 }
34 assertscip-go gomod github.com/antithesishq/antithesis-sdk-go . `github.com/antithesishq/antithesis-sdk-go/assert`/.Reachablescip-go gomod github.com/antithesishq/antithesis-sdk-go . `github.com/antithesishq/antithesis-sdk-go/assert`/Reachable().("init_coverage_module() invoked", details)
35
36 // WARN Re: integer type conversion, see https://github.com/golang/go/issues/29878
37 offset := internalscip-go gomod github.com/antithesishq/antithesis-sdk-go . `github.com/antithesishq/antithesis-sdk-go/internal`/.InitCoveragescip-go gomod github.com/antithesishq/antithesis-sdk-go . `github.com/antithesishq/antithesis-sdk-go/internal`/InitCoverage().(uint64(edgeCount), symbolTable)
38 moduleOffsetscip-go gomod github.com/antithesishq/antithesis-sdk-go . `github.com/antithesishq/antithesis-sdk-go/instrumentation`/moduleOffset. = uint64(offset)
39 moduleInitializedscip-go gomod github.com/antithesishq/antithesis-sdk-go . `github.com/antithesishq/antithesis-sdk-go/instrumentation`/moduleInitialized. = true
40 return moduleOffsetscip-go gomod github.com/antithesishq/antithesis-sdk-go . `github.com/antithesishq/antithesis-sdk-go/instrumentation`/moduleOffset.
41 }
42
43 // Notify will be called from instrumented code.
44 func Notifyscip-go gomod github.com/antithesishq/antithesis-sdk-go . `github.com/antithesishq/antithesis-sdk-go/instrumentation`/Notify().(edge int) {
45 if !moduleInitializedscip-go gomod github.com/antithesishq/antithesis-sdk-go . `github.com/antithesishq/antithesis-sdk-go/instrumentation`/moduleInitialized. {
46 // We cannot support incorrect workflows.
47 panic(fmtscip-go gomod github.com/golang/go/src go1.24.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.0 fmt/Sprintf().("%s.Notify() called before InitializeModule()", instrumentor_tagscip-go gomod github.com/antithesishq/antithesis-sdk-go . `github.com/antithesishq/antithesis-sdk-go/instrumentation`/instrumentor_tag.))
48 }
49 if edgesVisitedscip-go gomod github.com/antithesishq/antithesis-sdk-go . `github.com/antithesishq/antithesis-sdk-go/instrumentation`/edgesVisited..Getscip-go gomod github.com/antithesishq/antithesis-sdk-go . `github.com/antithesishq/antithesis-sdk-go/instrumentation`/bitSet#Get().(edge) {
50 return
51 }
52 edgePlusOffset := uint64(edge)
53 edgePlusOffset += moduleOffsetscip-go gomod github.com/antithesishq/antithesis-sdk-go . `github.com/antithesishq/antithesis-sdk-go/instrumentation`/moduleOffset.
54 mustCall := internalscip-go gomod github.com/antithesishq/antithesis-sdk-go . `github.com/antithesishq/antithesis-sdk-go/internal`/.Notifyscip-go gomod github.com/antithesishq/antithesis-sdk-go . `github.com/antithesishq/antithesis-sdk-go/internal`/Notify().(edgePlusOffset)
55 if !mustCall {
56 edgesVisitedscip-go gomod github.com/antithesishq/antithesis-sdk-go . `github.com/antithesishq/antithesis-sdk-go/instrumentation`/edgesVisited..Setscip-go gomod github.com/antithesishq/antithesis-sdk-go . `github.com/antithesishq/antithesis-sdk-go/instrumentation`/bitSet#Set().(edge)
57 }
58 }