diff options
| author | qmuntal <quimmuntal@gmail.com> | 2023-03-09 14:55:31 +0100 |
|---|---|---|
| committer | Quim Muntal <quimmuntal@gmail.com> | 2023-04-10 18:52:58 +0000 |
| commit | 65ea4c5021d44395db8728eea16eb8f7fc7420eb (patch) | |
| tree | af729f4aed221fc5d7515141fd1c8cab28056654 /src/runtime/runtime1.go | |
| parent | 5e93a2c2042484ee7a941e967294a5248ab6a593 (diff) | |
| download | go-65ea4c5021d44395db8728eea16eb8f7fc7420eb.tar.xz | |
runtime: support GOTRACEBACK=wer on Windows
GOTRACEBACK=wer is a new traceback level that acts as "crash" and
also enables WER. The same effect can be achieved using
debug.SetTraceback("wer").
The Go runtime currently crashes using exit(2), which bypasses WER
even if it is enabled. To best way to trigger WER is calling
RaiseFailFastException [1] instead, which internally launches the
WER machinery.
This CL also changes how GOTRACEBACK=crash crashes, so both "wer" and
"crash" crash using RaiseFailFastException, which simplifies the
implementation and resolves a longstanding TODO.
Fixes #57441
Fixes #20498
[1] https://learn.microsoft.com/en-us/windows/win32/api/errhandlingapi/nf-errhandlingapi-raisefailfastexception
Change-Id: I45669d619fbbd2f6413ce5e5f08425ed1d9aeb64
Reviewed-on: https://go-review.googlesource.com/c/go/+/474915
Reviewed-by: Davis Goodin <dagood@microsoft.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Run-TryBot: Quim Muntal <quimmuntal@gmail.com>
Diffstat (limited to 'src/runtime/runtime1.go')
| -rw-r--r-- | src/runtime/runtime1.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/runtime/runtime1.go b/src/runtime/runtime1.go index 68a090a3c7..98c5c84c01 100644 --- a/src/runtime/runtime1.go +++ b/src/runtime/runtime1.go @@ -513,6 +513,13 @@ func setTraceback(level string) { t = 2<<tracebackShift | tracebackAll case "crash": t = 2<<tracebackShift | tracebackAll | tracebackCrash + case "wer": + if GOOS == "windows" { + t = 2<<tracebackShift | tracebackAll | tracebackCrash + enableWER() + break + } + fallthrough default: t = tracebackAll if n, ok := atoi(level); ok && n == int(uint32(n)) { |
