Search in sources :

Example 6 with VariablePathImpl

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

the class DebuggerService method getValue.

@GET
@Path("{id}/value")
@Produces(MediaType.APPLICATION_JSON)
public SimpleValueDto getValue(@PathParam("id") String sessionId, @Context UriInfo uriInfo) throws DebuggerException {
    List<String> path = new ArrayList<>();
    MultivaluedMap<String, String> parameters = uriInfo.getQueryParameters();
    int i = 0;
    String item;
    while ((item = parameters.getFirst("path" + (i++))) != null) {
        path.add(item);
    }
    VariablePath variablePath = new VariablePathImpl(path);
    return asDto(debuggerManager.getDebugger(sessionId).getValue(variablePath));
}
Also used : VariablePath(org.eclipse.che.api.debug.shared.model.VariablePath) VariablePathImpl(org.eclipse.che.api.debug.shared.model.impl.VariablePathImpl) ArrayList(java.util.ArrayList) Path(javax.ws.rs.Path) VariablePath(org.eclipse.che.api.debug.shared.model.VariablePath) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 7 with VariablePathImpl

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

the class ZendDebugger method sendGetVariables.

private void sendGetVariables() {
    ZendDbgVariables zendVariablesExpression = new ZendDbgVariables(debugExpressionEvaluator);
    zendVariablesExpression.evaluate();
    List<IDbgVariable> variables = new ArrayList<>();
    int variableId = 0;
    for (IDbgExpression zendVariableExpression : zendVariablesExpression.getChildren()) {
        if (VariablesStorage.GLOBALS_VARIABLE.equalsIgnoreCase(zendVariableExpression.getExpression()))
            continue;
        IDbgVariable variable = new ZendDbgVariable(new VariablePathImpl(String.valueOf(variableId++)), zendVariableExpression);
        if (ZendDbgVariableUtils.isThis(zendVariableExpression.getExpression())) {
            // $this always on top
            variables.add(0, variable);
        } else {
            variables.add(variable);
        }
    }
    debugVariableStorage = new VariablesStorage(variables);
}
Also used : IDbgVariable(org.eclipse.che.plugin.zdb.server.variables.IDbgVariable) VariablePathImpl(org.eclipse.che.api.debug.shared.model.impl.VariablePathImpl) IDbgExpression(org.eclipse.che.plugin.zdb.server.expressions.IDbgExpression) ArrayList(java.util.ArrayList) ZendDbgVariables(org.eclipse.che.plugin.zdb.server.variables.ZendDbgVariables) ZendDbgVariable(org.eclipse.che.plugin.zdb.server.variables.ZendDbgVariable) Breakpoint(org.eclipse.che.api.debug.shared.model.Breakpoint)

Example 8 with VariablePathImpl

use of org.eclipse.che.api.debug.shared.model.impl.VariablePathImpl 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\"");
}
Also used : Breakpoint(org.eclipse.che.api.debug.shared.model.Breakpoint) VariableImpl(org.eclipse.che.api.debug.shared.model.impl.VariableImpl) BreakpointImpl(org.eclipse.che.api.debug.shared.model.impl.BreakpointImpl) Variable(org.eclipse.che.api.debug.shared.model.Variable) VariablePathImpl(org.eclipse.che.api.debug.shared.model.impl.VariablePathImpl) ArrayList(java.util.ArrayList) StackFrameDump(org.eclipse.che.api.debug.shared.model.StackFrameDump) Breakpoint(org.eclipse.che.api.debug.shared.model.Breakpoint) Test(org.testng.annotations.Test)

Aggregations

VariablePathImpl (org.eclipse.che.api.debug.shared.model.impl.VariablePathImpl)8 ArrayList (java.util.ArrayList)6 VariablePath (org.eclipse.che.api.debug.shared.model.VariablePath)4 VariableImpl (org.eclipse.che.api.debug.shared.model.impl.VariableImpl)4 Breakpoint (org.eclipse.che.api.debug.shared.model.Breakpoint)3 StackFrameDump (org.eclipse.che.api.debug.shared.model.StackFrameDump)3 Variable (org.eclipse.che.api.debug.shared.model.Variable)3 Test (org.testng.annotations.Test)3 SimpleValue (org.eclipse.che.api.debug.shared.model.SimpleValue)2 BreakpointImpl (org.eclipse.che.api.debug.shared.model.impl.BreakpointImpl)2 IDbgExpression (org.eclipse.che.plugin.zdb.server.expressions.IDbgExpression)2 IOException (java.io.IOException)1 Map (java.util.Map)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1 StackFrameDumpImpl (org.eclipse.che.api.debug.shared.model.impl.StackFrameDumpImpl)1 DebuggerException (org.eclipse.che.api.debugger.server.exceptions.DebuggerException)1 GdbParseException (org.eclipse.che.plugin.gdb.server.exception.GdbParseException)1 GdbTerminatedException (org.eclipse.che.plugin.gdb.server.exception.GdbTerminatedException)1