Search in sources :

Example 1 with LLValueData

use of com.jetbrains.cidr.execution.debugger.backend.LLValueData in project intellij-plugins by JetBrains.

the class MotionObjectRenderer method doComputeChildren.

@Override
protected void doComputeChildren(@NotNull EvaluationContext context, @NotNull XCompositeNode container) throws ExecutionException, DebuggerCommandException {
    final Collection<CidrValue> children = new ArrayList<>();
    final LLValue names = getInstanceVariablesNames(context);
    final int count = count(context, names);
    for (int i = 0; i < count; i++) {
        final String selName = EvaluationContext.cast("sel_registerName(\"objectAtIndex:\")", "id");
        final String nameExpr = EvaluationContext.cast("objc_msgSend(" + getSelf(names, context) + ", " + selName + ", " + i + ")", "id");
        final LLValueData name = context.evaluateData(nameExpr);
        final String namePointer = "(char *)[[" + name.getPointer() + " description] UTF8String]";
        final String ivarName = TextUtil.removeQuoting(context.evaluateData(namePointer).getPresentableValue());
        final String ivarExpr = getChildEvaluationExpression(context, ivarName);
        final LLValue ivar = context.evaluate(ivarExpr);
        children.add(new MotionMemberValue(ivar, ivarName, myValue));
    }
    CidrValue.addAllTo(children, container);
}
Also used : MotionMemberValue(org.jetbrains.plugins.ruby.motion.run.MotionMemberValue) LLValue(com.jetbrains.cidr.execution.debugger.backend.LLValue) LLValueData(com.jetbrains.cidr.execution.debugger.backend.LLValueData) ArrayList(java.util.ArrayList) CidrValue(com.jetbrains.cidr.execution.debugger.evaluation.CidrValue)

Example 2 with LLValueData

use of com.jetbrains.cidr.execution.debugger.backend.LLValueData in project intellij-plugins by JetBrains.

the class MotionObjectRenderer method doComputeValueAndEvaluator.

@NotNull
@Override
protected Pair<String, XFullValueEvaluator> doComputeValueAndEvaluator(@NotNull EvaluationContext context) throws ExecutionException, DebuggerCommandException {
    LLValue value = context.evaluate("(char *)[[(id)rb_inspect(" + myValue.getVarData(context).getPointer() + ") description] UTF8String]");
    LLValueData data = context.getData(value);
    return doComputeValueAndEvaluator(context, value, data);
}
Also used : LLValue(com.jetbrains.cidr.execution.debugger.backend.LLValue) LLValueData(com.jetbrains.cidr.execution.debugger.backend.LLValueData) NotNull(org.jetbrains.annotations.NotNull)

Example 3 with LLValueData

use of com.jetbrains.cidr.execution.debugger.backend.LLValueData in project intellij-plugins by JetBrains.

the class MotionValueRendererFactory method createRenderer.

@Nullable
@Override
public ValueRenderer createRenderer(@NotNull FactoryContext context) throws ExecutionException, DebuggerCommandException {
    try {
        LLValueData data = context.getLLValueData();
        if (data.isValidPointer()) {
            context.getEvaluationContext().evaluate(EvaluationContext.cast("rb_inspect(" + EvaluationContext.cast(data.getPointer(), "id") + ")", "id"));
            // we want ObjC renderers for our collections
            // Ruby collections are inheriting from native ones and don't have any useful instance variables
            final ValueRenderer collectionRenderer = new NSCollectionValueRenderer.Factory().createRenderer(context);
            return collectionRenderer != null ? collectionRenderer : new MotionObjectRenderer(context.getPhysicalValue());
        }
    } catch (DebuggerCommandException ignored) {
    }
    return null;
}
Also used : LLValueData(com.jetbrains.cidr.execution.debugger.backend.LLValueData) DebuggerCommandException(com.jetbrains.cidr.execution.debugger.backend.DebuggerCommandException) NSCollectionValueRenderer(com.jetbrains.cidr.execution.debugger.evaluation.renderers.NSCollectionValueRenderer) NSCollectionValueRenderer(com.jetbrains.cidr.execution.debugger.evaluation.renderers.NSCollectionValueRenderer) ValueRenderer(com.jetbrains.cidr.execution.debugger.evaluation.renderers.ValueRenderer) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

LLValueData (com.jetbrains.cidr.execution.debugger.backend.LLValueData)3 LLValue (com.jetbrains.cidr.execution.debugger.backend.LLValue)2 DebuggerCommandException (com.jetbrains.cidr.execution.debugger.backend.DebuggerCommandException)1 CidrValue (com.jetbrains.cidr.execution.debugger.evaluation.CidrValue)1 NSCollectionValueRenderer (com.jetbrains.cidr.execution.debugger.evaluation.renderers.NSCollectionValueRenderer)1 ValueRenderer (com.jetbrains.cidr.execution.debugger.evaluation.renderers.ValueRenderer)1 ArrayList (java.util.ArrayList)1 NotNull (org.jetbrains.annotations.NotNull)1 Nullable (org.jetbrains.annotations.Nullable)1 MotionMemberValue (org.jetbrains.plugins.ruby.motion.run.MotionMemberValue)1