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

Function fxAbort

xs/platforms/pico/xsPlatform.c:195–259  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

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