Search in sources :

Example 6 with SuspendEventImpl

use of org.eclipse.che.api.debug.shared.model.impl.event.SuspendEventImpl in project che by eclipse.

the class JavaDebugger method processStepEvent.

private boolean processStepEvent(com.sun.jdi.event.StepEvent event) throws DebuggerException {
    setCurrentThread(event.thread());
    com.sun.jdi.Location jdiLocation = event.location();
    Location location = debuggerUtil.getLocation(jdiLocation);
    debuggerCallback.onEvent(new SuspendEventImpl(location));
    return false;
}
Also used : SuspendEventImpl(org.eclipse.che.api.debug.shared.model.impl.event.SuspendEventImpl) Location(org.eclipse.che.api.debug.shared.model.Location)

Example 7 with SuspendEventImpl

use of org.eclipse.che.api.debug.shared.model.impl.event.SuspendEventImpl in project che by eclipse.

the class NodeJsDebugger method onOutputProduced.

@Override
public boolean onOutputProduced(NodeJsOutput nodeJsOutput) throws NodeJsDebuggerException {
    if (NodeJsStepParser.INSTANCE.match(nodeJsOutput)) {
        SuspendEventImpl suspendEvent = new SuspendEventImpl(NodeJsStepParser.INSTANCE.parse(nodeJsOutput));
        debuggerCallback.onEvent(suspendEvent);
    } else if (NodeJsBackTraceParser.INSTANCE.match(nodeJsOutput)) {
        SuspendEventImpl suspendEvent = new SuspendEventImpl(NodeJsBackTraceParser.INSTANCE.parse(nodeJsOutput));
        debuggerCallback.onEvent(suspendEvent);
    } else if (DEBUG_TIMED_OUT_MSG.equals(nodeJsOutput.getOutput())) {
        disconnect();
    } else {
        return false;
    }
    return true;
}
Also used : SuspendEventImpl(org.eclipse.che.api.debug.shared.model.impl.event.SuspendEventImpl)

Example 8 with SuspendEventImpl

use of org.eclipse.che.api.debug.shared.model.impl.event.SuspendEventImpl in project che by eclipse.

the class JavaDebugger method processBreakPointEvent.

private boolean processBreakPointEvent(com.sun.jdi.event.BreakpointEvent event) throws DebuggerException {
    setCurrentThread(event.thread());
    boolean hitBreakpoint;
    ExpressionParser parser = (ExpressionParser) event.request().getProperty("org.eclipse.che.ide.java.debug.condition.expression.parser");
    if (parser != null) {
        com.sun.jdi.Value result = evaluate(parser);
        hitBreakpoint = result instanceof com.sun.jdi.BooleanValue && ((com.sun.jdi.BooleanValue) result).value();
    } else {
        // If there is no expression.
        hitBreakpoint = true;
    }
    if (hitBreakpoint) {
        com.sun.jdi.Location jdiLocation = event.location();
        Location location;
        try {
            location = debuggerUtil.getLocation(jdiLocation);
        } catch (DebuggerException e) {
            location = new LocationImpl(jdiLocation.declaringType().name(), jdiLocation.lineNumber());
        }
        debuggerCallback.onEvent(new SuspendEventImpl(location));
    }
    // or if condition expression is not set.
    return !hitBreakpoint;
}
Also used : SuspendEventImpl(org.eclipse.che.api.debug.shared.model.impl.event.SuspendEventImpl) DebuggerException(org.eclipse.che.api.debugger.server.exceptions.DebuggerException) LocationImpl(org.eclipse.che.api.debug.shared.model.impl.LocationImpl) ExpressionParser(org.eclipse.che.plugin.jdb.server.expression.ExpressionParser) Location(org.eclipse.che.api.debug.shared.model.Location)

Example 9 with SuspendEventImpl

use of org.eclipse.che.api.debug.shared.model.impl.event.SuspendEventImpl in project che by eclipse.

the class GdbDebugger method stepOver.

@Override
public void stepOver(StepOverAction action) throws DebuggerException {
    try {
        GdbInfoLine gdbInfoLine = gdb.next();
        if (gdbInfoLine == null) {
            disconnect();
            return;
        }
        currentLocation = gdbInfoLine.getLocation();
        debuggerCallback.onEvent(new SuspendEventImpl(gdbInfoLine.getLocation()));
    } catch (GdbTerminatedException e) {
        disconnect();
        throw e;
    } catch (IOException | GdbParseException | InterruptedException e) {
        throw new DebuggerException("Step into error. " + e.getMessage(), e);
    }
}
Also used : SuspendEventImpl(org.eclipse.che.api.debug.shared.model.impl.event.SuspendEventImpl) GdbInfoLine(org.eclipse.che.plugin.gdb.server.parser.GdbInfoLine) DebuggerException(org.eclipse.che.api.debugger.server.exceptions.DebuggerException) GdbTerminatedException(org.eclipse.che.plugin.gdb.server.exception.GdbTerminatedException) IOException(java.io.IOException) GdbParseException(org.eclipse.che.plugin.gdb.server.exception.GdbParseException)

Example 10 with SuspendEventImpl

use of org.eclipse.che.api.debug.shared.model.impl.event.SuspendEventImpl in project che by eclipse.

the class GdbDebugger method suspend.

@Override
public void suspend() throws DebuggerException {
    try {
        currentLocation = gdb.suspend(file, isRemoteConnection());
        debuggerCallback.onEvent(new SuspendEventImpl(currentLocation));
    } catch (IOException | InterruptedException e) {
        throw new DebuggerException("Can not suspend debugger session. " + e.getMessage(), e);
    }
}
Also used : SuspendEventImpl(org.eclipse.che.api.debug.shared.model.impl.event.SuspendEventImpl) DebuggerException(org.eclipse.che.api.debugger.server.exceptions.DebuggerException) IOException(java.io.IOException)

Aggregations

SuspendEventImpl (org.eclipse.che.api.debug.shared.model.impl.event.SuspendEventImpl)10 DebuggerException (org.eclipse.che.api.debugger.server.exceptions.DebuggerException)7 IOException (java.io.IOException)6 GdbParseException (org.eclipse.che.plugin.gdb.server.exception.GdbParseException)5 GdbTerminatedException (org.eclipse.che.plugin.gdb.server.exception.GdbTerminatedException)5 Breakpoint (org.eclipse.che.api.debug.shared.model.Breakpoint)3 Location (org.eclipse.che.api.debug.shared.model.Location)3 GdbInfoLine (org.eclipse.che.plugin.gdb.server.parser.GdbInfoLine)3 GdbContinue (org.eclipse.che.plugin.gdb.server.parser.GdbContinue)2 GdbInfoProgram (org.eclipse.che.plugin.gdb.server.parser.GdbInfoProgram)2 LocationImpl (org.eclipse.che.api.debug.shared.model.impl.LocationImpl)1 GdbRun (org.eclipse.che.plugin.gdb.server.parser.GdbRun)1 ExpressionParser (org.eclipse.che.plugin.jdb.server.expression.ExpressionParser)1 DeleteBreakpointRequest (org.eclipse.che.plugin.zdb.server.connection.ZendDbgClientMessages.DeleteBreakpointRequest)1