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:
Michael Eischer
2023-04-30 16:08:58 +02:00
committed by GitHub
3 changed files with 31 additions and 0 deletions

View 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)
}
}