diff options
author | Fabricio Voznika <fvoznika@google.com> | 2018-06-20 13:30:39 -0700 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2018-06-20 13:31:31 -0700 |
commit | 4ad7315b6759afa81f492ec119080deb9a224101 (patch) | |
tree | 0f1e4c51b199301023f0269855013e020cc54ea2 /pkg/log/log.go | |
parent | 5aa7615ec93335a922361728881ab1224a6e9266 (diff) |
Add 'runsc debug' command
It prints sandbox stacks to the log to help debug stuckness. I expect
that many more options will be added in the future.
PiperOrigin-RevId: 201405931
Change-Id: I87e560800cd5a5a7b210dc25a5661363c8c3a16e
Diffstat (limited to 'pkg/log/log.go')
-rw-r--r-- | pkg/log/log.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/pkg/log/log.go b/pkg/log/log.go index cdfc0601a..c496e86e4 100644 --- a/pkg/log/log.go +++ b/pkg/log/log.go @@ -251,8 +251,8 @@ const defaultStackSize = 1 << 16 // 64KB // maxStackSize is the maximum buffer size to allocate for stack traces. const maxStackSize = 1 << 26 // 64MB -// stacks returns goroutine stacks, like panic. -func stacks(all bool) []byte { +// Stacks returns goroutine stacks, like panic. +func Stacks(all bool) []byte { var trace []byte for s := defaultStackSize; s <= maxStackSize; s *= 4 { trace = make([]byte, s) @@ -271,7 +271,7 @@ func stacks(all bool) []byte { // // This will be print a traceback, tb, as Warningf(format+":\n%s", v..., tb). func Traceback(format string, v ...interface{}) { - v = append(v, stacks(false)) + v = append(v, Stacks(false)) Warningf(format+":\n%s", v...) } @@ -279,7 +279,7 @@ func Traceback(format string, v ...interface{}) { // // This will be print a traceback, tb, as Warningf(format+":\n%s", v..., tb). func TracebackAll(format string, v ...interface{}) { - v = append(v, stacks(true)) + v = append(v, Stacks(true)) Warningf(format+":\n%s", v...) } |