mirror of
https://github.com/restic/restic.git
synced 2025-08-23 09:47:42 +00:00
Merge pull request #4305 from MichaelEischer/stracktrace-for-windows
Print stacktrace in SIGINT handler if RESTIC_DEBUG_STACKTRACE_SIGINT set
This commit is contained in:
15
internal/debug/stacktrace.go
Normal file
15
internal/debug/stacktrace.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package debug
|
||||
|
||||
import "runtime"
|
||||
|
||||
func DumpStacktrace() string {
|
||||
buf := make([]byte, 128*1024)
|
||||
|
||||
for {
|
||||
l := runtime.Stack(buf, true)
|
||||
if l < len(buf) {
|
||||
return string(buf[:l])
|
||||
}
|
||||
buf = make([]byte, len(buf)*2)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user