MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / fxAbort

Function fxAbort

xs/platforms/nrf52/xsPlatform.c:198–264  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

196}
197
198void fxAbort(txMachine* the, int status)
199{
200#if MODDEF_XS_TEST
201 if (XS_DEBUGGER_EXIT == status) {
202 extern txMachine *gThe;
203 if (gThe == the) {
204 gThe = NULL; // soft reset
205 return;
206 }
207 }
208
209 if (XS_NOT_ENOUGH_MEMORY_EXIT == status)
210 mxUnknownError("fxAbort: out of memory");
211#endif
212
213#ifdef mxDebug
214 if ((XS_DEAD_STRIP_EXIT == status) && the->debugEval)
215 mxUnknownError("dead strip");
216#endif
217
218#if defined(mxDebug) || defined(mxInstrument) || defined(MODDEF_XS_ABORTHOOK)
219 const char *msg = fxAbortString(status);
220
221 #if MODDEF_XS_ABORTHOOK
222 if ((XS_JAVASCRIPT_STACK_OVERFLOW_EXIT != status) && (XS_NATIVE_STACK_OVERFLOW_EXIT != status) & (XS_DEBUGGER_EXIT != status)) {
223 xsBooleanValue ignore = false;
224
225 fxBeginHost(the);
226 {
227 mxPush(mxException);
228 txSlot *exception = the->stack;
229 mxException = xsUndefined;
230 mxTry(the) {
231 txID abortID = fxFindName(the, "abort");
232 mxOverflow(-8);
233 mxPush(mxGlobal);
234 if (fxHasID(the, abortID)) {
235 mxPush(mxGlobal);
236 fxCallID(the, abortID);
237 mxPushStringC((char *)msg);
238 mxPushSlot(exception);
239 fxRunCount(the, 2);
240 ignore = (XS_BOOLEAN_KIND == the->stack->kind) && !the->stack->value.boolean;
241 mxPop();
242 }
243 }
244 mxCatch(the) {
245 }
246 }
247 fxEndHost(the);
248 if (ignore)
249 return;
250 }
251 #endif
252
253 fxReport(the, "XS abort: %s\n", msg);
254 #if !defined(MODDEF_XS_DEBUGABORT) || MODDEF_XS_DEBUGABORT
255 #if defined(mxDebug) && !MODDEF_XS_TEXT

Callers

nothing calls this directly

Calls 8

fxAbortStringFunction · 0.85
fxBeginHostFunction · 0.85
fxFindNameFunction · 0.85
fxHasIDFunction · 0.85
fxCallIDFunction · 0.85
fxRunCountFunction · 0.85
fxEndHostFunction · 0.85
fxDebuggerFunction · 0.85

Tested by

no test coverage detected