Breakpoints in custom JVM Languages (C, Fortran)


I work on a set of compiler tools for the Renjin project, which includes a tool that generates class files from C and Fortran sources.

The resulting classfiles include appropriate source and line number references, which are visible in the IntelliJ debugger, but IntelliJ doesn't seem to be able to make the link between the source reference (e.g. "fft.c") and the source file.

I've added a JavaDebugAware extension point to our IntelilJ plugin, so I can set breakpoints in the editor for C files, but they are also not respected during debugging.

One potential problem is that the source files are not in the standard java package layout. For example, the source file "fft.c" is located in "src/fft.c" relative to the project root, but is compiled to "org/renjin/stats/fft__.class" .

How can I help IntelliJ connect the source file to the resulting class file? 

Thanks in advance,



Hi, you may need to implement your own com.intellij.debugger.PositionManager to map locations back to the original sources


Great, thanks, this seems to be the right track. I've got everything implemented except getSourcePosition().

location.sourceName() return "fft.c" correctly, but I can't seem to find the corresponding VirtualFile:

Project project = debugProcess.getSearchScope().getProject();

Collection<VirtualFile> virtualFiles = FilenameIndex.getVirtualFilesByName(project, sourceName, true, debugProcess.getSearchScope());

virtualFiles is always empty.

Is this the right index to use? How do I ensure that .c and .f files are indexed? There are plugins for both file types installed.

Thanks for any tips.



Please try different scope in calling FilenameIndex, e.g.


That was it, it works now. Thanks!!



Please sign in to leave a comment.