Search in sources :

Example 1 with LLVMDebugObject

use of com.oracle.truffle.llvm.runtime.debug.LLVMDebugObject in project sulong by graalvm.

the class LLVMSourceScope method getVariables.

@TruffleBoundary
protected Object getVariables(Frame frame) {
    final Map<String, LLVMDebugObject> vars = new HashMap<>();
    if (frame != null && !symbols.isEmpty()) {
        for (FrameSlot slot : frame.getFrameDescriptor().getSlots()) {
            if (slot.getIdentifier() instanceof LLVMSourceSymbol && frame.getValue(slot) instanceof LLVMDebugValue) {
                final LLVMSourceSymbol symbol = (LLVMSourceSymbol) slot.getIdentifier();
                final LLVMDebugObject value = ((LLVMDebugValue) frame.getValue(slot)).getValue(symbol);
                if (symbols.contains(symbol)) {
                    vars.put(symbol.getName(), value);
                }
            }
        }
    }
    for (LLVMSourceSymbol symbol : symbols) {
        if (!vars.containsKey(symbol.getName())) {
            LLVMDebugValue dbgVal = context.getStatic(symbol);
            if (dbgVal == null) {
                final LLVMFrameValueAccess allocation = context.getFrameValue(symbol);
                if (allocation != null && frame != null) {
                    dbgVal = allocation.getValue(frame);
                }
            }
            if (dbgVal == null) {
                dbgVal = LLVMDebugValue.UNAVAILABLE;
            }
            vars.put(symbol.getName(), dbgVal.getValue(symbol));
        }
    }
    return new LLVMSourceScopeVariables(vars);
}
Also used : LLVMDebugObject(com.oracle.truffle.llvm.runtime.debug.LLVMDebugObject) FrameSlot(com.oracle.truffle.api.frame.FrameSlot) HashMap(java.util.HashMap) LLVMSourceSymbol(com.oracle.truffle.llvm.runtime.debug.LLVMSourceSymbol) LLVMDebugValue(com.oracle.truffle.llvm.runtime.debug.LLVMDebugValue) TruffleBoundary(com.oracle.truffle.api.CompilerDirectives.TruffleBoundary)

Aggregations

TruffleBoundary (com.oracle.truffle.api.CompilerDirectives.TruffleBoundary)1 FrameSlot (com.oracle.truffle.api.frame.FrameSlot)1 LLVMDebugObject (com.oracle.truffle.llvm.runtime.debug.LLVMDebugObject)1 LLVMDebugValue (com.oracle.truffle.llvm.runtime.debug.LLVMDebugValue)1 LLVMSourceSymbol (com.oracle.truffle.llvm.runtime.debug.LLVMSourceSymbol)1 HashMap (java.util.HashMap)1