aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/debuglog_off.go
diff options
context:
space:
mode:
authorAustin Clements <austin@google.com>2018-12-30 19:47:27 -0500
committerAustin Clements <austin@google.com>2019-04-04 20:50:48 +0000
commit3ebb1ad9cddf4711d4b0f44c24da1ceac3d9e069 (patch)
treef8872e0a842333f72514371ed0e253b56861640b /src/runtime/debuglog_off.go
parentf6b42a53e5ac1f1c3f3b1c9ed2407e68e0b637a0 (diff)
downloadgo-3ebb1ad9cddf4711d4b0f44c24da1ceac3d9e069.tar.gz
go-3ebb1ad9cddf4711d4b0f44c24da1ceac3d9e069.zip
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>
Diffstat (limited to 'src/runtime/debuglog_off.go')
-rw-r--r--src/runtime/debuglog_off.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/runtime/debuglog_off.go b/src/runtime/debuglog_off.go
new file mode 100644
index 0000000000..bb3e172498
--- /dev/null
+++ b/src/runtime/debuglog_off.go
@@ -0,0 +1,19 @@
+// Copyright 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build !debuglog
+
+package runtime
+
+const dlogEnabled = false
+
+type dlogPerM struct{}
+
+func getCachedDlogger() *dlogger {
+ return nil
+}
+
+func putCachedDlogger(l *dlogger) bool {
+ return false
+}