Search in sources :

Example 1 with LLVMDebugValue

use of com.oracle.truffle.llvm.runtime.debug.value.LLVMDebugValue in project graal by oracle.

the class DebugExprDereferenceNode method getMemberAndType.

@TruffleBoundary
private Pair<Object, DebugExprType> getMemberAndType(Object executedPointerNode) {
    if (executedPointerNode == null) {
        throw DebugExprException.create(this, "debugObject to dereference is null");
    }
    try {
        LLVMDebuggerValue llvmDebuggerValue = (LLVMDebuggerValue) executedPointerNode;
        Object metaObj = llvmDebuggerValue.resolveMetaObject();
        DebugExprType pointerType = DebugExprType.getTypeFromSymbolTableMetaObject(metaObj);
        if (!pointerType.isPointer()) {
            throw DebugExprException.create(this, llvmDebuggerValue + " is no pointer");
        }
        LLVMSourcePointerType llvmSourcePointerType = (LLVMSourcePointerType) metaObj;
        LLVMSourceType llvmSourceType = llvmSourcePointerType.getBaseType();
        LLVMDebugObject llvmPointerObject = (LLVMDebugObject) executedPointerNode;
        Object llvmPointerValue = llvmPointerObject.getValue();
        Builder builder = CommonNodeFactory.createDebugDeclarationBuilder();
        LLVMDebugValue dereferencedValue = builder.build(llvmPointerValue);
        LLVMDebugObject llvmDebugObject = LLVMDebugObject.create(llvmSourceType, 0L, dereferencedValue, null);
        DebugExprType type = pointerType.getInnerType();
        return Pair.create(type.parse(llvmDebugObject), type);
    } catch (ClassCastException e) {
    // throw cast exception of executedPointerNode (2 lines below)
    }
    throw DebugExprException.create(this, executedPointerNode + " cannot be casted to pointer ");
}
Also used : DebugExprType(com.oracle.truffle.llvm.runtime.debug.debugexpr.parser.DebugExprType) LLVMDebugObject(com.oracle.truffle.llvm.runtime.debug.value.LLVMDebugObject) Builder(com.oracle.truffle.llvm.runtime.debug.value.LLVMDebugValue.Builder) LLVMDebuggerValue(com.oracle.truffle.llvm.runtime.debug.LLVMDebuggerValue) LLVMDebugObject(com.oracle.truffle.llvm.runtime.debug.value.LLVMDebugObject) LLVMSourcePointerType(com.oracle.truffle.llvm.runtime.debug.type.LLVMSourcePointerType) LLVMDebugValue(com.oracle.truffle.llvm.runtime.debug.value.LLVMDebugValue) LLVMSourceType(com.oracle.truffle.llvm.runtime.debug.type.LLVMSourceType) TruffleBoundary(com.oracle.truffle.api.CompilerDirectives.TruffleBoundary)

Example 2 with LLVMDebugValue

use of com.oracle.truffle.llvm.runtime.debug.value.LLVMDebugValue in project graal by oracle.

the class CommonNodeFactory method asDebuggerIRValue.

private static Object asDebuggerIRValue(Object llvmType, Object value, DataLayout dataLayout) {
    final Type type;
    if (llvmType instanceof Type) {
        type = (Type) llvmType;
    } else {
        return null;
    }
    // e.g. debugger symbols
    if (type instanceof MetaType) {
        return null;
    }
    final LLVMSourceType sourceType = LLVMSourceTypeFactory.resolveType(type, dataLayout);
    if (sourceType == null) {
        return null;
    }
    // after frame-nulling the actual vector length does not correspond to the type anymore
    if (value instanceof LLVMVector && ((LLVMVector) value).getLength() == 0) {
        return null;
    }
    // after frame-nulling the actual bitsize does not correspond to the type anymore
    if (value instanceof LLVMIVarBit && ((LLVMIVarBit) value).getBitSize() == 0) {
        return null;
    }
    final LLVMDebugValue debugValue = createDebugValueBuilder().build(value);
    if (debugValue == LLVMDebugValue.UNAVAILABLE) {
        return null;
    }
    return LLVMDebugObject.create(sourceType, 0L, debugValue, null);
}
Also used : VariableBitWidthType(com.oracle.truffle.llvm.runtime.types.VariableBitWidthType) PrimitiveType(com.oracle.truffle.llvm.runtime.types.PrimitiveType) VectorType(com.oracle.truffle.llvm.runtime.types.VectorType) AggregateType(com.oracle.truffle.llvm.runtime.types.AggregateType) PointerType(com.oracle.truffle.llvm.runtime.types.PointerType) FunctionType(com.oracle.truffle.llvm.runtime.types.FunctionType) MetaType(com.oracle.truffle.llvm.runtime.types.MetaType) LLVMSourceType(com.oracle.truffle.llvm.runtime.debug.type.LLVMSourceType) StructureType(com.oracle.truffle.llvm.runtime.types.StructureType) ArrayType(com.oracle.truffle.llvm.runtime.types.ArrayType) VoidType(com.oracle.truffle.llvm.runtime.types.VoidType) LLVMInteropType(com.oracle.truffle.llvm.runtime.interop.access.LLVMInteropType) ForeignToLLVMType(com.oracle.truffle.llvm.runtime.interop.convert.ForeignToLLVM.ForeignToLLVMType) Type(com.oracle.truffle.llvm.runtime.types.Type) LLVMVector(com.oracle.truffle.llvm.runtime.vector.LLVMVector) LLVMDebugValue(com.oracle.truffle.llvm.runtime.debug.value.LLVMDebugValue) LLVMSourceType(com.oracle.truffle.llvm.runtime.debug.type.LLVMSourceType) MetaType(com.oracle.truffle.llvm.runtime.types.MetaType)

Example 3 with LLVMDebugValue

use of com.oracle.truffle.llvm.runtime.debug.value.LLVMDebugValue in project graal by oracle.

the class DebugExprPointerCastNode method getMember.

private Object getMember(Object executedPointerNode, VirtualFrame frame) {
    if (executedPointerNode == null) {
        throw DebugExprException.create(this, "debugObject to dereference is null");
    }
    if (!typeNode.getLLVMSourceType(frame).isPointer()) {
        throw DebugExprException.create(this, "%s is no pointer", executedPointerNode);
    }
    try {
        LLVMSourcePointerType llvmSourcePointerType = (LLVMSourcePointerType) typeNode.getLLVMSourceType(frame);
        LLVMDebugObject llvmPointerObject = (LLVMDebugObject) executedPointerNode;
        Object llvmPointerValue = llvmPointerObject.getValue();
        Builder builder = CommonNodeFactory.createDebugValueBuilder();
        LLVMDebugValue pointerValue = builder.build(llvmPointerValue);
        return LLVMDebugObject.create(llvmSourcePointerType, 0L, pointerValue, null);
    } catch (ClassCastException e) {
        throw DebugExprException.create(this, "%s cannot be casted to pointer ", executedPointerNode);
    }
}
Also used : LLVMDebugObject(com.oracle.truffle.llvm.runtime.debug.value.LLVMDebugObject) Builder(com.oracle.truffle.llvm.runtime.debug.value.LLVMDebugValue.Builder) LLVMSourcePointerType(com.oracle.truffle.llvm.runtime.debug.type.LLVMSourcePointerType) LLVMDebugObject(com.oracle.truffle.llvm.runtime.debug.value.LLVMDebugObject) LLVMDebugValue(com.oracle.truffle.llvm.runtime.debug.value.LLVMDebugValue)

Aggregations

LLVMDebugValue (com.oracle.truffle.llvm.runtime.debug.value.LLVMDebugValue)3 LLVMSourcePointerType (com.oracle.truffle.llvm.runtime.debug.type.LLVMSourcePointerType)2 LLVMSourceType (com.oracle.truffle.llvm.runtime.debug.type.LLVMSourceType)2 LLVMDebugObject (com.oracle.truffle.llvm.runtime.debug.value.LLVMDebugObject)2 Builder (com.oracle.truffle.llvm.runtime.debug.value.LLVMDebugValue.Builder)2 TruffleBoundary (com.oracle.truffle.api.CompilerDirectives.TruffleBoundary)1 LLVMDebuggerValue (com.oracle.truffle.llvm.runtime.debug.LLVMDebuggerValue)1 DebugExprType (com.oracle.truffle.llvm.runtime.debug.debugexpr.parser.DebugExprType)1 LLVMInteropType (com.oracle.truffle.llvm.runtime.interop.access.LLVMInteropType)1 ForeignToLLVMType (com.oracle.truffle.llvm.runtime.interop.convert.ForeignToLLVM.ForeignToLLVMType)1 AggregateType (com.oracle.truffle.llvm.runtime.types.AggregateType)1 ArrayType (com.oracle.truffle.llvm.runtime.types.ArrayType)1 FunctionType (com.oracle.truffle.llvm.runtime.types.FunctionType)1 MetaType (com.oracle.truffle.llvm.runtime.types.MetaType)1 PointerType (com.oracle.truffle.llvm.runtime.types.PointerType)1 PrimitiveType (com.oracle.truffle.llvm.runtime.types.PrimitiveType)1 StructureType (com.oracle.truffle.llvm.runtime.types.StructureType)1 Type (com.oracle.truffle.llvm.runtime.types.Type)1 VariableBitWidthType (com.oracle.truffle.llvm.runtime.types.VariableBitWidthType)1 VectorType (com.oracle.truffle.llvm.runtime.types.VectorType)1