runtime: improve handling of panic during deferred function
authorIan Lance Taylor <ian@gcc.gnu.org>
Fri, 23 Jun 2017 13:45:36 +0000 (13:45 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Fri, 23 Jun 2017 13:45:36 +0000 (13:45 +0000)
commit54357b3b84538e0f26b6501fd91bb98170995ff5
treeeea40c0f194dee2f158ed71d9fca0420fd4b4204
parentfb68f296283941d15505fcf610099281562fa9e0
runtime: improve handling of panic during deferred function

    When a panic occurs while processing a deferred function that
    recovered an earlier panic, we shouldn't report the recovered panic
    in the panic stack trace. Stop doing so by keeping track of the panic
    that triggered a defer, marking it as aborted if we see the defer again,
    and discarding aborted panics when a panic is recovered. This is what
    the gc runtime does.

    The test for this is TestRecursivePanic in runtime/crash_test.go.
    We don't run that test yet, but we will soon.

    Reviewed-on: https://go-review.googlesource.com/46461

From-SVN: r249590
gcc/go/gofrontend/MERGE
libgo/go/runtime/panic.go
libgo/go/runtime/runtime2.go