Search in sources :

Example 1 with MDExpression

use of com.oracle.truffle.llvm.parser.metadata.MDExpression in project sulong by graalvm.

the class LLVMRuntimeDebugInformation method registerStaticDebugSymbols.

void registerStaticDebugSymbols(FunctionDefinition fn) {
    if (!isEnabled) {
        return;
    }
    for (SourceVariable local : fn.getSourceFunction().getVariables()) {
        if (local.isSingleDeclaration()) {
            final DbgDeclareInstruction dbg = local.getSingleDeclaration();
            FrameSlot frameSlot = null;
            if (dbg.getValue() instanceof AllocateInstruction) {
                frameSlot = frame.findFrameSlot(((AllocateInstruction) dbg.getValue()).getName());
            }
            if (frameSlot == null) {
                continue;
            }
            final LLVMSourceSymbol symbol = local.getSymbol();
            final LLVMFrameValueAccess alloc = factory.createDebugFrameValue(frameSlot, true);
            notNullableSlots.add(frameSlot);
            context.getSourceContext().registerFrameValue(symbol, alloc);
            local.addStaticValue();
        } else if (local.isSingleValue()) {
            final DbgValueInstruction dbg = local.getSingleValue();
            final MDExpression expr = dbg.getExpression();
            final SymbolImpl value = dbg.getValue();
            if (expr.getElementCount() != 0) {
                continue;
            }
            final boolean mustDereference = mustDereferenceValue(expr, local.getSourceType(), value);
            staticValueAccessVisitor.registerStaticAccess(local, value, mustDereference);
        }
    }
}
Also used : SourceVariable(com.oracle.truffle.llvm.parser.metadata.debuginfo.SourceVariable) DbgDeclareInstruction(com.oracle.truffle.llvm.parser.model.symbols.instructions.DbgDeclareInstruction) LLVMFrameValueAccess(com.oracle.truffle.llvm.runtime.debug.scope.LLVMFrameValueAccess) SymbolImpl(com.oracle.truffle.llvm.parser.model.SymbolImpl) AllocateInstruction(com.oracle.truffle.llvm.parser.model.symbols.instructions.AllocateInstruction) FrameSlot(com.oracle.truffle.api.frame.FrameSlot) DbgValueInstruction(com.oracle.truffle.llvm.parser.model.symbols.instructions.DbgValueInstruction) MDExpression(com.oracle.truffle.llvm.parser.metadata.MDExpression) LLVMSourceSymbol(com.oracle.truffle.llvm.runtime.debug.LLVMSourceSymbol)

Aggregations

FrameSlot (com.oracle.truffle.api.frame.FrameSlot)1 MDExpression (com.oracle.truffle.llvm.parser.metadata.MDExpression)1 SourceVariable (com.oracle.truffle.llvm.parser.metadata.debuginfo.SourceVariable)1 SymbolImpl (com.oracle.truffle.llvm.parser.model.SymbolImpl)1 AllocateInstruction (com.oracle.truffle.llvm.parser.model.symbols.instructions.AllocateInstruction)1 DbgDeclareInstruction (com.oracle.truffle.llvm.parser.model.symbols.instructions.DbgDeclareInstruction)1 DbgValueInstruction (com.oracle.truffle.llvm.parser.model.symbols.instructions.DbgValueInstruction)1 LLVMSourceSymbol (com.oracle.truffle.llvm.runtime.debug.LLVMSourceSymbol)1 LLVMFrameValueAccess (com.oracle.truffle.llvm.runtime.debug.scope.LLVMFrameValueAccess)1