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 {
|
2021-02-24 13:03:17 -08:00
|
|
|
Append int `help:"print information about append compilation"`
|
2021-09-17 10:07:41 -04:00
|
|
|
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"`
|
2021-02-24 13:03:17 -08:00
|
|
|
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"`
|
|
|
|
|
GCProg int `help:"print dump of GC programs"`
|
|
|
|
|
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"`
|
2021-04-02 21:48:00 -04:00
|
|
|
NoOpenDefer int `help:"disable open-coded defers"`
|
2021-09-17 10:07:41 -04:00
|
|
|
PCTab string `help:"print named pc-value table\nOne of: pctospadj, pctofile, pctoline, pctoinline, pctopcdata"`
|
2021-02-24 13:03:17 -08:00
|
|
|
Panic int `help:"show all compiler panics"`
|
|
|
|
|
Slice int `help:"print information about slice compilation"`
|
|
|
|
|
SoftFloat int `help:"force compiler to emit soft-float code"`
|
[dev.typeparams] cmd/compile: record writer's stack at export data sync points
This CL extends the unified export data format's existing sync
mechanism to save writer stacks, controlled by the -d=syncframes debug
flag. This allows readers to provide more details when reporting
desync errors, which should simplify development of the data format
and the various reader/writer implementations.
For example, CL 328051 updated reader and writer, but missed making a
similar change to the linker (fix in CL 328054). Re-reviewing the CL
in isolation after the failure, it was not immediately obvious what
was going wrong. But the pair of stack traces below identifies exactly
what happened: it should have updated linker.relocFuncExt to write out
the new sync marker too.
```
data sync error: package "internal/abi", section 6, index 4, offset 536
found UseReloc, written at:
/home/mdempsky/wd/go/src/cmd/compile/internal/noder/encoder.go:221: (*encoder).reloc +0x44
/home/mdempsky/wd/go/src/cmd/compile/internal/noder/linker.go:214: (*linker).relocFuncExt +0x580
/home/mdempsky/wd/go/src/cmd/compile/internal/noder/linker.go:233: (*linker).relocTypeExt +0x234
/home/mdempsky/wd/go/src/cmd/compile/internal/noder/linker.go:161: (*linker).relocObj +0x2198
/home/mdempsky/wd/go/src/cmd/compile/internal/noder/linker.go:64: (*linker).relocIdx +0x196
expected ImplicitTypes, reading at:
/home/mdempsky/wd/go/src/cmd/compile/internal/noder/reader.go:796: (*reader).implicitTypes +0x36
/home/mdempsky/wd/go/src/cmd/compile/internal/noder/reader.go:810: (*reader).addBody +0x81
/home/mdempsky/wd/go/src/cmd/compile/internal/noder/reader.go:727: (*reader).funcExt +0x542
/home/mdempsky/wd/go/src/cmd/compile/internal/noder/reader.go:651: (*reader).method +0x324
/home/mdempsky/wd/go/src/cmd/compile/internal/noder/reader.go:557: (*pkgReader).objIdx +0x2704
```
Change-Id: I911193edd2a965f81b7459f15fb613a773584685
Reviewed-on: https://go-review.googlesource.com/c/go/+/328909
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
2021-06-17 01:12:23 -07:00
|
|
|
SyncFrames int `help:"how many writer stack frames to include at sync points in unified export data"`
|
2021-02-24 13:03:17 -08:00
|
|
|
TypeAssert int `help:"print information about type assertion inlining"`
|
|
|
|
|
TypecheckInl int `help:"eager typechecking of inline function bodies"`
|
2021-06-11 03:54:25 -07:00
|
|
|
Unified int `help:"enable unified IR construction"`
|
2021-02-24 13:03:17 -08:00
|
|
|
WB int `help:"print information about write barriers"`
|
|
|
|
|
ABIWrap int `help:"print information about ABI wrapper generation"`
|
2019-08-20 17:39:09 -04:00
|
|
|
MayMoreStack string `help:"call named function before all stack growth checks"`
|
2020-11-16 01:44:47 -05:00
|
|
|
|
2021-09-17 10:07:41 -04:00
|
|
|
Any bool // set when any of the debug flags have been set
|
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
|