Search in sources :

Example 16 with Location

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

the class NodeJsStepParserTest method testParse.

@Test
public void testParse() throws Exception {
    NodeJsOutput nodeJsOutput = NodeJsOutput.of("break in module.js:559\n" + " 557   if (depth === 0) stat.cache = null;\n" + " 558   return result;\n" + ">559 };\n" + " 560 \n" + " 561");
    Location location = parser.parse(nodeJsOutput);
    assertEquals(location.getTarget(), "module.js");
    assertEquals(location.getLineNumber(), 559);
}
Also used : NodeJsOutput(org.eclipse.che.plugin.nodejsdbg.server.NodeJsOutput) Location(org.eclipse.che.api.debug.shared.model.Location) Test(org.testng.annotations.Test)

Example 17 with Location

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

the class NodeJsBackTraceParserTest method testParse.

@Test(dataProvider = "parse")
public void testParse(String output, String script, int line) throws Exception {
    NodeJsOutput nodeJsOutput = NodeJsOutput.of(output);
    Location location = parser.parse(nodeJsOutput);
    assertEquals(location.getTarget(), script);
    assertEquals(location.getLineNumber(), line);
}
Also used : NodeJsOutput(org.eclipse.che.plugin.nodejsdbg.server.NodeJsOutput) Location(org.eclipse.che.api.debug.shared.model.Location) Test(org.testng.annotations.Test)

Example 18 with Location

use of org.eclipse.che.api.debug.shared.model.Location 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 19 with Location

use of org.eclipse.che.api.debug.shared.model.Location 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 20 with Location

use of org.eclipse.che.api.debug.shared.model.Location 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)

Aggregations

Location (org.eclipse.che.api.debug.shared.model.Location)26 LocationImpl (org.eclipse.che.api.debug.shared.model.impl.LocationImpl)11 BreakpointImpl (org.eclipse.che.api.debug.shared.model.impl.BreakpointImpl)9 Test (org.testng.annotations.Test)9 Breakpoint (org.eclipse.che.api.debug.shared.model.Breakpoint)8 DebuggerException (org.eclipse.che.api.debugger.server.exceptions.DebuggerException)6 Matcher (java.util.regex.Matcher)4 BreakpointActivatedEventImpl (org.eclipse.che.api.debug.shared.model.impl.event.BreakpointActivatedEventImpl)4 ArrayList (java.util.ArrayList)3 BreakpointActivatedEvent (org.eclipse.che.api.debug.shared.model.event.BreakpointActivatedEvent)3 DebuggerEvent (org.eclipse.che.api.debug.shared.model.event.DebuggerEvent)3 SuspendEventImpl (org.eclipse.che.api.debug.shared.model.impl.event.SuspendEventImpl)3 IOException (java.io.IOException)2 SuspendEvent (org.eclipse.che.api.debug.shared.model.event.SuspendEvent)2 GdbParseException (org.eclipse.che.plugin.gdb.server.exception.GdbParseException)2 GdbTerminatedException (org.eclipse.che.plugin.gdb.server.exception.GdbTerminatedException)2 ExpressionParser (org.eclipse.che.plugin.jdb.server.expression.ExpressionParser)2 NodeJsOutput (org.eclipse.che.plugin.nodejsdbg.server.NodeJsOutput)2 JsonElement (com.google.gson.JsonElement)1 JsonObject (com.google.gson.JsonObject)1