Search in sources :

Example 11 with BreakpointImpl

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

the class NodeJsDebuggerTest method testManageBreakpoints.

@Test
public void testManageBreakpoints() throws Exception {
    List<Breakpoint> breakpoints = debugger.getAllBreakpoints();
    assertEquals(breakpoints.size(), 1);
    debugger.addBreakpoint(new BreakpointImpl(new LocationImpl("app.js", 2)));
    ArgumentCaptor<BreakpointActivatedEvent> breakpointActivated = ArgumentCaptor.forClass(BreakpointActivatedEvent.class);
    verify(callback).onEvent(breakpointActivated.capture());
    BreakpointActivatedEvent event = breakpointActivated.getValue();
    Breakpoint breakpoint = event.getBreakpoint();
    assertEquals(breakpoint.getLocation().getTarget(), "app.js");
    assertEquals(breakpoint.getLocation().getLineNumber(), 2);
    debugger.addBreakpoint(new BreakpointImpl(new LocationImpl("app.js", 5)));
    breakpoints = debugger.getAllBreakpoints();
    assertEquals(breakpoints.size(), 3);
    debugger.deleteBreakpoint(new LocationImpl("app.js", 2));
    breakpoints = debugger.getAllBreakpoints();
    assertEquals(breakpoints.size(), 2);
    debugger.deleteAllBreakpoints();
    breakpoints = debugger.getAllBreakpoints();
    assertEquals(breakpoints.size(), 1);
}
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) Test(org.testng.annotations.Test)

Example 12 with BreakpointImpl

use of org.eclipse.che.api.debug.shared.model.impl.BreakpointImpl 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 13 with BreakpointImpl

use of org.eclipse.che.api.debug.shared.model.impl.BreakpointImpl 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 14 with BreakpointImpl

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

the class JavaDebuggerTest method testGetAllBreakpoints.

@Test(priority = 8)
public void testGetAllBreakpoints() throws Exception {
    assertFalse(debugger.getAllBreakpoints().isEmpty());
    debugger.deleteAllBreakpoints();
    assertTrue(debugger.getAllBreakpoints().isEmpty());
    debugger.addBreakpoint(new BreakpointImpl(new LocationImpl("com.HelloWorld", 18), false, null));
    DebuggerEvent debuggerEvent = events.take();
    assertTrue(debuggerEvent instanceof BreakpointActivatedEvent);
    assertEquals(debugger.getAllBreakpoints().size(), 1);
    Breakpoint breakpoint = debugger.getAllBreakpoints().get(0);
    assertEquals(breakpoint.getLocation().getLineNumber(), 18);
    assertEquals(breakpoint.getLocation().getTarget(), "com.HelloWorld");
    assertTrue(breakpoint.isEnabled());
}
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) Test(org.testng.annotations.Test)

Example 15 with BreakpointImpl

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

the class ZendDbgSessionTest method testVariables.

@Test(groups = { "zendDbg" }, dependsOnGroups = { "checkPHP" })
public void testVariables() throws Exception {
    List<Breakpoint> breakpoints = new ArrayList<>();
    Breakpoint bp1 = new BreakpointImpl(ZendDbgLocationHandler.createDBG(dbgClassesFile, 16));
    Breakpoint bp2 = new BreakpointImpl(ZendDbgLocationHandler.createDBG(dbgClassesFile, 25));
    breakpoints.add(bp1);
    breakpoints.add(bp2);
    triggerSession(dbgHelloFile, getDbgSettings(false, false), breakpoints);
    awaitBreakpointActivated(bp1);
    awaitBreakpointActivated(bp2);
    awaitSuspend(dbgClassesFile, 16);
    StackFrameDump stackFrameDump = debugger.dumpStackFrame();
    assertEquals(stackFrameDump.getVariables().size(), 1);
    assertEquals(stackFrameDump.getVariables().get(0).getName(), "$this");
    assertEquals(stackFrameDump.getVariables().get(0).getValue(), "A");
    assertEquals(stackFrameDump.getVariables().get(0).getType(), "object");
    debugger.resume(new ResumeActionImpl());
    awaitSuspend(dbgClassesFile, 25);
    stackFrameDump = debugger.dumpStackFrame();
    assertEquals(stackFrameDump.getVariables().size(), 3);
    assertEquals(stackFrameDump.getVariables().get(0).getName(), "$this");
    assertEquals(stackFrameDump.getVariables().get(0).getValue(), "B");
    assertEquals(stackFrameDump.getVariables().get(0).getType(), "object");
    assertEquals(stackFrameDump.getVariables().get(1).getName(), "$p");
    assertEquals(stackFrameDump.getVariables().get(1).getValue(), "123");
    assertEquals(stackFrameDump.getVariables().get(1).getType(), "int");
    assertEquals(stackFrameDump.getVariables().get(2).getName(), "$v");
    assertEquals(stackFrameDump.getVariables().get(2).getValue(), "\"B\"");
    assertEquals(stackFrameDump.getVariables().get(2).getType(), "string");
}
Also used : Breakpoint(org.eclipse.che.api.debug.shared.model.Breakpoint) BreakpointImpl(org.eclipse.che.api.debug.shared.model.impl.BreakpointImpl) ArrayList(java.util.ArrayList) StackFrameDump(org.eclipse.che.api.debug.shared.model.StackFrameDump) ResumeActionImpl(org.eclipse.che.api.debug.shared.model.impl.action.ResumeActionImpl) Test(org.testng.annotations.Test)

Aggregations

BreakpointImpl (org.eclipse.che.api.debug.shared.model.impl.BreakpointImpl)17 Breakpoint (org.eclipse.che.api.debug.shared.model.Breakpoint)13 LocationImpl (org.eclipse.che.api.debug.shared.model.impl.LocationImpl)11 Test (org.testng.annotations.Test)10 Location (org.eclipse.che.api.debug.shared.model.Location)9 ArrayList (java.util.ArrayList)7 BreakpointActivatedEvent (org.eclipse.che.api.debug.shared.model.event.BreakpointActivatedEvent)6 DebuggerEvent (org.eclipse.che.api.debug.shared.model.event.DebuggerEvent)5 Matcher (java.util.regex.Matcher)3 ResumeActionImpl (org.eclipse.che.api.debug.shared.model.impl.action.ResumeActionImpl)3 StackFrameDump (org.eclipse.che.api.debug.shared.model.StackFrameDump)2 SuspendEvent (org.eclipse.che.api.debug.shared.model.event.SuspendEvent)2 VariablePathImpl (org.eclipse.che.api.debug.shared.model.impl.VariablePathImpl)2 JsonElement (com.google.gson.JsonElement)1 JsonObject (com.google.gson.JsonObject)1 JsonParser (com.google.gson.JsonParser)1 AbsentInformationException (com.sun.jdi.AbsentInformationException)1 ClassNotPreparedException (com.sun.jdi.ClassNotPreparedException)1 NativeMethodException (com.sun.jdi.NativeMethodException)1 ReferenceType (com.sun.jdi.ReferenceType)1