mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-01-07 00:13:06 +00:00
chore: print getBacktrace() after sigsegv (#1440)
This commit is contained in:
parent
f5f1f639da
commit
6b5fe34b15
@ -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…
x
Reference in New Issue
Block a user