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-01 12:33:58 -04: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"`
|
|
|
|
|
Closure int `help:"print information about closure compilation"`
|
|
|
|
|
DclStack int `help:"run internal dclstack check"`
|
|
|
|
|
Defer int `help:"print information about defer compilation"`
|
|
|
|
|
DisableNil int `help:"disable nil checks"`
|
|
|
|
|
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"`
|
cmd/compile: add debug-hash flag for fused-multiply-add
This adds a -d debug flag "fmahash" for hashcode search for
floating point architecture-dependent problems. This variable has no
effect on architectures w/o fused-multiply-add.
This was rebased onto the GOSSAHASH renovation so that this could have
its own dedicated environment variable, and so that it would be
cheap (a nil check) to check it in the normal case.
Includes a basic test of the trigger plumbing.
Sample use (on arm64, ppc64le, s390x):
% GOCOMPILEDEBUG=fmahash=001110110 \
go build -o foo cmd/compile/internal/ssa/testdata/fma.go
fmahash triggered main.main:24 101111101101111001110110
GOFMAHASH triggered main.main:20 010111010000101110111011
1.0000000000000002 1.0000000000000004 -2.220446049250313e-16
exit status 1
The intended use is in conjunction with github.com/dr2chase/gossahash,
which will probably acquire a flag "-fma" to streamline its use. This
tool+use was inspired by an ad hoc use of this technique "in anger"
to debug this very problem. This is also a dry-run for using this
same technique to identify code sensitive to loop variable
lifetime/capture, should we make that change.
Example intended use, with current search tool (using old environment
variable), for a test example:
gossahash -e GOFMAHASH GOMAGIC=GOFMAHASH go run fma.go
Trying go args=[...], env=[GOFMAHASH=1 GOMAGIC=GOFMAHASH]
go failed (81 distinct triggers): exit status 1
Trying go args=[...], env=[GOFMAHASH=11 GOMAGIC=GOFMAHASH]
go failed (39 distinct triggers): exit status 1
Trying go args=[...], env=[GOFMAHASH=011 GOMAGIC=GOFMAHASH]
go failed (18 distinct triggers): exit status 1
Trying go args=[...], env=[GOFMAHASH=0011 GOMAGIC=GOFMAHASH]
Trying go args=[...], env=[GOFMAHASH=1011 GOMAGIC=GOFMAHASH]
...
Trying go args=[...], env=[GOFMAHASH=0110111011 GOMAGIC=GOFMAHASH]
Trying go args=[...], env=[GOFMAHASH=1110111011 GOMAGIC=GOFMAHASH]
go failed (2 distinct triggers): exit status 1
Trigger string is 'GOFMAHASH triggered math.qzero:427 111111101010011110111011', repeated 6 times
Trigger string is 'GOFMAHASH triggered main.main:20 010111010000101110111011', repeated 1 times
Trying go args=[...], env=[GOFMAHASH=01110111011 GOMAGIC=GOFMAHASH]
go failed (1 distinct triggers): exit status 1
Trigger string is 'GOFMAHASH triggered main.main:20 010111010000101110111011', repeated 1 times
Review GSHS_LAST_FAIL.0.log for failing run
FINISHED, suggest this command line for debugging:
GOSSAFUNC='main.main:20 010111010000101110111011' \
GOFMAHASH=01110111011 GOMAGIC=GOFMAHASH go run fma.go
Change-Id: Ifa22dd8f1c37c18fc8a4f7c396345a364bc367d5
Reviewed-on: https://go-review.googlesource.com/c/go/+/394754
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2022-10-21 18:10:23 -04:00
|
|
|
Fmahash string `help:"hash value for use in debugging platform-dependent multiply-add use" concurrent:"ok"`
|
2022-11-01 12:33:58 -04: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"`
|
|
|
|
|
Libfuzzer int `help:"enable coverage instrumentation for libfuzzer"`
|
|
|
|
|
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"`
|
|
|
|
|
NoRefName int `help:"do not include referenced symbol names in object file"`
|
|
|
|
|
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"`
|
|
|
|
|
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"`
|
|
|
|
|
TypecheckInl int `help:"eager typechecking of inline function bodies"`
|
|
|
|
|
Unified int `help:"enable unified IR construction"`
|
|
|
|
|
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"`
|
|
|
|
|
InlineHotCallSiteCDFThreshold string `help:"cummulative threshold percentage for determining call sites as hot candidates for inlining"`
|
|
|
|
|
InlineHotBudget int `help:"inline budget for hot functions"`
|
|
|
|
|
PGOInline int `help:"debug profile-guided inlining"`
|
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
|