Debian Codegraph @

src/cmd/cgo/internal/testcarchive/testdata/libgo9/a.go

raw
1 // Copyright 2023 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 file.
4
5 package main
6
7 import "runtime"
8
9 // extern void callGoWithVariousStack(int);
10 import "C"
11
12 func main() {}
13
14 //export GoF
15 func GoF(p int32) {
16 runtime.GC()
17 if p != 0 {
18 panic("panic")
19 }
20 }
21
22 //export callGoWithVariousStackAndGoFrame
23 func callGoWithVariousStackAndGoFrame(p int32) {
24 if p != 0 {
25 defer func() {
26 e := recover()
27 if e == nil {
28 panic("did not panic")
29 }
30 runtime.GC()
31 }()
32 }
33 C.callGoWithVariousStack(C.int(p));
34 }