use of com.oracle.truffle.llvm.runtime.debug.LLVMDebuggerValue 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 ");
}
use of com.oracle.truffle.llvm.runtime.debug.LLVMDebuggerValue in project graal by oracle.
the class DebugExprTypeofNode method getLLVMSourceType.
@Specialization
public LLVMSourceType getLLVMSourceType(VirtualFrame frame) {
NodeLibrary nodeLibrary = NodeLibrary.getUncached();
InteropLibrary interopLibrary = InteropLibrary.getUncached();
try {
LLVMDebuggerValue entries = (LLVMDebuggerValue) nodeLibrary.getScope(location, frame, false);
if (interopLibrary.isMemberReadable(entries, name)) {
Object member = interopLibrary.readMember(entries, name);
LLVMDebuggerValue ldv = (LLVMDebuggerValue) member;
Object metaObj = ldv.resolveMetaObject();
return (LLVMSourceType) metaObj;
}
} 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);
}
return LLVMSourceType.UNKNOWN;
}
use of com.oracle.truffle.llvm.runtime.debug.LLVMDebuggerValue in project graal by oracle.
the class DebugExprObjectMemberNode method findMemberAndType.
private Pair<Object, DebugExprType> findMemberAndType(Object baseMember) {
InteropLibrary library = InteropLibrary.getFactory().getUncached();
if (baseMember != null && library.isMemberExisting(baseMember, fieldName)) {
try {
Object member = library.readMember(baseMember, fieldName);
LLVMDebuggerValue ldv = (LLVMDebuggerValue) member;
Object metaObj = ldv.resolveMetaObject();
DebugExprType type = DebugExprType.getTypeFromSymbolTableMetaObject(metaObj);
return Pair.create(member, type);
} catch (UnsupportedMessageException e1) {
throw DebugExprException.symbolNotFound(this, fieldName, baseMember);
} catch (UnknownIdentifierException e1) {
throw DebugExprException.symbolNotFound(this, e1.getUnknownIdentifier(), baseMember);
} catch (ClassCastException e1) {
throw DebugExprException.symbolNotFound(this, fieldName, baseMember);
}
}
throw DebugExprException.symbolNotFound(this, fieldName, baseMember);
}
use of com.oracle.truffle.llvm.runtime.debug.LLVMDebuggerValue 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());
}
Aggregations