Search in sources :

Example 11 with LocationImpl

use of org.eclipse.che.api.debug.shared.model.impl.LocationImpl in project che by eclipse.

the class DebuggerService method deleteBreakpoint.

@DELETE
@Path("{id}/breakpoint")
public void deleteBreakpoint(@PathParam("id") String sessionId, @QueryParam("target") String target, @QueryParam("line") @DefaultValue("0") int lineNumber) throws DebuggerException {
    if (target == null) {
        debuggerManager.getDebugger(sessionId).deleteAllBreakpoints();
    } else {
        Location location = new LocationImpl(target, lineNumber);
        debuggerManager.getDebugger(sessionId).deleteBreakpoint(location);
    }
}
Also used : LocationImpl(org.eclipse.che.api.debug.shared.model.impl.LocationImpl) Location(org.eclipse.che.api.debug.shared.model.Location) Path(javax.ws.rs.Path) VariablePath(org.eclipse.che.api.debug.shared.model.VariablePath) DELETE(javax.ws.rs.DELETE)

Example 12 with LocationImpl

use of org.eclipse.che.api.debug.shared.model.impl.LocationImpl in project che by eclipse.

the class ZendDbgLocationHandler method convertToVFS.

/**
     * Convert DBG specific location to VFS one.
     * 
     * @param dbgLocation
     * @return VFS specific location.
     */
public Location convertToVFS(Location dbgLocation) {
    VirtualFileEntry localFileEntry = ZendDbgFileUtils.findVirtualFileEntry(dbgLocation.getResourcePath());
    if (localFileEntry == null) {
        return null;
    }
    String resourceProjectPath = localFileEntry.getProject();
    String target = localFileEntry.getName();
    String resourcePath = localFileEntry.getPath().toString();
    int lineNumber = dbgLocation.getLineNumber();
    return new LocationImpl(target, lineNumber, resourcePath, false, 0, resourceProjectPath);
}
Also used : VirtualFileEntry(org.eclipse.che.api.project.server.VirtualFileEntry) LocationImpl(org.eclipse.che.api.debug.shared.model.impl.LocationImpl)

Example 13 with LocationImpl

use of org.eclipse.che.api.debug.shared.model.impl.LocationImpl in project che by eclipse.

the class GdbRun method parse.

/**
     * Factory method.
     */
public static GdbRun parse(GdbOutput gdbOutput) throws GdbParseException {
    String output = gdbOutput.getOutput();
    for (String line : output.split("\n")) {
        Matcher matcher = GDB_BREAKPOINT.matcher(line);
        if (matcher.find()) {
            String file = matcher.group(1);
            String lineNumber = matcher.group(2);
            Location location = new LocationImpl(file, Integer.parseInt(lineNumber));
            return new GdbRun(new BreakpointImpl(location));
        }
    }
    return new GdbRun(null);
}
Also used : BreakpointImpl(org.eclipse.che.api.debug.shared.model.impl.BreakpointImpl) Matcher(java.util.regex.Matcher) LocationImpl(org.eclipse.che.api.debug.shared.model.impl.LocationImpl) Location(org.eclipse.che.api.debug.shared.model.Location)

Example 14 with LocationImpl

use of org.eclipse.che.api.debug.shared.model.impl.LocationImpl in project che by eclipse.

the class GdbDebuggerTest method addBreakpoint.

private void addBreakpoint() throws DebuggerException, InterruptedException {
    Location location = new LocationImpl("h.cpp", 7);
    Breakpoint breakpoint = new BreakpointImpl(location);
    gdbDebugger.addBreakpoint(breakpoint);
    assertEquals(events.size(), 1);
    DebuggerEvent debuggerEvent = events.take();
    assertTrue(debuggerEvent instanceof BreakpointActivatedEvent);
    BreakpointActivatedEvent breakpointActivatedEvent = (BreakpointActivatedEvent) debuggerEvent;
    assertEquals(breakpointActivatedEvent.getBreakpoint().getLocation().getTarget(), "h.cpp");
    assertEquals(breakpointActivatedEvent.getBreakpoint().getLocation().getLineNumber(), 7);
}
Also used : Breakpoint(org.eclipse.che.api.debug.shared.model.Breakpoint) BreakpointImpl(org.eclipse.che.api.debug.shared.model.impl.BreakpointImpl) LocationImpl(org.eclipse.che.api.debug.shared.model.impl.LocationImpl) BreakpointActivatedEvent(org.eclipse.che.api.debug.shared.model.event.BreakpointActivatedEvent) DebuggerEvent(org.eclipse.che.api.debug.shared.model.event.DebuggerEvent) Location(org.eclipse.che.api.debug.shared.model.Location)

Example 15 with LocationImpl

use of org.eclipse.che.api.debug.shared.model.impl.LocationImpl 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;
}
Also used : SuspendEventImpl(org.eclipse.che.api.debug.shared.model.impl.event.SuspendEventImpl) DebuggerException(org.eclipse.che.api.debugger.server.exceptions.DebuggerException) LocationImpl(org.eclipse.che.api.debug.shared.model.impl.LocationImpl) ExpressionParser(org.eclipse.che.plugin.jdb.server.expression.ExpressionParser) Location(org.eclipse.che.api.debug.shared.model.Location)

Aggregations

LocationImpl (org.eclipse.che.api.debug.shared.model.impl.LocationImpl)22 Location (org.eclipse.che.api.debug.shared.model.Location)11 BreakpointImpl (org.eclipse.che.api.debug.shared.model.impl.BreakpointImpl)11 Breakpoint (org.eclipse.che.api.debug.shared.model.Breakpoint)8 Matcher (java.util.regex.Matcher)7 Test (org.testng.annotations.Test)7 BreakpointActivatedEvent (org.eclipse.che.api.debug.shared.model.event.BreakpointActivatedEvent)6 DebuggerEvent (org.eclipse.che.api.debug.shared.model.event.DebuggerEvent)5 NodeJsDebuggerParseException (org.eclipse.che.plugin.nodejsdbg.server.exception.NodeJsDebuggerParseException)3 ArrayList (java.util.ArrayList)2 SuspendEvent (org.eclipse.che.api.debug.shared.model.event.SuspendEvent)2 DebuggerException (org.eclipse.che.api.debugger.server.exceptions.DebuggerException)2 GdbParseException (org.eclipse.che.plugin.gdb.server.exception.GdbParseException)2 JsonElement (com.google.gson.JsonElement)1 JsonObject (com.google.gson.JsonObject)1 JsonParser (com.google.gson.JsonParser)1 HashMap (java.util.HashMap)1 DELETE (javax.ws.rs.DELETE)1 Path (javax.ws.rs.Path)1 VariablePath (org.eclipse.che.api.debug.shared.model.VariablePath)1