1// Copyright 2019 The Go Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style 3// license that can be found in the LICENSE file. 4 5// Export debuglog guts for testing. 6 7package runtime 8 9const DlogEnabled = dlogEnabled 10 11const DebugLogBytes = debugLogBytes 12 13const DebugLogStringLimit = debugLogStringLimit 14 15var Dlog = dlog 16 17func (l *dlogger) End() { l.end() } 18func (l *dlogger) B(x bool) *dlogger { return l.b(x) } 19func (l *dlogger) I(x int) *dlogger { return l.i(x) } 20func (l *dlogger) I16(x int16) *dlogger { return l.i16(x) } 21func (l *dlogger) U64(x uint64) *dlogger { return l.u64(x) } 22func (l *dlogger) Hex(x uint64) *dlogger { return l.hex(x) } 23func (l *dlogger) P(x any) *dlogger { return l.p(x) } 24func (l *dlogger) S(x string) *dlogger { return l.s(x) } 25func (l *dlogger) PC(x uintptr) *dlogger { return l.pc(x) } 26 27func DumpDebugLog() string { 28 gp := getg() 29 gp.writebuf = make([]byte, 0, 1<<20) 30 printDebugLog() 31 buf := gp.writebuf 32 gp.writebuf = nil 33 34 return string(buf) 35} 36 37func ResetDebugLog() { 38 stw := stopTheWorld(stwForTestResetDebugLog) 39 for l := allDloggers; l != nil; l = l.allLink { 40 l.w.write = 0 41 l.w.tick, l.w.nano = 0, 0 42 l.w.r.begin, l.w.r.end = 0, 0 43 l.w.r.tick, l.w.r.nano = 0, 0 44 } 45 startTheWorld(stw) 46} 47