mirror of
https://github.com/nim-lang/Nim.git
synced 2026-07-21 08:21:32 +00:00
writeStackTrace now officially has no IO effect anymore for more convenient debugging
This commit is contained in:
@@ -3211,9 +3211,10 @@ when not defined(JS): #and not defined(nimscript):
|
||||
## allows you to override the behaviour of your application when CTRL+C
|
||||
## is pressed. Only one such hook is supported.
|
||||
|
||||
proc writeStackTrace*() {.tags: [WriteIOEffect], gcsafe.}
|
||||
proc writeStackTrace*() {.tags: [], gcsafe.}
|
||||
## writes the current stack trace to ``stderr``. This is only works
|
||||
## for debug builds.
|
||||
## for debug builds. Since it's usually used for debugging, this
|
||||
## is proclaimed to have no IO effect!
|
||||
when hostOS != "standalone":
|
||||
proc getStackTrace*(): string {.gcsafe.}
|
||||
## gets the current stack trace. This only works for debug builds.
|
||||
|
||||
@@ -386,9 +386,9 @@ proc writeStackTrace() =
|
||||
when hasSomeStackTrace:
|
||||
var s = ""
|
||||
rawWriteStackTrace(s)
|
||||
showErrorMessage(s)
|
||||
cast[proc (s: string) {.noSideEffect, tags: [], nimcall.}](showErrorMessage)(s)
|
||||
else:
|
||||
showErrorMessage("No stack traceback available\n")
|
||||
cast[proc (s: string) {.noSideEffect, tags: [], nimcall.}](showErrorMessage)("No stack traceback available\n")
|
||||
|
||||
proc getStackTrace(): string =
|
||||
when hasSomeStackTrace:
|
||||
|
||||
Reference in New Issue
Block a user