Search in sources :

Example 21 with GdbParseException

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

the class GdbInfoLine method parse.

/**
     * Factory method.
     */
public static GdbInfoLine parse(GdbOutput gdbOutput) throws GdbParseException {
    String output = gdbOutput.getOutput();
    Matcher matcher = GDB_INFO_LINE.matcher(output);
    if (matcher.find()) {
        String lineNumber = matcher.group(1);
        String file = matcher.group(2);
        return new GdbInfoLine(new LocationImpl(file, Integer.parseInt(lineNumber)));
    }
    matcher = GDB_LINE_OUT_OF_RANGE.matcher(output);
    if (matcher.find()) {
        String lineNumber = matcher.group(1);
        String file = matcher.group(2);
        return new GdbInfoLine(new LocationImpl(file, Integer.parseInt(lineNumber)));
    }
    throw new GdbParseException(GdbInfoLine.class, output);
}
Also used : Matcher(java.util.regex.Matcher) LocationImpl(org.eclipse.che.api.debug.shared.model.impl.LocationImpl) GdbParseException(org.eclipse.che.plugin.gdb.server.exception.GdbParseException)

Example 22 with GdbParseException

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

the class GdbInfoProgram method parse.

/**
     * Factory method.
     */
public static GdbInfoProgram parse(GdbOutput gdbOutput) throws GdbParseException {
    String output = gdbOutput.getOutput();
    Matcher matcher = GDB_PROGRAM_FINISHED.matcher(output);
    if (matcher.find()) {
        return new GdbInfoProgram(null);
    }
    matcher = GDB_PROGRAM_STOPPED.matcher(output);
    if (matcher.find()) {
        String address = matcher.group(1);
        return new GdbInfoProgram(address);
    }
    throw new GdbParseException(GdbInfoProgram.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