diff options
Diffstat (limited to 'lib/pure/segfaults.nim')
-rw-r--r-- | lib/pure/segfaults.nim | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/pure/segfaults.nim b/lib/pure/segfaults.nim index 2378fce17..65b059e86 100644 --- a/lib/pure/segfaults.nim +++ b/lib/pure/segfaults.nim @@ -8,27 +8,29 @@ # ## This modules registers a signal handler that turns access violations / -## segfaults into a ``NilAccessError`` exception. To be able to catch -## a NilAccessError all you have to do is to import this module. +## segfaults into a ``NilAccessDefect`` exception. To be able to catch +## a NilAccessDefect all you have to do is to import this module. ## ## Tested on these OSes: Linux, Windows, OSX +# xxx possibly broken on arm64, see bug #17178 + {.used.} # do allocate memory upfront: -var se: ref NilAccessError +var se: ref NilAccessDefect new(se) -se.name = "NilAccessError" +se.name = "NilAccessDefect" se.msg = "Could not access value because it is nil." when defined(windows): include "../system/ansi_c" - import winlean + import std/winlean const EXCEPTION_ACCESS_VIOLATION = DWORD(0xc0000005'i32) - EXCEPTION_CONTINUE_SEARCH = Long(0) + EXCEPTION_CONTINUE_SEARCH = LONG(0) type PEXCEPTION_RECORD = ptr object @@ -63,7 +65,7 @@ when defined(windows): c_signal(SIGSEGV, segfaultHandler) else: - import posix + import std/posix var sa: Sigaction |