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

Function PiuDebugMachine_doCommand

tools/xsbug/DebugBehavior.c:1458–1580  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1456}
1457
1458void PiuDebugMachine_doCommand(xsMachine* the)
1459{
1460 static char buffer[16 * 1024];
1461 PiuDebugMachine self = xsGetHostData(xsThis);
1462 xsIntegerValue c = xsToInteger(xsArgc), i;
1463 xsIntegerValue command = xsToInteger(xsArg(0));
1464 xsVars(1);
1465 if (self) {
1466 buffer[0] = 0;
1467 }
1468 else {
1469 xsIntegerValue address = xsToInteger(xsGet(xsThis, xsID_address));
1470 sprintf(buffer, "\15\12<?xs.%8.8X?>", address);
1471 }
1472 if (command < mxScriptCommand) {
1473 c_strcat(buffer, "\15\12");
1474 switch (command) {
1475 case mxAbortCommand:
1476 c_strcat(buffer, "<abort/>");
1477 break;
1478 case mxClearAllBreakpoints:
1479 c_strcat(buffer, "<clear-all-breakpoints/>");
1480 break;
1481 case mxClearBreakpoint:
1482 c_strcat(buffer, "<clear-breakpoint path=\"");
1483 c_strcat(buffer, xsToString(xsGet(xsArg(1), xsID("path"))));
1484 c_strcat(buffer, "\" line=\"");
1485 c_strcat(buffer, xsToString(xsGet(xsArg(1), xsID("line"))));
1486 c_strcat(buffer, "\" id=\"@");
1487 c_strcat(buffer, xsToString(xsGet(xsArg(1), xsID("id"))));
1488 c_strcat(buffer, "\"/>");
1489 break;
1490 case mxGoCommand:
1491 c_strcat(buffer, "<go/>");
1492 xsSet(xsThis, xsID_broken, xsFalse);
1493 break;
1494 case mxLogoutCommand:
1495 c_strcat(buffer, "<logout/>");
1496 break;
1497 case mxSelectCommand:
1498 c_strcat(buffer, "<select id=\"");
1499 c_strcat(buffer, xsToString(xsArg(1)));
1500 c_strcat(buffer, "\"/>");
1501 break;
1502 case mxSetAllBreakpointsCommand:
1503 c_strcat(buffer, "<set-all-breakpoints>");
1504 c = xsToInteger(xsGet(xsArg(1), xsID("length")));
1505 for (i = 0; i < c; i++) {
1506 xsResult = xsGetAt(xsArg(1), xsInteger(i));
1507 PiuDebugMachine_doCommandBreakpoint(the, buffer, "breakpoint");
1508 }
1509 c_strcat(buffer, "</set-all-breakpoints>");
1510 break;
1511 case mxSetBreakpointCommand:
1512 xsResult = xsArg(1);
1513 PiuDebugMachine_doCommandBreakpoint(the, buffer, "set-breakpoint");
1514 break;
1515 case mxStepCommand:

Callers

nothing calls this directly

Tested by

no test coverage detected