summary refs log tree commit diff stats
path: root/lib/system.nim
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2020-09-22 13:03:24 +0200
committerGitHub <noreply@github.com>2020-09-22 13:03:24 +0200
commit1fae66e4df8cc43b4ec8ab97fff96282ef234f2e (patch)
tree71fb01887cfba648f48e001626d1db7d9de36a1f /lib/system.nim
parentd67c5cb75171fcbf1ca9078452e8fcbe36fc79bc (diff)
downloadNim-1fae66e4df8cc43b4ec8ab97fff96282ef234f2e.tar.gz
better nativestacktrace support; refs #15284; backport [1.2] (#15384)
* nimStackTraceOverride: enable stack traces in exceptions

This is a two-step stack trace collection scheme, because re-raised
exceptions will collect multiple stack traces but use them rarely, when
printing info about an uncaught exception, so it makes sense to only do
the cheap stack unwinding all the time and the relatively expensive
debugging information collection on-demand.

`asyncfutures` implements its own `$` proc for printing
`seq[StackTraceEntry]`, so we have to add the debugging info there, just
like we do for the private `$` proc in `system/excpt`.

* cleaned up PR #15284

Co-authored-by: Ștefan Talpalaru <stefantalpalaru@yahoo.com>
Diffstat (limited to 'lib/system.nim')
-rw-r--r--lib/system.nim6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/system.nim b/lib/system.nim
index 362b5b2b9..eefa84565 100644
--- a/lib/system.nim
+++ b/lib/system.nim
@@ -1383,6 +1383,12 @@ type # these work for most platforms:
   culonglong* {.importc: "unsigned long long", nodecl.} = uint64
     ## This is the same as the type ``unsigned long long`` in *C*.
 
+  # There is a disparity on macOS where Nim's `uint` is `unsigned long long` and
+  # `uintptr_t` is `unsigned long`. Even though both data types are the same
+  # size (64 bits), clang++ refuses to do automatic conversion between them.
+  cuintptr_t* {.importc: "uintptr_t", nodecl.} = uint
+    ## This is the same as the type ``uintptr_t`` in *C*.
+
   cstringArray* {.importc: "char**", nodecl.} = ptr UncheckedArray[cstring]
     ## This is binary compatible to the type ``char**`` in *C*. The array's
     ## high value is large enough to disable bounds checking in practice.