Search in sources :

Example 1 with LLVMDebugObjectBuilder

use of com.oracle.truffle.llvm.runtime.debug.value.LLVMDebugObjectBuilder in project graal by oracle.

the class LLVMDebuggerScopeFactory method getVariables.

@TruffleBoundary
private LLVMDebuggerScopeEntries getVariables(Frame frame) {
    if (symbols.isEmpty()) {
        return LLVMDebuggerScopeEntries.EMPTY_SCOPE;
    }
    final LLVMDebuggerScopeEntries vars = new LLVMDebuggerScopeEntries(getName());
    LLVMDispatchBasicBlockNode dispatchBlock = LLVMNode.getParent(node, LLVMDispatchBasicBlockNode.class);
    if (frame != null && dispatchBlock != null) {
        LocalVariableDebugInfo debugInfo = dispatchBlock.getDebugInfo();
        Map<LLVMSourceSymbol, Object> localVariables = debugInfo.getLocalVariables(frame, node);
        for (Map.Entry<LLVMSourceSymbol, Object> entry : localVariables.entrySet()) {
            LLVMSourceSymbol symbol = entry.getKey();
            if (symbols.contains(symbol)) {
                vars.add(symbol.getName(), entry.getValue());
            }
        }
    }
    for (LLVMSourceSymbol symbol : symbols) {
        if (!vars.contains(symbol.getName())) {
            LLVMDebugObjectBuilder dbgVal = sourceContext.getStatic(symbol);
            if (dbgVal == null) {
                dbgVal = LLVMDebugObjectBuilder.UNAVAILABLE;
            }
            vars.add(convertIdentifier(symbol.getName(), context), dbgVal.getValue(symbol));
        }
    }
    return vars;
}
Also used : LLVMDebugObjectBuilder(com.oracle.truffle.llvm.runtime.debug.value.LLVMDebugObjectBuilder) LocalVariableDebugInfo(com.oracle.truffle.llvm.runtime.types.symbols.LocalVariableDebugInfo) Map(java.util.Map) LLVMDispatchBasicBlockNode(com.oracle.truffle.llvm.runtime.nodes.control.LLVMDispatchBasicBlockNode) TruffleBoundary(com.oracle.truffle.api.CompilerDirectives.TruffleBoundary)

Example 2 with LLVMDebugObjectBuilder

use of com.oracle.truffle.llvm.runtime.debug.value.LLVMDebugObjectBuilder in project graal by oracle.

the class ParserDriver method createDebugInfo.

private void createDebugInfo(ModelModule model, LLVMSymbolReadResolver symbolResolver) {
    final LLVMSourceContext sourceContext = context.getSourceContext();
    model.getSourceGlobals().forEach((symbol, irValue) -> {
        try {
            final LLVMExpressionNode node = symbolResolver.resolve(irValue);
            final LLVMDebugObjectBuilder value = CommonNodeFactory.createDebugStaticValue(node, irValue instanceof GlobalVariable);
            sourceContext.registerStatic(symbol, value);
        } catch (IllegalStateException e) {
        /*
                 * Cannot resolve symbol for global. Some optimization replace an unused global with
                 * an (unresolved) external to avoid initialization. The external still has debug
                 * info but cannot be resolved. We can safely ignore this here.
                 */
        }
    });
    model.getSourceStaticMembers().forEach(((type, symbol) -> {
        final LLVMExpressionNode node = symbolResolver.resolve(symbol);
        final LLVMDebugObjectBuilder value = CommonNodeFactory.createDebugStaticValue(node, symbol instanceof GlobalVariable);
        type.setValue(value);
    }));
}
Also used : LLVMDebugObjectBuilder(com.oracle.truffle.llvm.runtime.debug.value.LLVMDebugObjectBuilder) ListIterator(java.util.ListIterator) TruffleBoundary(com.oracle.truffle.api.CompilerDirectives.TruffleBoundary) TargetTriple(com.oracle.truffle.llvm.runtime.target.TargetTriple) CommonNodeFactory(com.oracle.truffle.llvm.runtime.CommonNodeFactory) LLVMLinkerException(com.oracle.truffle.llvm.runtime.except.LLVMLinkerException) LLVMParserException(com.oracle.truffle.llvm.runtime.except.LLVMParserException) LLVMContext(com.oracle.truffle.llvm.runtime.LLVMContext) SulongEngineOption(com.oracle.truffle.llvm.runtime.options.SulongEngineOption) TruffleLogger(com.oracle.truffle.api.TruffleLogger) InternalLibraryLocator(com.oracle.truffle.llvm.runtime.LLVMContext.InternalLibraryLocator) ModelModule(com.oracle.truffle.llvm.parser.model.ModelModule) FunctionSymbol(com.oracle.truffle.llvm.parser.model.functions.FunctionSymbol) LoadNativeNode(com.oracle.truffle.llvm.initialization.LoadNativeNode) RootNode(com.oracle.truffle.api.nodes.RootNode) NativeContextExtension(com.oracle.truffle.llvm.runtime.NativeContextExtension) Path(java.nio.file.Path) BinaryParserResult(com.oracle.truffle.llvm.parser.binary.BinaryParserResult) GlobalSymbol(com.oracle.truffle.llvm.parser.model.GlobalSymbol) TruffleFile(com.oracle.truffle.api.TruffleFile) LLVMSourceFileReference(com.oracle.truffle.llvm.runtime.debug.scope.LLVMSourceFileReference) LLVMExpressionNode(com.oracle.truffle.llvm.runtime.nodes.api.LLVMExpressionNode) LLVMAlias(com.oracle.truffle.llvm.runtime.LLVMAlias) LibraryLocator(com.oracle.truffle.llvm.runtime.LibraryLocator) CallTarget(com.oracle.truffle.api.CallTarget) LLVMParserResult(com.oracle.truffle.llvm.parser.LLVMParserResult) LLVMScanner(com.oracle.truffle.llvm.parser.scanner.LLVMScanner) Collectors(java.util.stream.Collectors) GetStackSpaceFactory(com.oracle.truffle.llvm.runtime.GetStackSpaceFactory) LLVMScope(com.oracle.truffle.llvm.runtime.LLVMScope) LLVMDebugObjectBuilder(com.oracle.truffle.llvm.runtime.debug.value.LLVMDebugObjectBuilder) ByteOrder(java.nio.ByteOrder) List(java.util.List) Source(com.oracle.truffle.api.source.Source) ByteSequence(org.graalvm.polyglot.io.ByteSequence) LLVMParserRuntime(com.oracle.truffle.llvm.parser.LLVMParserRuntime) NodeFactory(com.oracle.truffle.llvm.runtime.NodeFactory) GlobalVariable(com.oracle.truffle.llvm.parser.model.symbols.globals.GlobalVariable) BitcodeID(com.oracle.truffle.llvm.runtime.IDGenerater.BitcodeID) PlatformCapability(com.oracle.truffle.llvm.runtime.PlatformCapability) LLVMSymbolReadResolver(com.oracle.truffle.llvm.parser.nodes.LLVMSymbolReadResolver) LLVMGlobal(com.oracle.truffle.llvm.runtime.global.LLVMGlobal) ArrayList(java.util.ArrayList) LLVMFunction(com.oracle.truffle.llvm.runtime.LLVMFunction) LLVMParser(com.oracle.truffle.llvm.parser.LLVMParser) LLVMSourceContext(com.oracle.truffle.llvm.runtime.debug.LLVMSourceContext) LLVMLanguage(com.oracle.truffle.llvm.runtime.LLVMLanguage) DefaultLibraryLocator(com.oracle.truffle.llvm.runtime.DefaultLibraryLocator) DataLayout(com.oracle.truffle.llvm.runtime.datalayout.DataLayout) LoadModulesNode(com.oracle.truffle.llvm.initialization.LoadModulesNode) LLVMFunctionCode(com.oracle.truffle.llvm.runtime.LLVMFunctionCode) TargetDataLayout(com.oracle.truffle.llvm.parser.model.target.TargetDataLayout) Paths(java.nio.file.Paths) BinaryParser(com.oracle.truffle.llvm.parser.binary.BinaryParser) LoadDependencyNode(com.oracle.truffle.llvm.initialization.LoadDependencyNode) TruffleLanguage(com.oracle.truffle.api.TruffleLanguage) GlobalVariable(com.oracle.truffle.llvm.parser.model.symbols.globals.GlobalVariable) LLVMExpressionNode(com.oracle.truffle.llvm.runtime.nodes.api.LLVMExpressionNode) LLVMSourceContext(com.oracle.truffle.llvm.runtime.debug.LLVMSourceContext)

Example 3 with LLVMDebugObjectBuilder

use of com.oracle.truffle.llvm.runtime.debug.value.LLVMDebugObjectBuilder 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)

Aggregations

LLVMDebugObjectBuilder (com.oracle.truffle.llvm.runtime.debug.value.LLVMDebugObjectBuilder)3 TruffleBoundary (com.oracle.truffle.api.CompilerDirectives.TruffleBoundary)2 CallTarget (com.oracle.truffle.api.CallTarget)1 TruffleFile (com.oracle.truffle.api.TruffleFile)1 TruffleLanguage (com.oracle.truffle.api.TruffleLanguage)1 TruffleLogger (com.oracle.truffle.api.TruffleLogger)1 RootNode (com.oracle.truffle.api.nodes.RootNode)1 Source (com.oracle.truffle.api.source.Source)1 LoadDependencyNode (com.oracle.truffle.llvm.initialization.LoadDependencyNode)1 LoadModulesNode (com.oracle.truffle.llvm.initialization.LoadModulesNode)1 LoadNativeNode (com.oracle.truffle.llvm.initialization.LoadNativeNode)1 LLVMParser (com.oracle.truffle.llvm.parser.LLVMParser)1 LLVMParserResult (com.oracle.truffle.llvm.parser.LLVMParserResult)1 LLVMParserRuntime (com.oracle.truffle.llvm.parser.LLVMParserRuntime)1 BinaryParser (com.oracle.truffle.llvm.parser.binary.BinaryParser)1 BinaryParserResult (com.oracle.truffle.llvm.parser.binary.BinaryParserResult)1 GlobalSymbol (com.oracle.truffle.llvm.parser.model.GlobalSymbol)1 ModelModule (com.oracle.truffle.llvm.parser.model.ModelModule)1 FunctionSymbol (com.oracle.truffle.llvm.parser.model.functions.FunctionSymbol)1 GlobalVariable (com.oracle.truffle.llvm.parser.model.symbols.globals.GlobalVariable)1