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