| 207 | } |
| 208 | |
| 209 | void fxAbort(txMachine* the, int status) |
| 210 | { |
| 211 | #if MODDEF_XS_TEST && MODDEF_SOFTRESET |
| 212 | if (XS_DEBUGGER_EXIT == status) { |
| 213 | modSoftReset(); |
| 214 | return; |
| 215 | } |
| 216 | #endif |
| 217 | |
| 218 | #ifdef mxDebug |
| 219 | if ((XS_DEAD_STRIP_EXIT == status) && the->debugEval) |
| 220 | mxUnknownError("dead strip"); |
| 221 | #endif |
| 222 | |
| 223 | #if defined(mxDebug) || defined(mxInstrument) || defined(MODDEF_XS_ABORTHOOK) |
| 224 | char *msg = (char*)fxAbortString(status); |
| 225 | |
| 226 | #ifdef MODDEF_XS_RESTARTON |
| 227 | #error RestartOn deprecated. Use abortHook instead. |
| 228 | #endif |
| 229 | |
| 230 | #if MODDEF_XS_ABORTHOOK |
| 231 | if ((XS_JAVASCRIPT_STACK_OVERFLOW_EXIT != status) && (XS_NATIVE_STACK_OVERFLOW_EXIT != status) && (XS_DEBUGGER_EXIT != status)) { |
| 232 | xsBooleanValue ignore = false; |
| 233 | |
| 234 | fxBeginHost(the); |
| 235 | { |
| 236 | mxPush(mxException); |
| 237 | txSlot *exception = the->stack; |
| 238 | mxException = xsUndefined; |
| 239 | mxTry(the) { |
| 240 | txID abortID = fxFindName(the, "abort"); |
| 241 | mxOverflow(-8); |
| 242 | mxPush(mxGlobal); |
| 243 | if (fxHasID(the, abortID)) { |
| 244 | mxPush(mxGlobal); |
| 245 | fxCallID(the, abortID); |
| 246 | mxPushStringC((char *)msg); |
| 247 | mxPushSlot(exception); |
| 248 | fxRunCount(the, 2); |
| 249 | ignore = (XS_BOOLEAN_KIND == the->stack->kind) && !the->stack->value.boolean; |
| 250 | mxPop(); |
| 251 | } |
| 252 | } |
| 253 | mxCatch(the) { |
| 254 | } |
| 255 | } |
| 256 | fxEndHost(the); |
| 257 | if (ignore) |
| 258 | return; |
| 259 | } |
| 260 | #endif |
| 261 | |
| 262 | char *reason = ""; |
| 263 | if (XS_UNHANDLED_EXCEPTION_EXIT == status) { |
| 264 | mxPush(mxException); |
| 265 | mxGetID(mxID(_message)); |
| 266 | if ((the->stack->kind == XS_STRING_KIND) || (the->stack->kind == XS_STRING_X_KIND)) |
no test coverage detected