chore: print getBacktrace() after sigsegv (#1440)

This commit is contained in:
Alvaro Revuelta 2022-11-30 19:41:19 +01:00 committed by GitHub
parent fd79cbe678
commit 670035f32b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 3 deletions

View File

@ -9,6 +9,7 @@ import
chronicles,
chronos,
metrics,
libbacktrace,
system/ansi_c,
eth/keys,
eth/p2p/discoveryv5/enr,
@ -709,12 +710,13 @@ when isMainModule:
# Handle SIGSEGV
when defined(posix):
proc handleSigsegv(signal: cint) {.noconv.} =
fatal "Shutting down after receiving SIGSEGV"
waitFor node.stop()
# Require --debugger:native
fatal "Shutting down after receiving SIGSEGV", stacktrace=getBacktrace()
# Only available with --stacktrace:on --linetrace:on
# Not available in -d:release mode
writeStackTrace()
waitFor node.stop()
quit(QuitFailure)
c_signal(ansi_c.SIGSEGV, handleSigsegv)