Search in sources :

Example 6 with DebugTick

use of org.develnext.jphp.debug.impl.DebugTick in project jphp by jphp-compiler.

the class EvalCommand method getValue.

public static Memory getValue(Debugger context, String value) {
    DebugTick tick = context.getRegisteredTick();
    Environment environment = new Environment(new CompileScope(tick.getEnvironment().getScope()));
    try {
        return EvalFunctions.eval(environment, tick.getTrace(), tick.getLocals(), "return " + value + ";");
    } catch (Throwable throwable) {
        return null;
    }
}
Also used : DebugTick(org.develnext.jphp.debug.impl.DebugTick) CompileScope(php.runtime.env.CompileScope) Environment(php.runtime.env.Environment)

Example 7 with DebugTick

use of org.develnext.jphp.debug.impl.DebugTick in project jphp by jphp-compiler.

the class PropertyGetCommand method run.

@Override
public void run(Debugger context, CommandArguments args, Document result) {
    DebugTick tick = context.getRegisteredTick();
    Element response = createResponse(args, result);
    response.setAttribute("encoding", "base64");
    String varName = args.get("n");
    if (varName.startsWith("$")) {
        varName = varName.substring(1);
    }
    ArrayMemory locals = tick.getLocals();
    if (!locals.containsKey(varName)) {
        return;
    }
    ContextValueProvider provider = getContextValueProvider(context, result);
    if (provider.getMaxData() != 0 && args.containsKey("m")) {
        try {
            provider.setMaxData(Integer.parseInt(args.get("m")));
        } catch (NumberFormatException e) {
            return;
        }
    }
    Element property = provider.getProperty(null, locals.valueOfIndex(varName));
    response.setAttribute("size", property.getAttribute("size"));
    response.appendChild(property.getFirstChild());
}
Also used : ArrayMemory(php.runtime.memory.ArrayMemory) DebugTick(org.develnext.jphp.debug.impl.DebugTick) ContextValueProvider(org.develnext.jphp.debug.impl.command.support.ContextValueProvider) Element(org.w3c.dom.Element)

Example 8 with DebugTick

use of org.develnext.jphp.debug.impl.DebugTick in project jphp by jphp-compiler.

the class RunCommand method run.

@Override
public void run(Debugger context, CommandArguments args, Document result) {
    DebugTick tick = context.runTicks();
    Element response = createResponse(args, result);
    response.setAttribute("reason", "ok");
    if (tick.getBreakpoint() != null) {
        response.setAttribute("status", "break");
    } else {
        response.setAttribute("status", "stopping");
    }
    if (tick.getTrace() != null) {
        Element message = result.createElement("xdebug:message");
        message.setAttribute("filename", context.getFileName(tick.getTrace().getFileName()));
        message.setAttribute("lineno", String.valueOf(tick.getTrace().getStartLine() + 1));
        response.appendChild(message);
    }
}
Also used : DebugTick(org.develnext.jphp.debug.impl.DebugTick) Element(org.w3c.dom.Element)

Example 9 with DebugTick

use of org.develnext.jphp.debug.impl.DebugTick in project jphp by jphp-compiler.

the class StepIntoCommand method run.

@Override
public void run(Debugger context, CommandArguments args, Document result) {
    DebugTick tick = context.waitTick(Debugger.Step.INTO);
    Element response = createResponse(args, result);
    response.setAttribute("reason", "ok");
    response.setAttribute("status", "break");
    if (tick.getTrace() != null) {
        Element message = result.createElement("xdebug:message");
        message.setAttribute("filename", context.getFileName(tick.getTrace().getFileName()));
        message.setAttribute("lineno", String.valueOf(tick.getTrace().getStartLine() + 1));
        response.appendChild(message);
    }
}
Also used : DebugTick(org.develnext.jphp.debug.impl.DebugTick) Element(org.w3c.dom.Element)

Example 10 with DebugTick

use of org.develnext.jphp.debug.impl.DebugTick in project jphp by jphp-compiler.

the class StepOverCommand method run.

@Override
public void run(Debugger context, CommandArguments args, Document result) {
    DebugTick tick = context.waitTick(Debugger.Step.OVER);
    Element response = createResponse(args, result);
    response.setAttribute("reason", "ok");
    response.setAttribute("status", "break");
    if (tick.getTrace() != null) {
        Element message = result.createElement("xdebug:message");
        message.setAttribute("filename", context.getFileName(tick.getTrace().getFileName()));
        message.setAttribute("lineno", String.valueOf(tick.getTrace().getStartLine() + 1));
        response.appendChild(message);
    }
}
Also used : DebugTick(org.develnext.jphp.debug.impl.DebugTick) Element(org.w3c.dom.Element)

Aggregations

DebugTick (org.develnext.jphp.debug.impl.DebugTick)10 Element (org.w3c.dom.Element)8 ContextValueProvider (org.develnext.jphp.debug.impl.command.support.ContextValueProvider)2 Memory (php.runtime.Memory)2 ArrayMemory (php.runtime.memory.ArrayMemory)2 ArrayList (java.util.ArrayList)1 Debugger (org.develnext.jphp.debug.impl.Debugger)1 Breakpoint (org.develnext.jphp.debug.impl.breakpoint.Breakpoint)1 CallStack (php.runtime.env.CallStack)1 CallStackItem (php.runtime.env.CallStackItem)1 CompileScope (php.runtime.env.CompileScope)1 Environment (php.runtime.env.Environment)1 TraceInfo (php.runtime.env.TraceInfo)1 ForeachIterator (php.runtime.lang.ForeachIterator)1 DoubleMemory (php.runtime.memory.DoubleMemory)1 LongMemory (php.runtime.memory.LongMemory)1 StringMemory (php.runtime.memory.StringMemory)1