use of com.oracle.truffle.llvm.runtime.debug.LLVMSourceType in project sulong by graalvm.
the class DebugInfoCache method getSourceSymbol.
LLVMSourceSymbol getSourceSymbol(MDBaseNode mdVariable, boolean isGlobal) {
if (parsedVariables.containsKey(mdVariable)) {
return parsedVariables.get(mdVariable);
}
LLVMSourceLocation location = scopeBuilder.buildLocation(mdVariable);
final LLVMSourceType type = typeExtractor.parseType(mdVariable);
final String varName = MDNameExtractor.getName(mdVariable);
final LLVMSourceSymbol symbol = new LLVMSourceSymbol(varName, location, type, isGlobal);
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;
}
use of com.oracle.truffle.llvm.runtime.debug.LLVMSourceType in project sulong by graalvm.
the class DebugInfoFunctionProcessor method initSourceFunction.
private void initSourceFunction(FunctionDefinition function, Source bitcodeSource) {
final MDBaseNode debugInfo = getDebugInfo(function);
LLVMSourceLocation scope = null;
LLVMSourceFunctionType type = null;
if (debugInfo != null) {
scope = cache.buildLocation(debugInfo);
LLVMSourceType actualType = cache.parseType(debugInfo);
if (actualType instanceof LLVMSourceFunctionType) {
type = (LLVMSourceFunctionType) actualType;
}
}
if (scope == null) {
final String sourceText = String.format("%s:%s", bitcodeSource.getName(), function.getName());
final Source irSource = Source.newBuilder(sourceText).mimeType(DIScopeBuilder.getMimeType(null)).name(sourceText).build();
final SourceSection simpleSection = irSource.createSection(1);
scope = LLVMSourceLocation.createBitcodeFunction(function.getName(), simpleSection);
}
final SourceFunction sourceFunction = new SourceFunction(scope, type);
function.setSourceFunction(sourceFunction);
for (SourceVariable local : sourceFunction.getVariables()) {
local.processFragments();
}
}
use of com.oracle.truffle.llvm.runtime.debug.LLVMSourceType in project sulong by graalvm.
the class BasicNodeFactory method registerSourceType.
@Override
public LLVMExpressionNode registerSourceType(FrameSlot valueSlot, LLVMSourceType type) {
LLVMSourceType actual = type.getActualType();
if (actual instanceof LLVMSourcePointerType) {
// only pointer types can contain foreign values
LLVMSourceType base = ((LLVMSourcePointerType) actual).getBaseType();
LLVMInteropType interopType = LLVMInteropType.fromSourceType(base);
if (interopType != null) {
return new LLVMSetInteropTypeNode(valueSlot, interopType);
}
}
return null;
}
Aggregations