1 // Copyright 2009 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.
5 // Debug arguments, set by -d flag.
9 // Debug holds the parsed debugging configuration values.
12 // DebugFlags defines the debugging configuration values (see var Debug).
13 // Each struct field is a different value, named for the lower-case of the field name.
14 // Each field must be an int or string and must have a `help` struct tag.
16 // The -d option takes a comma-separated list of settings.
17 // Each setting is name=value; for ints, name is short for name=1.
18 type DebugFlags struct {
19 Append int `help:"print information about append compilation"`
20 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"`
21 Closure int `help:"print information about closure compilation"`
22 Defer int `help:"print information about defer compilation"`
23 DisableNil int `help:"disable nil checks" concurrent:"ok"`
24 DumpInlFuncProps string `help:"dump function properties from inl heuristics to specified file"`
25 DumpPtrs int `help:"show Node pointers values in dump output"`
26 DwarfInl int `help:"print information about DWARF inlined function creation"`
27 EscapeMutationsCalls int `help:"print extra escape analysis diagnostics about mutations and calls" concurrent:"ok"`
28 Export int `help:"print export data"`
29 Fmahash string `help:"hash value for use in debugging platform-dependent multiply-add use" concurrent:"ok"`
30 GCAdjust int `help:"log adjustments to GOGC" concurrent:"ok"`
31 GCCheck int `help:"check heap/gc use by compiler" concurrent:"ok"`
32 GCProg int `help:"print dump of GC programs"`
33 Gossahash string `help:"hash value for use in debugging the compiler"`
34 InlFuncsWithClosures int `help:"allow functions with closures to be inlined" concurrent:"ok"`
35 InlStaticInit int `help:"allow static initialization of inlined calls" concurrent:"ok"`
36 InterfaceCycles int `help:"allow anonymous interface cycles"`
37 Libfuzzer int `help:"enable coverage instrumentation for libfuzzer"`
38 LoopVar int `help:"shared (0, default), 1 (private loop variables), 2, private + log"`
39 LoopVarHash string `help:"for debugging changes in loop behavior. Overrides experiment and loopvar flag."`
40 LocationLists int `help:"print information about DWARF location list creation"`
41 Nil int `help:"print information about nil checks"`
42 NoOpenDefer int `help:"disable open-coded defers" concurrent:"ok"`
43 NoRefName int `help:"do not include referenced symbol names in object file" concurrent:"ok"`
44 PCTab string `help:"print named pc-value table\nOne of: pctospadj, pctofile, pctoline, pctoinline, pctopcdata"`
45 Panic int `help:"show all compiler panics"`
46 Reshape int `help:"print information about expression reshaping"`
47 Shapify int `help:"print information about shaping recursive types"`
48 Slice int `help:"print information about slice compilation"`
49 SoftFloat int `help:"force compiler to emit soft-float code" concurrent:"ok"`
50 StaticCopy int `help:"print information about missed static copies" concurrent:"ok"`
51 SyncFrames int `help:"how many writer stack frames to include at sync points in unified export data"`
52 TypeAssert int `help:"print information about type assertion inlining"`
53 WB int `help:"print information about write barriers"`
54 ABIWrap int `help:"print information about ABI wrapper generation"`
55 MayMoreStack string `help:"call named function before all stack growth checks" concurrent:"ok"`
56 PGODebug int `help:"debug profile-guided optimizations"`
57 PGOInline int `help:"enable profile-guided inlining" concurrent:"ok"`
58 PGOInlineCDFThreshold string `help:"cumulative threshold percentage for determining call sites as hot candidates for inlining" concurrent:"ok"`
59 PGOInlineBudget int `help:"inline budget for hot functions" concurrent:"ok"`
60 PGODevirtualize int `help:"enable profile-guided devirtualization" concurrent:"ok"`
61 WrapGlobalMapDbg int `help:"debug trace output for global map init wrapping"`
62 WrapGlobalMapCtl int `help:"global map init wrap control (0 => default, 1 => off, 2 => stress mode, no size cutoff)"`
63 ZeroCopy int `help:"enable zero-copy string->[]byte conversions" concurrent:"ok"`
65 ConcurrentOk bool // true if only concurrentOk flags seen
68 // DebugSSA is called to set a -d ssa/... option.
69 // If nil, those options are reported as invalid options.
70 // If DebugSSA returns a non-empty string, that text is reported as a compiler error.
71 var DebugSSA func(phase, flag string, val int, valString string) string