use of com.oracle.truffle.llvm.runtime.debug.scope.LLVMSourceFileReference in project graal by oracle.
the class LLScanner method findAndScanLLFile.
static LLSourceMap findAndScanLLFile(String bcPath, String pathMappings, LLVMContext context, List<LLVMSourceFileReference> sourceFileReferences) {
if (bcPath == null) {
return NOT_FOUND;
}
final TruffleFile llFile = findLLPathMapping(bcPath, pathMappings, context);
if (llFile == null || !llFile.exists() || !llFile.isReadable()) {
printWarning("Cannot find .ll file for %s (decrease %s logging level to disable this message)\n", bcPath, LLVMContext.llDebugLogger().getName());
return NOT_FOUND;
}
try (BufferedReader llReader = llFile.newBufferedReader()) {
final Source llSource = Source.newBuilder("llvm", llFile).mimeType("text/x-llvmir").build();
final LLSourceMap sourceMap = new LLSourceMap(llSource);
EconomicSet<LLVMSourceFileReference> sourceFileWorkset = createSourceFileSet(sourceFileReferences);
if (sourceFileWorkset == null) {
printVerbose("No source file checksums found in %s\n", bcPath);
}
final LLScanner scanner = new LLScanner(sourceMap, sourceFileWorkset);
for (String line = llReader.readLine(); line != null; line = llReader.readLine()) {
if (!scanner.continueAfter(line)) {
break;
}
}
if (sourceFileWorkset != null && !sourceFileWorkset.isEmpty()) {
printVerbose("Checksums in the .ll file (%s) and the .bc file (%s) do not match!\n", llFile, bcPath);
printVerbose("The following files have changed in the .bc file:\n");
for (LLVMSourceFileReference sourceFileReference : sourceFileWorkset) {
printVerbose(" %s\n", LLVMSourceFileReference.toString(sourceFileReference));
}
}
return sourceMap;
} catch (IOException e) {
throw new LLVMParserException("Error while reading from file: " + llFile.getPath());
}
}
Aggregations