Search in sources :

Example 1 with SuspendEventImpl

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

the class GdbDebugger method resume.

@Override
public void resume(ResumeAction action) throws DebuggerException {
    try {
        GdbContinue gdbContinue = gdb.cont();
        Breakpoint breakpoint = gdbContinue.getBreakpoint();
        if (breakpoint != null) {
            currentLocation = breakpoint.getLocation();
            debuggerCallback.onEvent(new SuspendEventImpl(breakpoint.getLocation()));
        } else {
            GdbInfoProgram gdbInfoProgram = gdb.infoProgram();
            if (gdbInfoProgram.getStoppedAddress() == null) {
                disconnect();
            }
        }
    } catch (GdbTerminatedException e) {
        disconnect();
        throw e;
    } catch (IOException | GdbParseException | InterruptedException e) {
        throw new DebuggerException("Resume error. " + e.getMessage(), e);
    }
}
Also used : SuspendEventImpl(org.eclipse.che.api.debug.shared.model.impl.event.SuspendEventImpl) Breakpoint(org.eclipse.che.api.debug.shared.model.Breakpoint) GdbContinue(org.eclipse.che.plugin.gdb.server.parser.GdbContinue) GdbInfoProgram(org.eclipse.che.plugin.gdb.server.parser.GdbInfoProgram) 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 2 with SuspendEventImpl

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

the class GdbDebugger method stepOut.

@Override
public void stepOut(StepOutAction action) throws DebuggerException {
    try {
        GdbInfoLine gdbInfoLine = gdb.finish();
        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 out 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 3 with SuspendEventImpl

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

the class GdbDebugger method start.

@Override
public void start(StartAction action) throws DebuggerException {
    try {
        for (Breakpoint b : action.getBreakpoints()) {
            try {
                addBreakpoint(b);
            } catch (DebuggerException e) {
            // can't add breakpoint, skip it
            }
        }
        Breakpoint breakpoint;
        if (isRemoteConnection()) {
            GdbContinue gdbContinue = gdb.cont();
            breakpoint = gdbContinue.getBreakpoint();
        } else {
            GdbRun gdbRun = gdb.run();
            breakpoint = gdbRun.getBreakpoint();
        }
        if (breakpoint != null) {
            currentLocation = breakpoint.getLocation();
            debuggerCallback.onEvent(new SuspendEventImpl(breakpoint.getLocation()));
        } else {
            GdbInfoProgram gdbInfoProgram = gdb.infoProgram();
            if (gdbInfoProgram.getStoppedAddress() == null) {
                disconnect();
            }
        }
    } catch (GdbTerminatedException e) {
        disconnect();
        throw e;
    } catch (IOException | GdbParseException | InterruptedException e) {
        throw new DebuggerException("Error during running. " + e.getMessage(), e);
    }
}
Also used : SuspendEventImpl(org.eclipse.che.api.debug.shared.model.impl.event.SuspendEventImpl) Breakpoint(org.eclipse.che.api.debug.shared.model.Breakpoint) GdbRun(org.eclipse.che.plugin.gdb.server.parser.GdbRun) DebuggerException(org.eclipse.che.api.debugger.server.exceptions.DebuggerException) GdbContinue(org.eclipse.che.plugin.gdb.server.parser.GdbContinue) GdbInfoProgram(org.eclipse.che.plugin.gdb.server.parser.GdbInfoProgram) GdbTerminatedException(org.eclipse.che.plugin.gdb.server.exception.GdbTerminatedException) IOException(java.io.IOException) GdbParseException(org.eclipse.che.plugin.gdb.server.exception.GdbParseException)

Example 4 with SuspendEventImpl

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

the class GdbDebugger method stepInto.

@Override
public void stepInto(StepIntoAction action) throws DebuggerException {
    try {
        GdbInfoLine gdbInfoLine = gdb.step();
        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 5 with SuspendEventImpl

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

the class ZendDebugger method handleReady.

private void handleReady(ReadyNotification notification) {
    String remoteFilePath = notification.getFileName();
    if (breakpointAflId != null && remoteFilePath.equals(debugStartFile)) {
        debugConnection.sendRequest(new DeleteBreakpointRequest(breakpointAflId));
        breakpointAflId = null;
    }
    int lineNumber = notification.getLineNumber();
    Location dbgLocation = ZendDbgLocationHandler.createDBG(remoteFilePath, lineNumber);
    // Convert DBG location from engine to VFS location
    Location vfsLocation = debugLocationHandler.convertToVFS(dbgLocation);
    // Send suspend event
    debugCallback.onEvent(new SuspendEventImpl(vfsLocation));
}
Also used : SuspendEventImpl(org.eclipse.che.api.debug.shared.model.impl.event.SuspendEventImpl) DeleteBreakpointRequest(org.eclipse.che.plugin.zdb.server.connection.ZendDbgClientMessages.DeleteBreakpointRequest) Breakpoint(org.eclipse.che.api.debug.shared.model.Breakpoint) Location(org.eclipse.che.api.debug.shared.model.Location)

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