]> Cypherpunks repositories - gostls13.git/commit
runtime: ring buffer for binary debug logging
authorAustin Clements <austin@google.com>
Mon, 31 Dec 2018 00:47:27 +0000 (19:47 -0500)
committerAustin Clements <austin@google.com>
Thu, 4 Apr 2019 20:50:48 +0000 (20:50 +0000)
commit3ebb1ad9cddf4711d4b0f44c24da1ceac3d9e069
treef8872e0a842333f72514371ed0e253b56861640b
parentf6b42a53e5ac1f1c3f3b1c9ed2407e68e0b637a0
runtime: ring buffer for binary debug logging

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: Michael Knyszek <mknyszek@google.com>
src/runtime/debuglog.go [new file with mode: 0644]
src/runtime/debuglog_off.go [new file with mode: 0644]
src/runtime/debuglog_on.go [new file with mode: 0644]
src/runtime/debuglog_test.go [new file with mode: 0644]
src/runtime/export_debuglog_test.go [new file with mode: 0644]
src/runtime/panic.go
src/runtime/runtime2.go
src/runtime/signal_sighandler.go