mirror of
https://github.com/go-sylixos/elvish.git
synced 2024-12-13 09:57:51 +08:00
fbf0bfc13b
4KB is likely insufficient.
17 lines
262 B
Go
17 lines
262 B
Go
package sys
|
|
|
|
import "runtime"
|
|
|
|
const dumpStackBufSizeInit = 8192
|
|
|
|
func DumpStack() string {
|
|
buf := make([]byte, dumpStackBufSizeInit)
|
|
for {
|
|
n := runtime.Stack(buf, true)
|
|
if n < cap(buf) {
|
|
return string(buf[:n])
|
|
}
|
|
buf = make([]byte, cap(buf)*2)
|
|
}
|
|
}
|