Search in sources :

Example 11 with DebugExprType

use of com.oracle.truffle.llvm.runtime.debug.debugexpr.parser.DebugExprType in project graal by oracle.

the class DebugExprVarNode method findMemberAndType.

private Pair<Object, DebugExprType> findMemberAndType(VirtualFrame frameValue) {
    NodeLibrary nodeLibrary = NodeLibrary.getUncached();
    InteropLibrary interopLibrary = InteropLibrary.getUncached();
    try {
        LLVMDebuggerValue entries = (LLVMDebuggerValue) nodeLibrary.getScope(location, frameValue, true);
        if (interopLibrary.isMemberReadable(entries, name)) {
            Object member = interopLibrary.readMember(entries, name);
            LLVMDebuggerValue ldv = (LLVMDebuggerValue) member;
            Object metaObj = ldv.resolveMetaObject();
            DebugExprType type = DebugExprType.getTypeFromSymbolTableMetaObject(metaObj);
            return Pair.create(member, type);
        }
    } catch (ClassCastException e) {
        // OR metaObj is no primitive type
        throw DebugExprException.create(this, "\"%s\" cannot be casted to a LLVMDebuggerValue", name);
    } catch (UnsupportedMessageException e) {
        // should only happen if hasMembers == false
        throw DebugExprException.symbolNotFound(this, name, null);
    } catch (UnknownIdentifierException e) {
        throw DebugExprException.symbolNotFound(this, e.getUnknownIdentifier(), null);
    }
    // not found: no exception is thrown as this node might be a function name
    return Pair.create(null, DebugExprType.getVoidType());
}
Also used : NodeLibrary(com.oracle.truffle.api.interop.NodeLibrary) DebugExprType(com.oracle.truffle.llvm.runtime.debug.debugexpr.parser.DebugExprType) UnsupportedMessageException(com.oracle.truffle.api.interop.UnsupportedMessageException) UnknownIdentifierException(com.oracle.truffle.api.interop.UnknownIdentifierException) InteropLibrary(com.oracle.truffle.api.interop.InteropLibrary) LLVMDebuggerValue(com.oracle.truffle.llvm.runtime.debug.LLVMDebuggerValue)

Example 12 with DebugExprType

use of com.oracle.truffle.llvm.runtime.debug.debugexpr.parser.DebugExprType in project graal by oracle.

the class DebugExprVarNode method doVariable.

@Specialization
public Object doVariable(VirtualFrame frame) {
    Pair<Object, DebugExprType> pair = findMemberAndType(frame);
    if (pair.getLeft() == null) {
        throw DebugExprException.symbolNotFound(this, name, null);
    }
    Object member = pair.getLeft();
    DebugExprType type = pair.getRight();
    if (type != null && member != null) {
        Object value = type.parse(member);
        if (value != null) {
            return value;
        }
    }
    throw DebugExprException.symbolNotFound(this, name, null);
}
Also used : DebugExprType(com.oracle.truffle.llvm.runtime.debug.debugexpr.parser.DebugExprType) Specialization(com.oracle.truffle.api.dsl.Specialization)

Aggregations

DebugExprType (com.oracle.truffle.llvm.runtime.debug.debugexpr.parser.DebugExprType)12 LLVMExpressionNode (com.oracle.truffle.llvm.runtime.nodes.api.LLVMExpressionNode)5 InteropLibrary (com.oracle.truffle.api.interop.InteropLibrary)3 UnknownIdentifierException (com.oracle.truffle.api.interop.UnknownIdentifierException)3 UnsupportedMessageException (com.oracle.truffle.api.interop.UnsupportedMessageException)3 LLVMDebuggerValue (com.oracle.truffle.llvm.runtime.debug.LLVMDebuggerValue)3 TruffleBoundary (com.oracle.truffle.api.CompilerDirectives.TruffleBoundary)2 ArithmeticOperation (com.oracle.truffle.llvm.runtime.ArithmeticOperation)2 Specialization (com.oracle.truffle.api.dsl.Specialization)1 NodeLibrary (com.oracle.truffle.api.interop.NodeLibrary)1 CompareOperator (com.oracle.truffle.llvm.runtime.CompareOperator)1 LLVMFunctionDescriptor (com.oracle.truffle.llvm.runtime.LLVMFunctionDescriptor)1 LLVMSourcePointerType (com.oracle.truffle.llvm.runtime.debug.type.LLVMSourcePointerType)1 LLVMSourceType (com.oracle.truffle.llvm.runtime.debug.type.LLVMSourceType)1 LLVMDebugObject (com.oracle.truffle.llvm.runtime.debug.value.LLVMDebugObject)1 LLVMDebugValue (com.oracle.truffle.llvm.runtime.debug.value.LLVMDebugValue)1 Builder (com.oracle.truffle.llvm.runtime.debug.value.LLVMDebugValue.Builder)1 LLVMManagedPointer (com.oracle.truffle.llvm.runtime.pointer.LLVMManagedPointer)1 Type (com.oracle.truffle.llvm.runtime.types.Type)1