use of org.eclipse.che.plugin.gdb.server.exception.GdbParseException in project che by eclipse.
the class GdbVersion method parse.
/**
* Factory method.
*/
public static GdbVersion parse(GdbOutput gdbOutput) throws GdbParseException {
String output = gdbOutput.getOutput();
Matcher matcher = GDB_VERSION.matcher(output);
if (matcher.find()) {
String name = matcher.group(1);
String version = matcher.group(2);
return new GdbVersion(name, version);
}
throw new GdbParseException(GdbVersion.class, output);
}
use of org.eclipse.che.plugin.gdb.server.exception.GdbParseException 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);
}
}
use of org.eclipse.che.plugin.gdb.server.exception.GdbParseException 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);
}
}
use of org.eclipse.che.plugin.gdb.server.exception.GdbParseException in project che by eclipse.
the class GdbBacktrace method parse.
/**
* Factory method.
*/
public static GdbBacktrace parse(GdbOutput gdbOutput) throws GdbParseException {
Matcher matcher;
final String output = gdbOutput.getOutput();
final String[] framesInfo = output.split("#");
final Map<Integer, Location> frames = new HashMap<>(framesInfo.length);
for (String frame : framesInfo) {
try {
matcher = GDB_FILE_LOCATION.matcher(frame);
if (matcher.find()) {
final String fileLocation = matcher.group(2);
final int lineNumber = Integer.parseInt(matcher.group(3));
final int frameNumber = Integer.parseInt(matcher.group(1));
final Location location = new LocationImpl(fileLocation, lineNumber);
frames.put(frameNumber, location);
continue;
}
matcher = GDB_LIBRARY_LOCATION.matcher(frame);
if (matcher.find()) {
final int frameNumber = Integer.parseInt(matcher.group(1));
final String libraryLocation = matcher.group(2);
final Location location = new LocationImpl(libraryLocation);
frames.put(frameNumber, location);
}
} catch (NumberFormatException e) {
//we can't get info about current frame, but we are trying to get info about another frames
}
}
if (!frames.isEmpty()) {
return new GdbBacktrace(frames);
}
throw new GdbParseException(GdbBacktrace.class, output);
}
use of org.eclipse.che.plugin.gdb.server.exception.GdbParseException in project che by eclipse.
the class GdbFile method parse.
/**
* Factory method.
*/
public static GdbFile parse(GdbOutput gdbOutput) throws GdbParseException {
String output = gdbOutput.getOutput();
Matcher matcher = GDB_FILE.matcher(output);
if (matcher.find()) {
String file = matcher.group(1);
return new GdbFile(file);
}
throw new GdbParseException(GdbFile.class, output);
}
Aggregations