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());
}
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);
}
Aggregations