diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2020-09-22 13:03:24 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-22 13:03:24 +0200 |
commit | 1fae66e4df8cc43b4ec8ab97fff96282ef234f2e (patch) | |
tree | 71fb01887cfba648f48e001626d1db7d9de36a1f /lib/system/exceptions.nim | |
parent | d67c5cb75171fcbf1ca9078452e8fcbe36fc79bc (diff) | |
download | Nim-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/exceptions.nim')
-rw-r--r-- | lib/system/exceptions.nim | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/system/exceptions.nim b/lib/system/exceptions.nim index 3006cff19..fc8bd89f7 100644 --- a/lib/system/exceptions.nim +++ b/lib/system/exceptions.nim @@ -25,6 +25,11 @@ type ## rendered at a later time, we should ensure the stacktrace ## data isn't invalidated; any pointer into PFrame is ## subject to being invalidated so shouldn't be stored. + when defined(nimStackTraceOverride): + programCounter*: uint ## Program counter - will be used to get the rest of the info, + ## when `$` is called on this type. We can't use + ## "cuintptr_t" in here. + procnameStr*, filenameStr*: string ## GC-ed objects holding the cstrings in "procname" and "filename" Exception* {.compilerproc, magic: "Exception".} = object of RootObj ## \ ## Base exception class. |