use of org.eclipse.che.api.debug.shared.model.Breakpoint 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);
}
use of org.eclipse.che.api.debug.shared.model.Breakpoint in project che by eclipse.
the class GdbTest method testTargetRemote.
@Test
public void testTargetRemote() throws Exception {
GdbServer gdbServer = GdbServer.start("localhost", 1111, file);
try {
gdb.file(file);
gdb.targetRemote("localhost", 1111);
gdb.breakpoint(7);
GdbContinue gdbContinue = gdb.cont();
Breakpoint breakpoint = gdbContinue.getBreakpoint();
assertNotNull(breakpoint);
assertEquals(breakpoint.getLocation().getTarget(), "h.cpp");
assertEquals(breakpoint.getLocation().getLineNumber(), 7);
} finally {
gdbServer.stop();
}
}
use of org.eclipse.che.api.debug.shared.model.Breakpoint 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");
}
use of org.eclipse.che.api.debug.shared.model.Breakpoint in project che by eclipse.
the class ZendDbgSessionTest method testSetValue.
@Test(groups = { "zendDbg" }, dependsOnGroups = { "checkPHP" })
public void testSetValue() throws Exception {
List<Breakpoint> breakpoints = new ArrayList<>();
Breakpoint bp1 = new BreakpointImpl(ZendDbgLocationHandler.createDBG(dbgHelloFile, 5));
breakpoints.add(bp1);
triggerSession(dbgHelloFile, getDbgSettings(false, false), breakpoints);
awaitBreakpointActivated(bp1);
awaitSuspend(dbgHelloFile, 5);
StackFrameDump stackFrameDump = debugger.dumpStackFrame();
int lastVar = stackFrameDump.getVariables().size() - 1;
Variable variableToFind = new VariableImpl(null, null, "123", false, new VariablePathImpl(String.valueOf(lastVar)), Collections.emptyList(), false);
debugger.setValue(variableToFind);
assertEquals(stackFrameDump.getVariables().get(lastVar).getValue(), "123");
variableToFind = new VariableImpl(null, null, "\"ABC\"", false, new VariablePathImpl(String.valueOf(lastVar)), Collections.emptyList(), false);
debugger.setValue(variableToFind);
assertEquals(stackFrameDump.getVariables().get(lastVar).getValue(), "\"ABC\"");
}
use of org.eclipse.che.api.debug.shared.model.Breakpoint in project che by eclipse.
the class NodeJsDebugger method start.
@Override
public void start(StartAction action) throws DebuggerException {
try {
for (Breakpoint breakpoint : action.getBreakpoints()) {
Location location = breakpoint.getLocation();
library.setBreakpoint(location.getTarget(), location.getLineNumber());
debuggerCallback.onEvent(new BreakpointActivatedEventImpl(breakpoint));
}
library.backtrace();
} catch (NodeJsDebuggerTerminatedException e) {
disconnect();
throw e;
} catch (NodeJsDebuggerException e) {
throw new DebuggerException("Start error. " + e.getMessage(), e);
}
}
Aggregations