• Rhys Hiltner's avatar
    runtime: include pre-panic/throw logs in core dumps · e0aedfb4
    Rhys Hiltner authored
    When a Go program crashes with GOTRACEBACK=crash, the OS creates a
    core dump. Include the text-formatted output of some of the cause of
    that crash in the core dump.
    
    Output printed by the runtime before crashing is maintained in a
    circular buffer to allow access to messages that may be printed
    immediately before calling runtime.throw.
    
    The stack traces printed by the runtime as it crashes are not stored.
    The information required to recreate them should be included in the
    core file.
    
    Updates #16893
    
    There are no tests covering the generation of core dumps; this change
    has not added any.
    
    This adds (reentrant) locking to runtime.gwrite, which may have an
    undesired performance impact.
    
    Change-Id: Ia2463be3c12429354d290bdec5f3c8d565d1a2c3
    Reviewed-on: https://go-review.googlesource.com/32013
    Run-TryBot: Russ Cox <rsc@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarRuss Cox <rsc@golang.org>
    e0aedfb4
print.go 4.52 KB