From 66cc2b7ca760d62294584d6680df65892cf7a8cf Mon Sep 17 00:00:00 2001 From: Felix Geisendörfer Date: Sat, 27 Apr 2024 13:41:05 +0200 Subject: runtime: make profstackdepth a GODEBUG option Allow users to decrease the profiling stack depth back to 32 in case they experience any problems with the new default of 128. Users may also use this option to increase the depth up to 1024. Change-Id: Ieaab2513024915a223239278dd97a6e161dde1cf Reviewed-on: https://go-review.googlesource.com/c/go/+/581917 Reviewed-by: Austin Clements LUCI-TryBot-Result: Go LUCI Reviewed-by: Michael Knyszek --- src/runtime/runtime1.go | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/runtime/runtime1.go') diff --git a/src/runtime/runtime1.go b/src/runtime/runtime1.go index c54ba19d07..3bbea46aff 100644 --- a/src/runtime/runtime1.go +++ b/src/runtime/runtime1.go @@ -330,6 +330,7 @@ var debug struct { tracefpunwindoff int32 traceadvanceperiod int32 traceCheckStackOwnership int32 + profstackdepth int32 // debug.malloc is used as a combined debug check // in the malloc function and should be set @@ -379,6 +380,7 @@ var dbgvars = []*dbgVar{ {name: "invalidptr", value: &debug.invalidptr}, {name: "madvdontneed", value: &debug.madvdontneed}, {name: "panicnil", atomic: &debug.panicnil}, + {name: "profstackdepth", value: &debug.profstackdepth, def: 128}, {name: "runtimecontentionstacks", atomic: &debug.runtimeContentionStacks}, {name: "sbrk", value: &debug.sbrk}, {name: "scavtrace", value: &debug.scavtrace}, @@ -434,6 +436,7 @@ func parsedebugvars() { parsegodebug(godebug, nil) debug.malloc = (debug.inittrace | debug.sbrk) != 0 + debug.profstackdepth = min(debug.profstackdepth, maxProfStackDepth) setTraceback(gogetenv("GOTRACEBACK")) traceback_env = traceback_cache -- cgit v1.3-5-g9baa