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

Function fxDebugLine

xs/sources/xsDebug.c:513–606  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

511#endif
512
513void fxDebugLine(txMachine* the, txID path, txInteger line, txID function)
514{
515 txSlot* breakpoint = C_NULL;
516 breakpoint = mxBreakpoints.value.list.first;
517 while (breakpoint) {
518 if (breakpoint->value.breakpoint.line == line) {
519 if (breakpoint->ID == path)
520 break;
521 }
522 else if (breakpoint->value.breakpoint.line == 0) {
523 if (breakpoint->ID == function)
524 break;
525 }
526 breakpoint = breakpoint->next;
527 }
528 if (breakpoint) {
529 txSlot* instance = breakpoint->value.breakpoint.info;
530 if (instance) {
531 txSlot* property = instance->next;
532 if (!mxIsUndefined(property)) {
533 txSlot* result;
534 txBoolean skip = 1;
535 mxTemporary(result);
536 if (fxDebugEvalExpression(the, the->frame, property, result)) {
537 mxPushSlot(result);
538 skip = (fxRunTest(the)) ? 0 : 1;
539 }
540 else {
541 fxEchoStart(the);
542 fxEcho(the, "<log");
543 fxEchoPathLine(the, fxGetKeyName(the, path), line);
544 fxEcho(the, "># ");
545 fxEchoException(the, result);
546 fxEcho(the, "\n</log>");
547 fxEchoStop(the);
548 }
549 mxPop();
550 if (skip)
551 breakpoint = C_NULL;
552 }
553 if (breakpoint) {
554 property = property->next;
555 if (!mxIsUndefined(property)) {
556 txInteger offset = property->value.dataView.offset + 1;
557 txInteger size = property->value.dataView.size;
558 txBoolean skip = 1;
559 switch (property->ID) {
560 case XS_CODE_EQUAL: if (offset == size) skip = 0; break;
561 case XS_CODE_LESS: if (offset < size) skip = 0; break;
562 case XS_CODE_LESS_EQUAL: if (offset <= size) skip = 0; break;
563 case XS_CODE_MODULO: if ((offset % size) == 0) skip = 0; break;
564 case XS_CODE_MORE: if (offset > size) skip = 0; break;
565 case XS_CODE_MORE_EQUAL: if (offset >= size) skip = 0; break;
566 }
567 property->value.dataView.offset = offset;
568 if (skip)
569 breakpoint = C_NULL;
570 }

Callers 1

xsRun.cFile · 0.85

Calls 11

fxDebugEvalExpressionFunction · 0.85
fxRunTestFunction · 0.85
fxEchoStartFunction · 0.85
fxEchoFunction · 0.85
fxEchoPathLineFunction · 0.85
fxGetKeyNameFunction · 0.85
fxEchoExceptionFunction · 0.85
fxEchoStopFunction · 0.85
fxToStringFunction · 0.85
fxEchoStringFunction · 0.85
fxDebugLoopFunction · 0.85

Tested by

no test coverage detected