2020-11-16 01:17:25 -05:00
|
|
|
// Copyright 2009 The Go Authors. All rights reserved.
|
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
2020-11-16 01:44:47 -05:00
|
|
|
// Debug arguments, set by -d flag.
|
|
|
|
|
|
2020-11-19 20:49:23 -05:00
|
|
|
package base
|
2020-11-16 01:17:25 -05:00
|
|
|
|
2020-11-16 01:44:47 -05:00
|
|
|
// Debug holds the parsed debugging configuration values.
|
2021-03-16 17:06:25 -04:00
|
|
|
var Debug DebugFlags
|
2020-11-16 01:44:47 -05:00
|
|
|
|
|
|
|
|
// DebugFlags defines the debugging configuration values (see var Debug).
|
|
|
|
|
// Each struct field is a different value, named for the lower-case of the field name.
|
|
|
|
|
// Each field must be an int or string and must have a `help` struct tag.
|
|
|
|
|
//
|
|
|
|
|
// The -d option takes a comma-separated list of settings.
|
|
|
|
|
// Each setting is name=value; for ints, name is short for name=1.
|
|
|
|
|
type DebugFlags struct {
|
2022-11-10 11:33:00 -05:00
|
|
|
Append int `help:"print information about append compilation"`
|
|
|
|
|
Checkptr int `help:"instrument unsafe pointer conversions\n0: instrumentation disabled\n1: conversions involving unsafe.Pointer are instrumented\n2: conversions to unsafe.Pointer force heap allocation" concurrent:"ok"`
|
|
|
|
|
Closure int `help:"print information about closure compilation"`
|
|
|
|
|
Defer int `help:"print information about defer compilation"`
|
|
|
|
|
DisableNil int `help:"disable nil checks" concurrent:"ok"`
|
|
|
|
|
DumpPtrs int `help:"show Node pointers values in dump output"`
|
|
|
|
|
DwarfInl int `help:"print information about DWARF inlined function creation"`
|
|
|
|
|
Export int `help:"print export data"`
|
|
|
|
|
Fmahash string `help:"hash value for use in debugging platform-dependent multiply-add use" concurrent:"ok"`
|
|
|
|
|
GCAdjust int `help:"log adjustments to GOGC" concurrent:"ok"`
|
2022-11-02 17:23:47 -04:00
|
|
|
GCCheck int `help:"check heap/gc use by compiler" concurrent:"ok"`
|
2022-11-10 11:33:00 -05:00
|
|
|
GCProg int `help:"print dump of GC programs"`
|
|
|
|
|
Gossahash string `help:"hash value for use in debugging the compiler"`
|
|
|
|
|
InlFuncsWithClosures int `help:"allow functions with closures to be inlined" concurrent:"ok"`
|
2022-11-22 13:28:51 -05:00
|
|
|
InlStaticInit int `help:"allow static initialization of inlined calls" concurrent:"ok"`
|
2022-10-26 17:01:24 -07:00
|
|
|
InterfaceCycles int `help:"allow anonymous interface cycles"`
|
2022-11-10 11:33:00 -05:00
|
|
|
Libfuzzer int `help:"enable coverage instrumentation for libfuzzer"`
|
cmd/compile: experimental loop iterator capture semantics change
Adds:
GOEXPERIMENT=loopvar (expected way of invoking)
-d=loopvar={-1,0,1,2,11,12} (for per-package control and/or logging)
-d=loopvarhash=... (for hash debugging)
loopvar=11,12 are for testing, benchmarking, and debugging.
If enabled,for loops of the form `for x,y := range thing`, if x and/or
y are addressed or captured by a closure, are transformed by renaming
x/y to a temporary and prepending an assignment to the body of the
loop x := tmp_x. This changes the loop semantics by making each
iteration's instance of x be distinct from the others (currently they
are all aliased, and when this matters, it is almost always a bug).
3-range with captured iteration variables are also transformed,
though it is a more complex transformation.
"Optimized" to do a simpler transformation for
3-clause for where the increment is empty.
(Prior optimization of address-taking under Return disabled, because
it was incorrect; returns can have loops for children. Restored in
a later CL.)
Includes support for -d=loopvarhash=<binary string> intended for use
with hash search and GOCOMPILEDEBUG=loopvarhash=<binary string>
(use `gossahash -e loopvarhash command-that-fails`).
Minor feature upgrades to hash-triggered features; clients can specify
that file-position hashes use only the most-inline position, and/or that
they use only the basenames of source files (not the full directory path).
Most-inlined is the right choice for debugging loop-iteration change
once the semantics are linked to the package across inlining; basename-only
makes it tractable to write tests (which, otherwise, depend on the full
pathname of the source file and thus vary).
Updates #57969.
Change-Id: I180a51a3f8d4173f6210c861f10de23de8a1b1db
Reviewed-on: https://go-review.googlesource.com/c/go/+/411904
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-06-12 15:33:57 -04:00
|
|
|
LoopVar int `help:"shared (0, default), 1 (private loop variables), 2, private + log"`
|
|
|
|
|
LoopVarHash string `help:"for debugging changes in loop behavior. Overrides experiment and loopvar flag."`
|
2022-11-10 11:33:00 -05:00
|
|
|
LocationLists int `help:"print information about DWARF location list creation"`
|
|
|
|
|
Nil int `help:"print information about nil checks"`
|
|
|
|
|
NoOpenDefer int `help:"disable open-coded defers" concurrent:"ok"`
|
|
|
|
|
NoRefName int `help:"do not include referenced symbol names in object file" concurrent:"ok"`
|
|
|
|
|
PCTab string `help:"print named pc-value table\nOne of: pctospadj, pctofile, pctoline, pctoinline, pctopcdata"`
|
|
|
|
|
Panic int `help:"show all compiler panics"`
|
|
|
|
|
Reshape int `help:"print information about expression reshaping"`
|
|
|
|
|
Shapify int `help:"print information about shaping recursive types"`
|
|
|
|
|
Slice int `help:"print information about slice compilation"`
|
|
|
|
|
SoftFloat int `help:"force compiler to emit soft-float code" concurrent:"ok"`
|
|
|
|
|
SyncFrames int `help:"how many writer stack frames to include at sync points in unified export data"`
|
|
|
|
|
TypeAssert int `help:"print information about type assertion inlining"`
|
|
|
|
|
WB int `help:"print information about write barriers"`
|
|
|
|
|
ABIWrap int `help:"print information about ABI wrapper generation"`
|
|
|
|
|
MayMoreStack string `help:"call named function before all stack growth checks" concurrent:"ok"`
|
2023-05-12 15:36:37 -04:00
|
|
|
PGODebug int `help:"debug profile-guided optimizations"`
|
|
|
|
|
PGOInline int `help:"enable profile-guided inlining" concurrent:"ok"`
|
2023-03-09 13:20:01 -05:00
|
|
|
PGOInlineCDFThreshold string `help:"cumulative threshold percentage for determining call sites as hot candidates for inlining" concurrent:"ok"`
|
2022-11-10 11:33:00 -05:00
|
|
|
PGOInlineBudget int `help:"inline budget for hot functions" concurrent:"ok"`
|
2023-05-12 16:39:43 -04:00
|
|
|
PGODevirtualize int `help:"enable profile-guided devirtualization" concurrent:"ok"`
|
2023-03-09 13:20:01 -05:00
|
|
|
WrapGlobalMapDbg int `help:"debug trace output for global map init wrapping"`
|
|
|
|
|
WrapGlobalMapCtl int `help:"global map init wrap control (0 => default, 1 => off, 2 => stress mode, no size cutoff)"`
|
2020-11-16 01:44:47 -05:00
|
|
|
|
2022-10-25 23:01:44 -04:00
|
|
|
ConcurrentOk bool // true if only concurrentOk flags seen
|
2020-11-16 01:17:25 -05:00
|
|
|
}
|
|
|
|
|
|
2020-11-16 01:44:47 -05:00
|
|
|
// DebugSSA is called to set a -d ssa/... option.
|
|
|
|
|
// If nil, those options are reported as invalid options.
|
|
|
|
|
// If DebugSSA returns a non-empty string, that text is reported as a compiler error.
|
|
|
|
|
var DebugSSA func(phase, flag string, val int, valString string) string
|