diff options
author | Araq <rumpf_a@web.de> | 2012-10-19 01:59:28 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2012-10-19 01:59:28 +0200 |
commit | 3f82352c2e53247650a66bff52f552517cff8121 (patch) | |
tree | da6aa4c9bfb51b1398e6bcb73f7ba37e7975b8d2 /lib/system/excpt.nim | |
parent | b800b77a1a9c746248488bec0ca40adffe565344 (diff) | |
download | Nim-3f82352c2e53247650a66bff52f552517cff8121.tar.gz |
fixed a serious code generation bug leading to wrong RTTI
Diffstat (limited to 'lib/system/excpt.nim')
-rwxr-xr-x | lib/system/excpt.nim | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/lib/system/excpt.nim b/lib/system/excpt.nim index 204fba376..aedb0ef4b 100755 --- a/lib/system/excpt.nim +++ b/lib/system/excpt.nim @@ -192,11 +192,7 @@ proc quitOrDebug() {.inline.} = else: endbStep() # call the debugger -proc raiseException(e: ref E_Base, ename: CString) {.compilerRtl.} = - e.name = ename - when hasSomeStackTrace: - e.trace = "" - rawWriteStackTrace(e.trace) +proc raiseExceptionAux(e: ref E_Base) = if localRaiseHook != nil: if not localRaiseHook(e): return if globalRaiseHook != nil: @@ -205,7 +201,7 @@ proc raiseException(e: ref E_Base, ename: CString) {.compilerRtl.} = pushCurrentException(e) c_longjmp(excHandler.context, 1) elif e[] of EOutOfMemory: - writeToStdErr(ename) + writeToStdErr(e.name) quitOrDebug() else: when hasSomeStackTrace: @@ -214,7 +210,7 @@ proc raiseException(e: ref E_Base, ename: CString) {.compilerRtl.} = add(buf, "Error: unhandled exception: ") if not isNil(e.msg): add(buf, e.msg) add(buf, " [") - add(buf, $ename) + add(buf, $e.name) add(buf, "]\n") writeToStdErr(buf) else: @@ -230,16 +226,23 @@ proc raiseException(e: ref E_Base, ename: CString) {.compilerRtl.} = add(buf, "Error: unhandled exception: ") if not isNil(e.msg): add(buf, e.msg) add(buf, " [") - xadd(buf, ename, c_strlen(ename)) + xadd(buf, e.name, c_strlen(e.name)) add(buf, "]\n") writeToStdErr(buf) quitOrDebug() +proc raiseException(e: ref E_Base, ename: CString) {.compilerRtl.} = + e.name = ename + when hasSomeStackTrace: + e.trace = "" + rawWriteStackTrace(e.trace) + raiseExceptionAux(e) + proc reraiseException() {.compilerRtl.} = if currException == nil: raise newException(ENoExceptionToReraise, "no exception to reraise") else: - raiseException(currException, currException.name) + raiseExceptionAux(currException) proc WriteStackTrace() = when hasSomeStackTrace: |