use of org.eclipse.che.api.debugger.server.exceptions.DebuggerException in project che by eclipse.
the class GdbTargetRemote method parse.
/**
* Factory method.
*/
public static GdbTargetRemote parse(GdbOutput gdbOutput) throws GdbParseException, DebuggerException {
String output = gdbOutput.getOutput();
Matcher matcher = GDB_TARGET_REMOTE.matcher(output);
if (matcher.find()) {
String host = matcher.group(1);
String port = matcher.group(2);
return new GdbTargetRemote(host, port);
} else if (CONNECTION_TIMED_OUT.matcher(output).find()) {
throw new DebuggerException(output);
}
throw new GdbParseException(GdbTargetRemote.class, output);
}
use of org.eclipse.che.api.debugger.server.exceptions.DebuggerException in project che by eclipse.
the class GdbDebuggerTest method stepOut.
private void stepOut() throws DebuggerException, InterruptedException {
try {
gdbDebugger.stepOut(new StepOutActionImpl());
} catch (DebuggerException e) {
// ignore
}
DebuggerEvent debuggerEvent = events.take();
assertTrue(debuggerEvent instanceof SuspendEvent);
}
use of org.eclipse.che.api.debugger.server.exceptions.DebuggerException in project che by eclipse.
the class JavaDebugger method evaluate.
private com.sun.jdi.Value evaluate(ExpressionParser parser) throws DebuggerException {
final long startTime = System.currentTimeMillis();
try {
return parser.evaluate(new Evaluator(vm, getCurrentThread()));
} catch (ExpressionException e) {
throw new DebuggerException(e.getMessage(), e);
} finally {
final long endTime = System.currentTimeMillis();
LOG.debug("==>> Evaluate time: {} ms", (endTime - startTime));
// Evaluation of expression may update state of frame.
invalidateCurrentFrame();
}
}
use of org.eclipse.che.api.debugger.server.exceptions.DebuggerException in project che by eclipse.
the class JavaDebugger method processBreakPointEvent.
private boolean processBreakPointEvent(com.sun.jdi.event.BreakpointEvent event) throws DebuggerException {
setCurrentThread(event.thread());
boolean hitBreakpoint;
ExpressionParser parser = (ExpressionParser) event.request().getProperty("org.eclipse.che.ide.java.debug.condition.expression.parser");
if (parser != null) {
com.sun.jdi.Value result = evaluate(parser);
hitBreakpoint = result instanceof com.sun.jdi.BooleanValue && ((com.sun.jdi.BooleanValue) result).value();
} else {
// If there is no expression.
hitBreakpoint = true;
}
if (hitBreakpoint) {
com.sun.jdi.Location jdiLocation = event.location();
Location location;
try {
location = debuggerUtil.getLocation(jdiLocation);
} catch (DebuggerException e) {
location = new LocationImpl(jdiLocation.declaringType().name(), jdiLocation.lineNumber());
}
debuggerCallback.onEvent(new SuspendEventImpl(location));
}
// or if condition expression is not set.
return !hitBreakpoint;
}
use of org.eclipse.che.api.debugger.server.exceptions.DebuggerException in project che by eclipse.
the class JavaDebugger method getAllBreakpoints.
@Override
public List<Breakpoint> getAllBreakpoints() throws DebuggerException {
List<BreakpointRequest> breakpointRequests;
try {
breakpointRequests = getEventManager().breakpointRequests();
} catch (DebuggerException e) {
Throwable cause = e.getCause();
if (cause instanceof VMCannotBeModifiedException) {
// If target VM in read-only state then list of break point always empty.
return Collections.emptyList();
}
throw e;
}
List<Breakpoint> breakPoints = new ArrayList<>(breakpointRequests.size());
for (BreakpointRequest breakpointRequest : breakpointRequests) {
com.sun.jdi.Location location = breakpointRequest.location();
// Breakpoint always enabled at the moment. Managing states of breakpoint is not supported for now.
breakPoints.add(newDto(BreakpointDto.class).withEnabled(true).withLocation(newDto(LocationDto.class).withTarget(location.declaringType().name()).withLineNumber(location.lineNumber())));
}
Collections.sort(breakPoints, BREAKPOINT_COMPARATOR);
return breakPoints;
}
Aggregations