Search in sources :

Example 1 with LLVMSourceSymbol

use of com.oracle.truffle.llvm.runtime.debug.scope.LLVMSourceSymbol in project graal by oracle.

the class DebugInfoCache method getSourceSymbol.

LLVMSourceSymbol getSourceSymbol(MDBaseNode mdVariable, boolean isStatic) {
    LLVMSourceSymbol lookup = parsedVariables.get(mdVariable);
    if (lookup != null) {
        return lookup;
    }
    LLVMSourceLocation location = scopeBuilder.buildLocation(mdVariable);
    final LLVMSourceType type = typeExtractor.parseType(mdVariable);
    final String varName = MDNameExtractor.getName(mdVariable);
    final LLVMSourceSymbol symbol = LLVMSourceSymbol.create(varName, location, type, isStatic);
    parsedVariables.put(mdVariable, symbol);
    if (location != null) {
        // this is currently the line/column where the symbol was declared, we want the
        // scope
        location = location.getParent();
    }
    if (location != null) {
        location.addSymbol(symbol);
    }
    return symbol;
}
Also used : LLVMSourceSymbol(com.oracle.truffle.llvm.runtime.debug.scope.LLVMSourceSymbol) LLVMSourceLocation(com.oracle.truffle.llvm.runtime.debug.scope.LLVMSourceLocation) LLVMSourceType(com.oracle.truffle.llvm.runtime.debug.type.LLVMSourceType)

Example 2 with LLVMSourceSymbol

use of com.oracle.truffle.llvm.runtime.debug.scope.LLVMSourceSymbol in project graal by oracle.

the class DebugInfoModuleProcessor method processSymbols.

private static void processSymbols(List<? extends GlobalValueSymbol> list, DebugInfoCache cache, ModelModule irModel) {
    for (GlobalValueSymbol global : list) {
        MDBaseNode mdGlobal = getDebugInfo(global);
        if (mdGlobal != null) {
            final boolean isGlobal = !(mdGlobal instanceof MDLocalVariable);
            final LLVMSourceSymbol symbol = cache.getSourceSymbol(mdGlobal, isGlobal);
            if (symbol != null) {
                irModel.getSourceGlobals().put(symbol, global);
                global.setSourceSymbol(symbol);
            }
            if (mdGlobal instanceof MDGlobalVariableExpression) {
                mdGlobal = ((MDGlobalVariableExpression) mdGlobal).getGlobalVariable();
            }
            if (mdGlobal instanceof MDGlobalVariable) {
                final MDBaseNode declaration = ((MDGlobalVariable) mdGlobal).getStaticMemberDeclaration();
                if (declaration != MDVoidNode.INSTANCE) {
                    final LLVMSourceType sourceType = cache.parseType(declaration);
                    if (sourceType instanceof LLVMSourceStaticMemberType) {
                        irModel.getSourceStaticMembers().put((LLVMSourceStaticMemberType) sourceType, global);
                    }
                }
            }
        }
    }
}
Also used : MDGlobalVariable(com.oracle.truffle.llvm.parser.metadata.MDGlobalVariable) MDGlobalVariableExpression(com.oracle.truffle.llvm.parser.metadata.MDGlobalVariableExpression) MDLocalVariable(com.oracle.truffle.llvm.parser.metadata.MDLocalVariable) MDBaseNode(com.oracle.truffle.llvm.parser.metadata.MDBaseNode) LLVMSourceSymbol(com.oracle.truffle.llvm.runtime.debug.scope.LLVMSourceSymbol) LLVMSourceType(com.oracle.truffle.llvm.runtime.debug.type.LLVMSourceType) LLVMSourceStaticMemberType(com.oracle.truffle.llvm.runtime.debug.type.LLVMSourceStaticMemberType) GlobalValueSymbol(com.oracle.truffle.llvm.parser.model.symbols.globals.GlobalValueSymbol)

Example 3 with LLVMSourceSymbol

use of com.oracle.truffle.llvm.runtime.debug.scope.LLVMSourceSymbol in project graal by oracle.

the class LLVMRuntimeDebugInformation method getLocalVariablesForIndex.

private Map<LLVMSourceSymbol, Object> getLocalVariablesForIndex(Frame frame, int blockId, int index) {
    initializePredecessors();
    initializeDebugInfo();
    HashMap<LLVMSourceSymbol, List<LocalVarDebugInfo>> info = applyBlockInfo(blockEntryDebugInfo.get(blockId), blockId, index);
    HashMap<LLVMSourceSymbol, Object> values = new HashMap<>();
    for (Map.Entry<LLVMSourceSymbol, List<LocalVarDebugInfo>> entry : info.entrySet()) {
        // process all debug info entries for this variable
        LLVMDebugObjectBuilder builder = null;
        for (LocalVarDebugInfo di : entry.getValue()) {
            builder = di.process(builder, frame);
        }
        values.put(entry.getKey(), builder.getValue(entry.getKey()));
    }
    return values;
}
Also used : LLVMDebugObjectBuilder(com.oracle.truffle.llvm.runtime.debug.value.LLVMDebugObjectBuilder) HashMap(java.util.HashMap) LLVMSourceSymbol(com.oracle.truffle.llvm.runtime.debug.scope.LLVMSourceSymbol) ArrayList(java.util.ArrayList) List(java.util.List) HashMap(java.util.HashMap) Map(java.util.Map)

Example 4 with LLVMSourceSymbol

use of com.oracle.truffle.llvm.runtime.debug.scope.LLVMSourceSymbol in project graal by oracle.

the class DebugInfoFunctionProcessor method getVariable.

private SourceVariable getVariable(FunctionDefinition function, VoidCallInstruction call, int mdLocalArgIndex, int mdExprArgIndex) {
    final SymbolImpl varSymbol = getArg(call, mdLocalArgIndex);
    if (varSymbol instanceof MetadataSymbol) {
        MDBaseNode mdLocal = ((MetadataSymbol) varSymbol).getNode();
        LLVMSourceSymbol symbol = cache.getSourceSymbol(mdLocal, false);
        attachSourceArgumentInformation(function, call, mdLocalArgIndex, mdExprArgIndex);
        return function.getSourceFunction().getLocal(symbol);
    }
    return null;
}
Also used : SymbolImpl(com.oracle.truffle.llvm.parser.model.SymbolImpl) MetadataSymbol(com.oracle.truffle.llvm.parser.metadata.MetadataSymbol) MDBaseNode(com.oracle.truffle.llvm.parser.metadata.MDBaseNode) LLVMSourceSymbol(com.oracle.truffle.llvm.runtime.debug.scope.LLVMSourceSymbol)

Aggregations

LLVMSourceSymbol (com.oracle.truffle.llvm.runtime.debug.scope.LLVMSourceSymbol)4 MDBaseNode (com.oracle.truffle.llvm.parser.metadata.MDBaseNode)2 LLVMSourceType (com.oracle.truffle.llvm.runtime.debug.type.LLVMSourceType)2 MDGlobalVariable (com.oracle.truffle.llvm.parser.metadata.MDGlobalVariable)1 MDGlobalVariableExpression (com.oracle.truffle.llvm.parser.metadata.MDGlobalVariableExpression)1 MDLocalVariable (com.oracle.truffle.llvm.parser.metadata.MDLocalVariable)1 MetadataSymbol (com.oracle.truffle.llvm.parser.metadata.MetadataSymbol)1 SymbolImpl (com.oracle.truffle.llvm.parser.model.SymbolImpl)1 GlobalValueSymbol (com.oracle.truffle.llvm.parser.model.symbols.globals.GlobalValueSymbol)1 LLVMSourceLocation (com.oracle.truffle.llvm.runtime.debug.scope.LLVMSourceLocation)1 LLVMSourceStaticMemberType (com.oracle.truffle.llvm.runtime.debug.type.LLVMSourceStaticMemberType)1 LLVMDebugObjectBuilder (com.oracle.truffle.llvm.runtime.debug.value.LLVMDebugObjectBuilder)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1