summary refs log tree commit diff stats
path: root/lib/system/exceptions.nim
diff options
context:
space:
mode:
authorTimothee Cour <timothee.cour2@gmail.com>2020-03-30 04:45:32 -0700
committerGitHub <noreply@github.com>2020-03-30 13:45:32 +0200
commit19cab9fa51fdb9a244ca35e978e9daa8cc81a785 (patch)
tree18200faaf701d17e1980f31bfa6c3833a6dfba5e /lib/system/exceptions.nim
parent8088633250872de8777c7078e636b2379780e107 (diff)
downloadNim-19cab9fa51fdb9a244ca35e978e9daa8cc81a785.tar.gz
stacktraces can now show custom runtime msgs per frame (#13351)
* stacktraces can now show custom runtime msgs
* improve tests/stdlib/tstackframes.nim
* fix test for --gc:arc
* test --stacktraceMsgs:on and --stacktraceMsgs:off
* --stacktracemsgs:off by default
Diffstat (limited to 'lib/system/exceptions.nim')
-rw-r--r--lib/system/exceptions.nim9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/system/exceptions.nim b/lib/system/exceptions.nim
index 3979fb66e..516de8252 100644
--- a/lib/system/exceptions.nim
+++ b/lib/system/exceptions.nim
@@ -1,3 +1,7 @@
+const NimStackTraceMsgs =
+  when defined(nimHasStacktraceMsgs): compileOption("stacktraceMsgs")
+  else: false
+
 type
   RootEffect* {.compilerproc.} = object of RootObj ## \
     ## Base effect class.
@@ -16,6 +20,11 @@ type
     procname*: cstring      ## Name of the proc that is currently executing.
     line*: int              ## Line number of the proc that is currently executing.
     filename*: cstring      ## Filename of the proc that is currently executing.
+    when NimStackTraceMsgs:
+      frameMsg*: string     ## When a stacktrace is generated in a given frame and
+                            ## 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.
 
   Exception* {.compilerproc, magic: "Exception".} = object of RootObj ## \
     ## Base exception class.