Search in sources :

Example 1 with VMCannotBeModifiedException

use of com.sun.jdi.VMCannotBeModifiedException in project che by eclipse.

the class JavaDebugger method resume.

@Override
public void resume(ResumeAction action) throws DebuggerException {
    lock.lock();
    try {
        invalidateCurrentThread();
        vm.resume();
        LOG.debug("Resume VM");
    } catch (VMCannotBeModifiedException e) {
        throw new DebuggerException(e.getMessage(), e);
    } finally {
        lock.unlock();
    }
}
Also used : DebuggerException(org.eclipse.che.api.debugger.server.exceptions.DebuggerException) VMCannotBeModifiedException(com.sun.jdi.VMCannotBeModifiedException)

Example 2 with VMCannotBeModifiedException

use of com.sun.jdi.VMCannotBeModifiedException 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;
}
Also used : Breakpoint(org.eclipse.che.api.debug.shared.model.Breakpoint) DebuggerException(org.eclipse.che.api.debugger.server.exceptions.DebuggerException) BreakpointRequest(com.sun.jdi.request.BreakpointRequest) ArrayList(java.util.ArrayList) VMCannotBeModifiedException(com.sun.jdi.VMCannotBeModifiedException) BreakpointDto(org.eclipse.che.api.debug.shared.dto.BreakpointDto)

Aggregations

VMCannotBeModifiedException (com.sun.jdi.VMCannotBeModifiedException)2 DebuggerException (org.eclipse.che.api.debugger.server.exceptions.DebuggerException)2 BreakpointRequest (com.sun.jdi.request.BreakpointRequest)1 ArrayList (java.util.ArrayList)1 BreakpointDto (org.eclipse.che.api.debug.shared.dto.BreakpointDto)1 Breakpoint (org.eclipse.che.api.debug.shared.model.Breakpoint)1