Search in sources :

Example 6 with GdbTerminatedException

use of org.eclipse.che.plugin.gdb.server.exception.GdbTerminatedException 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 7 with GdbTerminatedException

use of org.eclipse.che.plugin.gdb.server.exception.GdbTerminatedException in project che by eclipse.

the class GdbDebugger method getValue.

@Override
public SimpleValue getValue(VariablePath variablePath) throws DebuggerException {
    try {
        List<String> path = variablePath.getPath();
        if (path.isEmpty()) {
            throw new DebuggerException("Variable path is empty");
        }
        GdbPrint gdbPrint = gdb.print(path.get(0));
        return new SimpleValueImpl(Collections.emptyList(), gdbPrint.getValue());
    } catch (GdbTerminatedException e) {
        disconnect();
        throw e;
    } catch (IOException | GdbParseException | InterruptedException e) {
        throw new DebuggerException("Can't get value for " + variablePath + ". " + e.getMessage(), e);
    }
}
Also used : GdbPrint(org.eclipse.che.plugin.gdb.server.parser.GdbPrint) SimpleValueImpl(org.eclipse.che.api.debug.shared.model.impl.SimpleValueImpl) 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 8 with GdbTerminatedException

use of org.eclipse.che.plugin.gdb.server.exception.GdbTerminatedException in project che by eclipse.

the class Gdb method grabGdbOutput.

private GdbOutput grabGdbOutput() throws InterruptedException, GdbTerminatedException {
    GdbOutput gdbOutput = outputs.take();
    if (gdbOutput.isTerminated()) {
        String errorMsg = "GDB has been terminated with output: " + gdbOutput.getOutput();
        LOG.error(errorMsg);
        throw new GdbTerminatedException(errorMsg);
    }
    return gdbOutput;
}
Also used : GdbTerminatedException(org.eclipse.che.plugin.gdb.server.exception.GdbTerminatedException) GdbOutput(org.eclipse.che.plugin.gdb.server.parser.GdbOutput)

Example 9 with GdbTerminatedException

use of org.eclipse.che.plugin.gdb.server.exception.GdbTerminatedException in project che by eclipse.

the class GdbDebugger method addBreakpoint.

@Override
public void addBreakpoint(Breakpoint breakpoint) throws DebuggerException {
    try {
        Location location = breakpoint.getLocation();
        if (location.getTarget() == null) {
            gdb.breakpoint(location.getLineNumber());
        } else {
            gdb.breakpoint(location.getTarget(), location.getLineNumber());
        }
        debuggerCallback.onEvent(new BreakpointActivatedEventImpl(breakpoint));
    } catch (GdbTerminatedException e) {
        disconnect();
        throw e;
    } catch (IOException | GdbParseException | InterruptedException e) {
        throw new DebuggerException("Can't add breakpoint: " + breakpoint + ". " + e.getMessage(), e);
    }
}
Also used : DebuggerException(org.eclipse.che.api.debugger.server.exceptions.DebuggerException) BreakpointActivatedEventImpl(org.eclipse.che.api.debug.shared.model.impl.event.BreakpointActivatedEventImpl) GdbTerminatedException(org.eclipse.che.plugin.gdb.server.exception.GdbTerminatedException) IOException(java.io.IOException) GdbParseException(org.eclipse.che.plugin.gdb.server.exception.GdbParseException) Location(org.eclipse.che.api.debug.shared.model.Location)

Example 10 with GdbTerminatedException

use of org.eclipse.che.plugin.gdb.server.exception.GdbTerminatedException 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)

Aggregations

GdbTerminatedException (org.eclipse.che.plugin.gdb.server.exception.GdbTerminatedException)10 IOException (java.io.IOException)9 DebuggerException (org.eclipse.che.api.debugger.server.exceptions.DebuggerException)9 GdbParseException (org.eclipse.che.plugin.gdb.server.exception.GdbParseException)9 SuspendEventImpl (org.eclipse.che.api.debug.shared.model.impl.event.SuspendEventImpl)5 GdbInfoLine (org.eclipse.che.plugin.gdb.server.parser.GdbInfoLine)3 Breakpoint (org.eclipse.che.api.debug.shared.model.Breakpoint)2 GdbContinue (org.eclipse.che.plugin.gdb.server.parser.GdbContinue)2 GdbInfoProgram (org.eclipse.che.plugin.gdb.server.parser.GdbInfoProgram)2 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1 Location (org.eclipse.che.api.debug.shared.model.Location)1 Variable (org.eclipse.che.api.debug.shared.model.Variable)1 VariablePath (org.eclipse.che.api.debug.shared.model.VariablePath)1 SimpleValueImpl (org.eclipse.che.api.debug.shared.model.impl.SimpleValueImpl)1 StackFrameDumpImpl (org.eclipse.che.api.debug.shared.model.impl.StackFrameDumpImpl)1 VariableImpl (org.eclipse.che.api.debug.shared.model.impl.VariableImpl)1 VariablePathImpl (org.eclipse.che.api.debug.shared.model.impl.VariablePathImpl)1 BreakpointActivatedEventImpl (org.eclipse.che.api.debug.shared.model.impl.event.BreakpointActivatedEventImpl)1 GdbOutput (org.eclipse.che.plugin.gdb.server.parser.GdbOutput)1