Search in sources :

Example 6 with GdbParseException

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

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

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

the class GdbBreak method parse.

/**
     * Factory method.
     */
public static GdbBreak parse(GdbOutput gdbOutput) throws GdbParseException {
    String output = gdbOutput.getOutput();
    Matcher matcher = GDB_BREAK.matcher(output);
    if (matcher.find()) {
        String address = matcher.group(2);
        String file = matcher.group(3);
        String lineNumber = matcher.group(4);
        return new GdbBreak(address, file, lineNumber);
    }
    throw new GdbParseException(GdbBreak.class, output);
}
Also used : Matcher(java.util.regex.Matcher) GdbParseException(org.eclipse.che.plugin.gdb.server.exception.GdbParseException)

Example 9 with GdbParseException

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

the class GdbClear method parse.

/**
     * Factory method.
     */
public static GdbClear parse(GdbOutput gdbOutput) throws GdbParseException {
    String output = gdbOutput.getOutput();
    Matcher matcher = GDB_CLEAR.matcher(output);
    if (matcher.find()) {
        return new GdbClear();
    }
    throw new GdbParseException(GdbClear.class, output);
}
Also used : Matcher(java.util.regex.Matcher) GdbParseException(org.eclipse.che.plugin.gdb.server.exception.GdbParseException)

Example 10 with GdbParseException

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

the class GdbPType method parse.

/**
     * Factory method.
     */
public static GdbPType parse(GdbOutput gdbOutput) throws GdbParseException {
    String output = gdbOutput.getOutput();
    Matcher matcher = GDB_ARGS.matcher(output);
    if (matcher.find()) {
        String type = matcher.group(1);
        return new GdbPType(type);
    }
    throw new GdbParseException(GdbPrint.class, output);
}
Also used : Matcher(java.util.regex.Matcher) GdbParseException(org.eclipse.che.plugin.gdb.server.exception.GdbParseException)

Aggregations

GdbParseException (org.eclipse.che.plugin.gdb.server.exception.GdbParseException)22 Matcher (java.util.regex.Matcher)13 DebuggerException (org.eclipse.che.api.debugger.server.exceptions.DebuggerException)10 IOException (java.io.IOException)9 GdbTerminatedException (org.eclipse.che.plugin.gdb.server.exception.GdbTerminatedException)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 Location (org.eclipse.che.api.debug.shared.model.Location)2 LocationImpl (org.eclipse.che.api.debug.shared.model.impl.LocationImpl)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 HashMap (java.util.HashMap)1 Map (java.util.Map)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