finish the stacktraces.nim implementation [backport:1.2] (#15393)

This commit is contained in:
Andreas Rumpf 2020-09-23 10:01:52 +02:00 • committed by GitHub
commit e2d80b15a6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 6 deletions

View file

@ -120,3 +120,4 @@ proc initDefines*(symbols: StringTableRef) =
defineSymbol("nimDoesntTrackDefects") defineSymbol("nimDoesntTrackDefects")
defineSymbol("nimHasLentIterators") defineSymbol("nimHasLentIterators")
defineSymbol("nimHasDeclaredMagic") defineSymbol("nimHasDeclaredMagic")
defineSymbol("nimHasStacktracesModule")

View file

@ -22,26 +22,26 @@ when defined(nimStackTraceOverride):
## This is the same as the type ``uintptr_t`` in C. ## This is the same as the type ``uintptr_t`` in C.
StackTraceOverrideGetTracebackProc* = proc (): string {. StackTraceOverrideGetTracebackProc* = proc (): string {.
nimcall, gcsafe, locks: 0, raises: [], tags: [].} nimcall, gcsafe, locks: 0, raises: [], tags: [], noinline.}
StackTraceOverrideGetProgramCountersProc* = proc (maxLength: cint): seq[cuintptr_t] {. StackTraceOverrideGetProgramCountersProc* = proc (maxLength: cint): seq[cuintptr_t] {.
nimcall, gcsafe, locks: 0, raises: [], tags: [].} nimcall, gcsafe, locks: 0, raises: [], tags: [], noinline.}
StackTraceOverrideGetDebuggingInfoProc* = StackTraceOverrideGetDebuggingInfoProc* =
proc (programCounters: seq[cuintptr_t], maxLength: cint): seq[StackTraceEntry] {. proc (programCounters: seq[cuintptr_t], maxLength: cint): seq[StackTraceEntry] {.
nimcall, gcsafe, locks: 0, raises: [], tags: [].} nimcall, gcsafe, locks: 0, raises: [], tags: [], noinline.}
# Default procedures (not normally used, because people opting in on this # Default procedures (not normally used, because people opting in on this
# override are supposed to register their own versions). # override are supposed to register their own versions).
var var
stackTraceOverrideGetTraceback: StackTraceOverrideGetTracebackProc = stackTraceOverrideGetTraceback: StackTraceOverrideGetTracebackProc =
proc (): string {.nimcall, gcsafe, locks: 0, raises: [], tags: [].} = proc (): string {.nimcall, gcsafe, locks: 0, raises: [], tags: [], noinline.} =
discard discard
#result = "Stack trace override procedure not registered.\n" #result = "Stack trace override procedure not registered.\n"
stackTraceOverrideGetProgramCounters: StackTraceOverrideGetProgramCountersProc = stackTraceOverrideGetProgramCounters: StackTraceOverrideGetProgramCountersProc =
proc (maxLength: cint): seq[cuintptr_t] {.nimcall, gcsafe, locks: 0, raises: [], tags: [].} = proc (maxLength: cint): seq[cuintptr_t] {.nimcall, gcsafe, locks: 0, raises: [], tags: [], noinline.} =
discard discard
stackTraceOverrideGetDebuggingInfo: StackTraceOverrideGetDebuggingInfoProc = stackTraceOverrideGetDebuggingInfo: StackTraceOverrideGetDebuggingInfoProc =
proc (programCounters: seq[cuintptr_t], maxLength: cint): seq[StackTraceEntry] {. proc (programCounters: seq[cuintptr_t], maxLength: cint): seq[StackTraceEntry] {.
nimcall, gcsafe, locks: 0, raises: [], tags: [].} = nimcall, gcsafe, locks: 0, raises: [], tags: [], noinline.} =
discard discard
# Custom procedure registration. # Custom procedure registration.