use of org.eclipse.che.api.debug.shared.model.StackFrameDump in project che by eclipse.
the class JavaDebuggerTest method testSetAndGetValue.
@Test(priority = 11)
public void testSetAndGetValue() throws Exception {
assertEquals(debugger.getValue(new VariablePathImpl("test")).getValue(), "\"hello\"");
assertEquals(debugger.getValue(new VariablePathImpl("msg")).getValue(), "\"Hello, debugger!\"");
debugger.setValue(new VariableImpl("\"new hello\"", (new VariablePathImpl("test"))));
assertEquals(debugger.getValue(new VariablePathImpl("test")).getValue(), "\"new hello\"");
StackFrameDump stackFrameDump = debugger.dumpStackFrame();
Set<String> vars = stackFrameDump.getVariables().stream().map(Variable::getName).collect(Collectors.toSet());
assertTrue(vars.contains("args"));
assertTrue(vars.contains("msg"));
assertTrue(vars.contains("test"));
}
use of org.eclipse.che.api.debug.shared.model.StackFrameDump in project che by eclipse.
the class DebuggerPresenter method updateStackFrameDump.
private void updateStackFrameDump() {
Debugger debugger = debuggerManager.getActiveDebugger();
if (debugger != null && executionPoint != null) {
Promise<StackFrameDump> promise = debugger.dumpStackFrame();
promise.then(new Operation<StackFrameDump>() {
@Override
public void apply(StackFrameDump arg) throws OperationException {
variables = new ArrayList<>();
variables.addAll(arg.getFields());
variables.addAll(arg.getVariables());
view.setVariables(variables);
}
}).catchError(new Operation<PromiseError>() {
@Override
public void apply(PromiseError arg) throws OperationException {
Log.error(DebuggerPresenter.class, arg.getCause());
}
});
}
}
use of org.eclipse.che.api.debug.shared.model.StackFrameDump in project che by eclipse.
the class DebuggerTest method testGetStackFrameDump.
@Test
public void testGetStackFrameDump() throws Exception {
Promise<StackFrameDumpDto> promiseStackFrameDump = mock(Promise.class);
StackFrameDumpDto mockStackFrameDumpDto = mock(StackFrameDumpDto.class);
final String json = "json";
doReturn(json).when(dtoFactory).toJson(mockStackFrameDumpDto);
doReturn(promiseStackFrameDump).when(service).getStackFrameDump(SESSION_ID);
doReturn(promiseStackFrameDump).when(promiseStackFrameDump).then((Function<StackFrameDumpDto, Object>) any());
doReturn(promiseStackFrameDump).when(promiseStackFrameDump).catchError((Operation<PromiseError>) any());
Promise<StackFrameDump> result = debugger.dumpStackFrame();
assertEquals(promiseStackFrameDump, result);
}
use of org.eclipse.che.api.debug.shared.model.StackFrameDump in project che by eclipse.
the class GdbDebuggerTest method doSetAndGetValues.
private void doSetAndGetValues() throws DebuggerException {
VariablePath variablePath = new VariablePathImpl("i");
Variable variable = new VariableImpl("int", "i", "2", true, variablePath, Collections.emptyList(), false);
SimpleValue value = gdbDebugger.getValue(variablePath);
assertEquals(value.getValue(), "0");
gdbDebugger.setValue(variable);
value = gdbDebugger.getValue(variablePath);
assertEquals(value.getValue(), "2");
String expression = gdbDebugger.evaluate("i");
assertEquals(expression, "2");
expression = gdbDebugger.evaluate("10 + 10");
assertEquals(expression, "20");
StackFrameDump stackFrameDump = gdbDebugger.dumpStackFrame();
assertTrue(stackFrameDump.getFields().isEmpty());
assertEquals(stackFrameDump.getVariables().size(), 1);
assertEquals(stackFrameDump.getVariables().get(0).getName(), "i");
assertEquals(stackFrameDump.getVariables().get(0).getValue(), "2");
assertEquals(stackFrameDump.getVariables().get(0).getType(), "int");
}
use of org.eclipse.che.api.debug.shared.model.StackFrameDump 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");
}
Aggregations