]> Cypherpunks.ru repositories - gostls13.git/commit
test: trigger SIGSEGV instead of SIGTRAP in issue11656.go
authorCherry Zhang <cherryyz@google.com>
Mon, 21 Dec 2020 23:41:16 +0000 (18:41 -0500)
committerCherry Zhang <cherryyz@google.com>
Tue, 22 Dec 2020 18:36:29 +0000 (18:36 +0000)
commitc06a354bccf60ea32ed74238be409a00aac292c5
tree61859662c8d63bd31d18e8a152f63fffa9dfa1e5
parent0aa9b4709acd609c1a3e9cb028e7f4c4da3f0357
test: trigger SIGSEGV instead of SIGTRAP in issue11656.go

In issue11656.go, it tests that if the runtime can get a
reasonable traceback when it faults at a non-function PC. It does
it by jumping to an address that contains an illegal or trap
instruction. When it traps, the SIGTRAP crashes the runtime.

This CL changes it to use an instruction that triggers SIGSEGV.
This is due to two reasons:
- currently, the handling of bad PC is done by preparePanic,
  which is only used for a panicking signal (SIGSEGV, SIGBUS,
  SIGFPE), not a fatal signal (e.g. SIGTRAP).
- the test uses defer+recover to get a traceback, which only
  works for panicking signals, not fatal signals.

Ideally, we should handle all kinds of faults (SIGSEGV, SIGBUS,
SIGILL, SIGTRAP, etc.) with a nice traceback. I'll leave this
for the future.

This CL also adds RISCV64 support.

Fixes #43283.

Change-Id: I5e0fbf8530cc89d16e05c3257d282bc1d4d03405
Reviewed-on: https://go-review.googlesource.com/c/go/+/279423
Trust: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
test/fixedbugs/issue11656.go