diff options
| author | Russ Cox <rsc@golang.org> | 2015-12-18 11:19:38 -0500 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2015-12-18 20:51:14 +0000 |
| commit | bb0567b3042fb8003c288ee80eb4782e2e27db63 (patch) | |
| tree | 3fc835042108cebe5c34a2076fb80c56b623bb36 /src/runtime/debug | |
| parent | ea5b9d5bd32d1027338762372652dc6f9819a788 (diff) | |
| download | go-bb0567b3042fb8003c288ee80eb4782e2e27db63.tar.xz | |
runtime/debug: add SetTraceback
Programs that call panic to crash after detecting a serious problem
may wish to use SetTraceback to force printing of all goroutines first.
Change-Id: Ib23ad9336f405485aabb642ca73f454a14c8baf3
Reviewed-on: https://go-review.googlesource.com/18043
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/runtime/debug')
| -rw-r--r-- | src/runtime/debug/garbage.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/runtime/debug/garbage.go b/src/runtime/debug/garbage.go index 41202f9e3b..8d6d2782e9 100644 --- a/src/runtime/debug/garbage.go +++ b/src/runtime/debug/garbage.go @@ -157,3 +157,14 @@ func SetPanicOnFault(enabled bool) bool { // it to the given file descriptor. // The heap dump format is defined at https://golang.org/s/go13heapdump. func WriteHeapDump(fd uintptr) + +// SetTraceback sets the amount of detail printed by the runtime in +// the traceback it prints before exiting due to an unrecovered panic +// or an internal runtime error. +// The level argument takes the same values as the GOTRACEBACK +// environment variable. For example, SetTraceback("all") ensure +// that the program prints all goroutines when it crashes. +// See the package runtime documentation for details. +// If SetTraceback is called with a level lower than that of the +// environment variable, the call is ignored. +func SetTraceback(level string) |
