Debian Codegraph @

libgo/go/runtime/rdebug.go

raw
1 // Copyright 2014 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 runtime
6
7 import _ "unsafe" // for go:linkname
8
9 // Define maxstacksize here for gccgo. For gc it is defined in
10 // stack.go, but gccgo doesn't use that file. Or, for that matter,
11 // maxstacksize.
12 var maxstacksize uintptr = 1 << 20 // enough until runtime.main sets it for real
13
14 //go:linkname setMaxStack runtime_1debug.setMaxStack
15 func setMaxStack(in int) (out int) {
16 out = int(maxstacksize)
17 maxstacksize = uintptr(in)
18 return out
19 }
20
21 //go:linkname setPanicOnFault runtime_1debug.setPanicOnFault
22 func setPanicOnFault(new bool) (old bool) {
23 _g_ := getg()
24 old = _g_.paniconfault
25 _g_.paniconfault = new
26 return old
27 }