• Austin Clements's avatar
    runtime: ring buffer for binary debug logging · 3ebb1ad9
    Austin Clements authored
    This adds an internal runtime debug log. It uses per-M time-stamped
    ring buffers of binary log records. On panic, these buffers are
    collected, interleaved, and printed.
    
    The entry-point to the debug log is a new "dlog" function. dlog is
    designed so it can be used even from very constrained corners of the
    runtime such as signal handlers or inside the write barrier.
    
    The facility is only enabled if the debuglog build tag is set.
    Otherwise, it compiles away to a no-op implementation.
    
    The debug log format is also designed so it would be reasonable to
    decode from a core dump, though this hasn't been implemented.
    
    Change-Id: I6e2737c286358e97a0d8091826498070b95b66a3
    Reviewed-on: https://go-review.googlesource.com/c/go/+/157997
    Run-TryBot: Austin Clements <austin@google.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarMichael Knyszek <mknyszek@google.com>
    3ebb1ad9