Source file src/cmd/compile/internal/base/debug.go

     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.
     4  
     5  // Debug arguments, set by -d flag.
     6  
     7  package base
     8  
     9  // Debug holds the parsed debugging configuration values.
    10  var Debug DebugFlags
    11  
    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.
    15  // Don't forget to note that concurrency is "ok" when it is,
    16  // else the compiler will serialize for that flag.
    17  //
    18  // The -d option takes a comma-separated list of settings.
    19  // Each setting is name=value; for ints, name is short for name=1.
    20  type DebugFlags struct {
    21  	AlignHot              int    `help:"enable hot block alignment (currently requires -pgo)" concurrent:"ok"`
    22  	Append                int    `help:"print information about append compilation"`
    23  	AstDump               string `help:"for specified function/method, dump AST/IR at interesting points in compilation, to file pkg.func.ast. Use leading ~ for regular expression match."`
    24  	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"`
    25  	Closure               int    `help:"print information about closure compilation"`
    26  	CompressInstructions  int    `help:"use compressed instructions when possible (if supported by architecture)" concurrent:"ok"`
    27  	Converthash           string `help:"hash value for use in debugging changes to platform-dependent float-to-[u]int conversion" concurrent:"ok"`
    28  	Defer                 int    `help:"print information about defer compilation"`
    29  	DisableNil            int    `help:"disable nil checks" concurrent:"ok"`
    30  	DumpInlFuncProps      string `help:"dump function properties from inl heuristics to specified file"`
    31  	DumpInlCallSiteScores int    `help:"dump scored callsites during inlining"`
    32  	InlScoreAdj           string `help:"set inliner score adjustments (ex: -d=inlscoreadj=panicPathAdj:10/passConstToNestedIfAdj:-90)" concurrent:"ok"`
    33  	InlBudgetSlack        int    `help:"amount to expand the initial inline budget when new inliner enabled. Defaults to 80 if option not set." concurrent:"ok"`
    34  	DumpPtrs              int    `help:"show Node pointers values in dump output"`
    35  	DwarfInl              int    `help:"print information about DWARF inlined function creation"`
    36  	EscapeMutationsCalls  int    `help:"print extra escape analysis diagnostics about mutations and calls" concurrent:"ok"`
    37  	EscapeDebug           int    `help:"print information about escape analysis and resulting optimizations" concurrent:"ok"`
    38  	EscapeAlias           int    `help:"print information about alias analysis" concurrent:"ok"`
    39  	EscapeAliasCheck      int    `help:"enable additional validation for alias analysis" concurrent:"ok"`
    40  	Export                int    `help:"print export data"`
    41  	FIPSHash              string `help:"hash value for FIPS debugging" concurrent:"ok"`
    42  	Fmahash               string `help:"hash value for use in debugging platform-dependent multiply-add use" concurrent:"ok"`
    43  	FreeAppend            int    `help:"insert frees of append results when proven safe (0 disabled, 1 enabled, 2 enabled + log)" concurrent:"ok"`
    44  	GCAdjust              int    `help:"log adjustments to GOGC" concurrent:"ok"`
    45  	GCCheck               int    `help:"check heap/gc use by compiler" concurrent:"ok"`
    46  	GCProg                int    `help:"print dump of GC programs"`
    47  	GCStart               int    `help:"specify \"starting\" compiler's heap size in MiB" concurrent:"ok"`
    48  	Gossahash             string `help:"hash value for use in debugging the compiler"`
    49  	InlFuncsWithClosures  int    `help:"allow functions with closures to be inlined" concurrent:"ok"`
    50  	InlStaticInit         int    `help:"allow static initialization of inlined calls" concurrent:"ok"`
    51  	InterfaceCycles       int    `help:"allow anonymous interface cycles" concurrent:"ok"`
    52  	Libfuzzer             int    `help:"enable coverage instrumentation for libfuzzer"`
    53  	LiteralAllocHash      string `help:"hash value for use in debugging literal allocation optimizations" concurrent:"ok"`
    54  	LoopVar               int    `help:"shared (0), 1 (private loop variables, default), 2, private + log" concurrent:"ok"`
    55  	LoopVarHash           string `help:"for debugging changes in loop behavior. Overrides experiment and loopvar flag." concurrent:"ok"`
    56  	LocationLists         int    `help:"print information about DWARF location list creation"`
    57  	MaxShapeLen           int    `help:"hash shape names longer than this threshold (default 500)" concurrent:"ok"`
    58  	MergeLocals           int    `help:"merge together non-interfering local stack slots" concurrent:"ok"`
    59  	MergeLocalsDumpFunc   string `help:"dump specified func in merge locals"`
    60  	MergeLocalsHash       string `help:"hash value for debugging stack slot merging of local variables" concurrent:"ok"`
    61  	MergeLocalsTrace      int    `help:"trace debug output for locals merging"`
    62  	MergeLocalsHTrace     int    `help:"hash-selected trace debug output for locals merging"`
    63  	Nil                   int    `help:"print information about nil checks"`
    64  	NoDeadLocals          int    `help:"disable deadlocals pass" concurrent:"ok"`
    65  	NoOpenDefer           int    `help:"disable open-coded defers" concurrent:"ok"`
    66  	NoRefName             int    `help:"do not include referenced symbol names in object file" concurrent:"ok"`
    67  	PCTab                 string `help:"print named pc-value table\nOne of: pctospadj, pctofile, pctoline, pctoinline, pctopcdata"`
    68  	Panic                 int    `help:"show all compiler panics"`
    69  	Reshape               int    `help:"print information about expression reshaping"`
    70  	Shapify               int    `help:"print information about shaping recursive types"`
    71  	Slice                 int    `help:"print information about slice compilation"`
    72  	SoftFloat             int    `help:"force compiler to emit soft-float code" concurrent:"ok"`
    73  	StaticCopy            int    `help:"print information about missed static copies" concurrent:"ok"`
    74  	SyncFrames            int    `help:"how many writer stack frames to include at sync points in unified export data" concurrent:"ok"`
    75  	TailCall              int    `help:"print information about tail calls"`
    76  	TypeAssert            int    `help:"print information about type assertion inlining"`
    77  	WB                    int    `help:"print information about write barriers"`
    78  	ABIWrap               int    `help:"print information about ABI wrapper generation"`
    79  	MayMoreStack          string `help:"call named function before all stack growth checks" concurrent:"ok"`
    80  	PGODebug              int    `help:"debug profile-guided optimizations"`
    81  	PGOHash               string `help:"hash value for debugging profile-guided optimizations" concurrent:"ok"`
    82  	PGOInline             int    `help:"enable profile-guided inlining" concurrent:"ok"`
    83  	PGOInlineCDFThreshold string `help:"cumulative threshold percentage for determining call sites as hot candidates for inlining" concurrent:"ok"`
    84  	PGOInlineBudget       int    `help:"inline budget for hot functions" concurrent:"ok"`
    85  	PGODevirtualize       int    `help:"enable profile-guided devirtualization; 0 to disable, 1 to enable interface devirtualization, 2 to enable function devirtualization" concurrent:"ok"`
    86  	RangeFuncCheck        int    `help:"insert code to check behavior of range iterator functions" concurrent:"ok"`
    87  	VariableMakeHash      string `help:"hash value for debugging stack allocation of variable-sized make results" concurrent:"ok"`
    88  	VariableMakeThreshold int    `help:"threshold in bytes for possible stack allocation of variable-sized make results" concurrent:"ok"`
    89  	WrapGlobalMapDbg      int    `help:"debug trace output for global map init wrapping"`
    90  	WrapGlobalMapCtl      int    `help:"global map init wrap control (0 => default, 1 => off, 2 => stress mode, no size cutoff)" concurrent:"ok"`
    91  	ZeroCopy              int    `help:"enable zero-copy string->[]byte conversions" concurrent:"ok"`
    92  
    93  	ConcurrentOk bool // true if only concurrentOk flags seen
    94  }
    95  
    96  // DebugSSA is called to set a -d ssa/... option.
    97  // If nil, those options are reported as invalid options.
    98  // If DebugSSA returns a non-empty string, that text is reported as a compiler error.
    99  var DebugSSA func(phase, flag string, val int, valString string) string
   100  

View as plain text