modules/ballerina-core/src/main/java/org/ballerinalang/util/debugger/DebugManager.java
public void processDebugCommand(String json) {
        BLangExecutionDebugger debugger = debugSession.getDebugger();
        ObjectMapper mapper = new ObjectMapper();
        CommandDTO command = null;
        try {
            command = mapper.readValue(json, CommandDTO.class);
        } catch (IOException e) {
            // Set the command to invalid so an invalid message will be passed from -
            // default block
            command.setCommand("invalid");
        }
        switch (command.getCommand()) {
            case DebugConstants.CMD_RESUME:
                debugger.resume();
                break;
            case DebugConstants.CMD_STEP_OVER:
                debugger.stepOver();
                break;
            case DebugConstants.CMD_STEP_IN:
                debugger.stepIn();
                break;
            case DebugConstants.CMD_STEP_OUT:
                debugger.stepOut();
                break;
            case DebugConstants.CMD_STOP:
                debugger.clearDebugPoints();
                debugger.resume();
                break;
            case DebugConstants.CMD_SET_POINTS:
                // we expect { "command": "SET_POINTS", points: [{ "fileName": "sample.bal", "lineNumber" : 5 },{...}]}
                debugSession.setBreakPoints(command.getBreakPoints());
                sendAcknowledge(this.debugSession, "Debug points updated");
                break;
            case DebugConstants.CMD_START:
                // Client needs to explicitly start the execution once connected.
                // This will allow client to set the breakpoints before starting the execution.
                if (this.waitingForClient) {
                    executionSem.release();
                    this.waitingForClient = false;
                    sendAcknowledge(this.debugSession, "Debug started.");
                }
                break;
            default:
                MessageDTO message = new MessageDTO();
                message.setCode(DebugConstants.CODE_INVALID);
                message.setMessage(DebugConstants.MSG_INVALID);
                debugServer.pushMessageToClient(debugSession, message);
        }
    }
/**
     * Process debug command.
     *
     * @param json the json
     */
Process debug command.
@param json the json
Process debug command . @param json the json
public void processDebugCommand(String json) {
        BLangExecutionDebugger debugger = debugSession.getDebugger();
        ObjectMapper mapper = new ObjectMapper();
        CommandDTO command = null;
        try {
            command = mapper.readValue(json, CommandDTO.class);
        } catch (IOException e) {
            command.setCommand("invalid");
        }
        switch (command.getCommand()) {
            case DebugConstants.CMD_RESUME:
                debugger.resume();
                break;
            case DebugConstants.CMD_STEP_OVER:
                debugger.stepOver();
                break;
            case DebugConstants.CMD_STEP_IN:
                debugger.stepIn();
                break;
            case DebugConstants.CMD_STEP_OUT:
                debugger.stepOut();
                break;
            case DebugConstants.CMD_STOP:
                debugger.clearDebugPoints();
                debugger.resume();
                break;
            case DebugConstants.CMD_SET_POINTS:
                debugSession.setBreakPoints(command.getBreakPoints());
                sendAcknowledge(this.debugSession, "Debug points updated");
                break;
            case DebugConstants.CMD_START:
                if (this.waitingForClient) {
                    executionSem.release();
                    this.waitingForClient = false;
                    sendAcknowledge(this.debugSession, "Debug started.");
                }
                break;
            default:
                MessageDTO message = new MessageDTO();
                message.setCode(DebugConstants.CODE_INVALID);
                message.setMessage(DebugConstants.MSG_INVALID);
                debugServer.pushMessageToClient(debugSession, message);
        }
    }
public void processDebugCommand ( String json ) { BLangExecutionDebugger debugger = debugSession . getDebugger ( ) ; ObjectMapper mapper = new ObjectMapper ( ) ; CommandDTO command = null ; try { command = mapper . readValue ( json , CommandDTO . class ) ; } catch ( IOException e ) { command . setCommand ( "invalid" ) ; } switch ( command . getCommand ( ) ) { case DebugConstants . CMD_RESUME : debugger . resume ( ) ; break ; case DebugConstants . CMD_STEP_OVER : debugger . stepOver ( ) ; break ; case DebugConstants . CMD_STEP_IN : debugger . stepIn ( ) ; break ; case DebugConstants . CMD_STEP_OUT : debugger . stepOut ( ) ; break ; case DebugConstants . CMD_STOP : debugger . clearDebugPoints ( ) ; debugger . resume ( ) ; break ; case DebugConstants . CMD_SET_POINTS : debugSession . setBreakPoints ( command . getBreakPoints ( ) ) ; sendAcknowledge ( this . debugSession , "Debug points updated" ) ; break ; case DebugConstants . CMD_START : if ( this . waitingForClient ) { executionSem . release ( ) ; this . waitingForClient = false ; sendAcknowledge ( this . debugSession , "Debug started." ) ; } break ; default : MessageDTO message = new MessageDTO ( ) ; message . setCode ( DebugConstants . CODE_INVALID ) ; message . setMessage ( DebugConstants . MSG_INVALID ) ; debugServer . pushMessageToClient ( debugSession , message ) ; } }
Process debug command.
Process debug command .
// Set the command to invalid so an invalid message will be passed from - // default block // we expect { "command": "SET_POINTS", points: [{ "fileName": "sample.bal", "lineNumber" : 5 },{...}]} // Client needs to explicitly start the execution once connected. // This will allow client to set the breakpoints before starting the execution.