Search in sources :

Example 16 with Breakpoint

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

the class ZendDebugger method start.

@Override
public void start(StartAction action) throws DebuggerException {
    // Initialize connection daemon thread
    debugConnection.connect();
    for (Breakpoint breakpoint : action.getBreakpoints()) {
        breakpoints.put(breakpoint, ZendDbgBreakpoint.create(breakpoint, debugLocationHandler));
    }
    LOG.debug("Connect {}:{}", debugSettings.getClientHostIP(), debugSettings.getDebugPort());
}
Also used : Breakpoint(org.eclipse.che.api.debug.shared.model.Breakpoint)

Example 17 with Breakpoint

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

the class ZendDebugger method deleteBreakpoint.

@Override
public void deleteBreakpoint(Location location) throws DebuggerException {
    Breakpoint matchingBreakpoint = null;
    for (Breakpoint breakpoint : breakpoints.keySet()) {
        if (breakpoint.getLocation().equals(location)) {
            matchingBreakpoint = breakpoint;
            break;
        }
    }
    if (matchingBreakpoint == null) {
        return;
    }
    ZendDbgBreakpoint dbgBreakpoint = breakpoints.remove(matchingBreakpoint);
    // Unregister breakpoint if it was registered in active session
    if (breakpointIds.containsKey(dbgBreakpoint)) {
        int breakpointId = breakpointIds.remove(dbgBreakpoint);
        sendDeleteBreakpoint(breakpointId);
    }
}
Also used : Breakpoint(org.eclipse.che.api.debug.shared.model.Breakpoint) Breakpoint(org.eclipse.che.api.debug.shared.model.Breakpoint)

Example 18 with Breakpoint

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

the class BreakpointActivatedEventImpl method hashCode.

@Override
public int hashCode() {
    int result = super.hashCode();
    result = 31 * result + (breakpoint != null ? breakpoint.hashCode() : 0);
    return result;
}
Also used : Breakpoint(org.eclipse.che.api.debug.shared.model.Breakpoint)

Example 19 with Breakpoint

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

the class ZendDbgSessionTest method testBreakpoints.

@Test(groups = { "zendDbg" }, dependsOnGroups = { "checkPHP" })
public void testBreakpoints() throws Exception {
    List<Breakpoint> breakpoints = new ArrayList<>();
    Breakpoint bp1 = new BreakpointImpl(ZendDbgLocationHandler.createDBG(dbgHelloFile, 4));
    Breakpoint bp2 = new BreakpointImpl(ZendDbgLocationHandler.createDBG(dbgHelloFile, 8));
    breakpoints.add(bp1);
    breakpoints.add(bp2);
    triggerSession(dbgHelloFile, getDbgSettings(true, false), breakpoints);
    awaitBreakpointActivated(bp1);
    awaitBreakpointActivated(bp2);
    awaitSuspend(dbgHelloFile, 2);
    Breakpoint bp3 = new BreakpointImpl(ZendDbgLocationHandler.createDBG(dbgClassesFile, 10));
    debugger.addBreakpoint(bp3);
    awaitBreakpointActivated(bp3);
    Breakpoint bp4 = new BreakpointImpl(ZendDbgLocationHandler.createDBG(dbgClassesFile, 16));
    debugger.addBreakpoint(bp4);
    awaitBreakpointActivated(bp4);
    debugger.deleteBreakpoint(ZendDbgLocationHandler.createDBG(dbgHelloFile, 8));
    debugger.deleteBreakpoint(ZendDbgLocationHandler.createDBG(dbgClassesFile, 16));
    assertEquals(debugger.getAllBreakpoints().size(), 2);
    debugger.deleteAllBreakpoints();
    assertTrue(debugger.getAllBreakpoints().isEmpty());
}
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) Test(org.testng.annotations.Test)

Example 20 with Breakpoint

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

the class ZendDbgSessionTest method testGetValue.

@Test(groups = { "zendDbg" }, dependsOnGroups = { "checkPHP" })
public void testGetValue() throws Exception {
    List<Breakpoint> breakpoints = new ArrayList<>();
    Breakpoint bp1 = new BreakpointImpl(ZendDbgLocationHandler.createDBG(dbgClassesFile, 16));
    breakpoints.add(bp1);
    triggerSession(dbgHelloFile, getDbgSettings(false, false), breakpoints);
    awaitBreakpointActivated(bp1);
    awaitSuspend(dbgClassesFile, 16);
    debugger.dumpStackFrame();
    VariablePath variablePath = new VariablePathImpl("0");
    SimpleValue simpleValue = debugger.getValue(variablePath);
    assertEquals(simpleValue.getVariables().size(), 3);
    List<String> path = Arrays.asList("0", "0");
    variablePath = new VariablePathImpl(path);
    simpleValue = debugger.getValue(variablePath);
    assertEquals(simpleValue.getValue(), "\"A\"");
    path = Arrays.asList("0", "1");
    variablePath = new VariablePathImpl(path);
    simpleValue = debugger.getValue(variablePath);
    assertEquals(simpleValue.getValue(), "123");
    path = Arrays.asList("0", "2");
    variablePath = new VariablePathImpl(path);
    simpleValue = debugger.getValue(variablePath);
    assertEquals(simpleValue.getValue(), "array [3]");
}
Also used : Breakpoint(org.eclipse.che.api.debug.shared.model.Breakpoint) VariablePath(org.eclipse.che.api.debug.shared.model.VariablePath) BreakpointImpl(org.eclipse.che.api.debug.shared.model.impl.BreakpointImpl) VariablePathImpl(org.eclipse.che.api.debug.shared.model.impl.VariablePathImpl) ArrayList(java.util.ArrayList) SimpleValue(org.eclipse.che.api.debug.shared.model.SimpleValue) Test(org.testng.annotations.Test)

Aggregations

Breakpoint (org.eclipse.che.api.debug.shared.model.Breakpoint)32 Test (org.testng.annotations.Test)14 BreakpointImpl (org.eclipse.che.api.debug.shared.model.impl.BreakpointImpl)13 ArrayList (java.util.ArrayList)11 Location (org.eclipse.che.api.debug.shared.model.Location)7 LocationImpl (org.eclipse.che.api.debug.shared.model.impl.LocationImpl)7 DebuggerException (org.eclipse.che.api.debugger.server.exceptions.DebuggerException)5 BreakpointActivatedEvent (org.eclipse.che.api.debug.shared.model.event.BreakpointActivatedEvent)4 BreakpointRequest (com.sun.jdi.request.BreakpointRequest)3 DebuggerEvent (org.eclipse.che.api.debug.shared.model.event.DebuggerEvent)3 GdbContinue (org.eclipse.che.plugin.gdb.server.parser.GdbContinue)3 ClassPrepareRequest (com.sun.jdi.request.ClassPrepareRequest)2 EventRequestManager (com.sun.jdi.request.EventRequestManager)2 IOException (java.io.IOException)2 StackFrameDump (org.eclipse.che.api.debug.shared.model.StackFrameDump)2 Variable (org.eclipse.che.api.debug.shared.model.Variable)2 VariableImpl (org.eclipse.che.api.debug.shared.model.impl.VariableImpl)2 VariablePathImpl (org.eclipse.che.api.debug.shared.model.impl.VariablePathImpl)2 ResumeActionImpl (org.eclipse.che.api.debug.shared.model.impl.action.ResumeActionImpl)2 BreakpointActivatedEventImpl (org.eclipse.che.api.debug.shared.model.impl.event.BreakpointActivatedEventImpl)2