Search in sources :

Example 21 with Value

use of com.sun.jdi.Value in project intellij-community by JetBrains.

the class LabelRenderer method calcLabel.

public String calcLabel(ValueDescriptor descriptor, EvaluationContext evaluationContext, DescriptorLabelListener labelListener) throws EvaluateException {
    final Value value = descriptor.getValue();
    String result;
    final DebugProcess debugProcess = evaluationContext.getDebugProcess();
    if (value != null) {
        try {
            final ExpressionEvaluator evaluator = myLabelExpression.getEvaluator(debugProcess.getProject());
            if (!debugProcess.isAttached()) {
                throw EvaluateExceptionUtil.PROCESS_EXITED;
            }
            EvaluationContext thisEvaluationContext = evaluationContext.createEvaluationContext(value);
            Value labelValue = evaluator.evaluate(thisEvaluationContext);
            result = DebuggerUtils.getValueAsString(thisEvaluationContext, labelValue);
        } catch (final EvaluateException ex) {
            throw new EvaluateException(DebuggerBundle.message("error.unable.to.evaluate.expression") + " " + ex.getMessage(), ex);
        }
    } else {
        //noinspection HardCodedStringLiteral
        result = "null";
    }
    return result;
}
Also used : DebugProcess(com.intellij.debugger.engine.DebugProcess) EvaluateException(com.intellij.debugger.engine.evaluation.EvaluateException) Value(com.sun.jdi.Value) EvaluationContext(com.intellij.debugger.engine.evaluation.EvaluationContext) ExpressionEvaluator(com.intellij.debugger.engine.evaluation.expression.ExpressionEvaluator)

Example 22 with Value

use of com.sun.jdi.Value in project otertool by wuntee.

the class Testing method printBreakpointData.

public static void printBreakpointData(BreakpointEvent e) throws IncompatibleThreadStateException, AbsentInformationException {
    System.out.println(e.location());
    System.out.println("Line number: " + e.location().lineNumber());
    System.out.println("Code index: " + e.location().codeIndex());
    try {
        System.out.println("SourceName: " + e.location().sourceName());
    } catch (AbsentInformationException e1) {
        System.out.println("SourceName: UNAVAILABLE");
    }
    System.out.println("Declaration type: " + e.location().declaringType());
    System.out.println("Method: " + e.location().method());
    System.out.println("Stack frames:");
    for (StackFrame sf : e.thread().frames()) {
        System.out.println("\t" + sf.toString());
        System.out.println("\t   Visible Variables:");
        for (LocalVariable lv : sf.visibleVariables()) {
            System.out.println("\t\t--");
            System.out.println("\t\tName: " + lv.name());
            System.out.println("\t\tType: " + lv.typeName());
            Value lvValue = sf.getValue(lv);
            if (lvValue != null) {
                System.out.println("\t\tValue: " + lvValue);
                System.out.println("\t\tValue Type:" + lvValue.type());
                System.out.println("\t\ttoString: " + lv);
            }
        }
        System.out.println("\t   Argument Values:");
        for (Value lv : sf.getArgumentValues()) {
            System.out.println("\t\t--");
            System.out.println("\t\t" + lv.toString());
        }
    }
}
Also used : AbsentInformationException(com.sun.jdi.AbsentInformationException) StackFrame(com.sun.jdi.StackFrame) LocalVariable(com.sun.jdi.LocalVariable) Value(com.sun.jdi.Value)

Example 23 with Value

use of com.sun.jdi.Value in project android by JetBrains.

the class AndroidTypedIntegerRenderer method calcLabel.

@Override
public String calcLabel(ValueDescriptor descriptor, final EvaluationContext evaluationContext, final DescriptorLabelListener listener) throws EvaluateException {
    final Value value = descriptor.getValue();
    BatchEvaluator.getBatchEvaluator(evaluationContext.getDebugProcess()).invoke(new ResolveTypedIntegerCommand(descriptor, evaluationContext, value, listener));
    return value.toString();
}
Also used : Value(com.sun.jdi.Value)

Aggregations

Value (com.sun.jdi.Value)23 BooleanValue (com.sun.jdi.BooleanValue)9 PrimitiveValue (com.sun.jdi.PrimitiveValue)7 EvaluateException (com.intellij.debugger.engine.evaluation.EvaluateException)6 ObjectReference (com.sun.jdi.ObjectReference)5 ExpressionEvaluator (com.intellij.debugger.engine.evaluation.expression.ExpressionEvaluator)4 IntegerValue (com.sun.jdi.IntegerValue)4 ValueDescriptor (com.intellij.debugger.ui.tree.ValueDescriptor)3 DoubleValue (com.sun.jdi.DoubleValue)3 FloatValue (com.sun.jdi.FloatValue)3 LongValue (com.sun.jdi.LongValue)3 SourcePosition (com.intellij.debugger.SourcePosition)2 EvaluationContext (com.intellij.debugger.engine.evaluation.EvaluationContext)2 DebuggerSession (com.intellij.debugger.impl.DebuggerSession)2 NodeDescriptor (com.intellij.debugger.ui.tree.NodeDescriptor)2 Project (com.intellij.openapi.project.Project)2 AbstractValueHint (com.intellij.xdebugger.impl.evaluate.quick.common.AbstractValueHint)2 AbsentInformationException (com.sun.jdi.AbsentInformationException)2 Method (com.sun.jdi.Method)2 StackFrame (com.sun.jdi.StackFrame)2