fixed a serious code generation bug leading to wrong RTTI

This commit is contained in:
Araq 2012-10-19 01:59:28 +02:00
commit 3f82352c2e
7 changed files with 76 additions and 29 deletions

View file

@ -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: