summary refs log tree commit diff stats
path: root/lib/system/excpt.nim
diff options
context:
space:
mode:
Diffstat (limited to 'lib/system/excpt.nim')
-rwxr-xr-xlib/system/excpt.nim9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/system/excpt.nim b/lib/system/excpt.nim
index a523e4e04..204fba376 100755
--- a/lib/system/excpt.nim
+++ b/lib/system/excpt.nim
@@ -194,6 +194,9 @@ proc quitOrDebug() {.inline.} =
 
 proc raiseException(e: ref E_Base, ename: CString) {.compilerRtl.} =
   e.name = ename
+  when hasSomeStackTrace:
+    e.trace = ""
+    rawWriteStackTrace(e.trace)
   if localRaiseHook != nil:
     if not localRaiseHook(e): return
   if globalRaiseHook != nil:
@@ -253,6 +256,12 @@ proc getStackTrace(): string =
   else:
     result = "No stack traceback available\n"
 
+proc getStackTrace(e: ref E_Base): string =
+  if not isNil(e) and not isNil(e.trace):
+    result = e.trace
+  else:
+    result = ""
+
 when defined(endb):
   var
     dbgAborting: bool # whether the debugger wants to abort