mirror of https://github.com/waku-org/nwaku.git
chore: print getBacktrace() after sigsegv (#1440)
This commit is contained in:
parent
fd79cbe678
commit
670035f32b
|
@ -9,6 +9,7 @@ import
|
||||||
chronicles,
|
chronicles,
|
||||||
chronos,
|
chronos,
|
||||||
metrics,
|
metrics,
|
||||||
|
libbacktrace,
|
||||||
system/ansi_c,
|
system/ansi_c,
|
||||||
eth/keys,
|
eth/keys,
|
||||||
eth/p2p/discoveryv5/enr,
|
eth/p2p/discoveryv5/enr,
|
||||||
|
@ -709,12 +710,13 @@ when isMainModule:
|
||||||
# Handle SIGSEGV
|
# Handle SIGSEGV
|
||||||
when defined(posix):
|
when defined(posix):
|
||||||
proc handleSigsegv(signal: cint) {.noconv.} =
|
proc handleSigsegv(signal: cint) {.noconv.} =
|
||||||
fatal "Shutting down after receiving SIGSEGV"
|
# Require --debugger:native
|
||||||
waitFor node.stop()
|
fatal "Shutting down after receiving SIGSEGV", stacktrace=getBacktrace()
|
||||||
|
|
||||||
# Only available with --stacktrace:on --linetrace:on
|
# Not available in -d:release mode
|
||||||
writeStackTrace()
|
writeStackTrace()
|
||||||
|
|
||||||
|
waitFor node.stop()
|
||||||
quit(QuitFailure)
|
quit(QuitFailure)
|
||||||
|
|
||||||
c_signal(ansi_c.SIGSEGV, handleSigsegv)
|
c_signal(ansi_c.SIGSEGV, handleSigsegv)
|
||||||
|
|
Loading…
Reference in New Issue