]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: print faulting instruction on a SIGFPE
authorKeith Randall <khr@golang.org>
Thu, 25 Jun 2020 16:10:23 +0000 (09:10 -0700)
committerKeith Randall <khr@golang.org>
Mon, 17 Aug 2020 21:57:05 +0000 (21:57 +0000)
Just like SIGILL, it might be useful to see what the instruction
that generated the SIGFPE is.

Update #39816

Change-Id: I8b2ff692998f0b770289339537dceab96b09d1ee
Reviewed-on: https://go-review.googlesource.com/c/go/+/239999
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/runtime/signal_unix.go

index dd6d79f8ecf5dd2e83b2f8c4eb3d48862ed01c22..6a11c91fb93dd18133195208bfca5f5482d39892 100644 (file)
@@ -616,7 +616,7 @@ func sighandler(sig uint32, info *siginfo, ctxt unsafe.Pointer, gp *g) {
                print("signal arrived during cgo execution\n")
                gp = _g_.m.lockedg.ptr()
        }
-       if sig == _SIGILL {
+       if sig == _SIGILL || sig == _SIGFPE {
                // It would be nice to know how long the instruction is.
                // Unfortunately, that's complicated to do in general (mostly for x86
                // and s930x, but other archs have non-standard instruction lengths also).