Working with breakpoints in decompiled source

Hi,

I'm one of the developper of JD-IntelliJ a Java Decompiler plugin for IntelliJ IDEA.

Some of the users require the ability to set breakpoints in the decompiled source, see the #1 and #3 comments : http://plugins.jetbrains.com/plugin/7100?pr=idea&showAllUpdates=true

tl;dr
Actually I have no idea if it's possible in IntelliJ using the plugin infrastructure or if it's up to you guys to make the debugger work with decompiled sources.


More details
In version 0.5 I was extending ContentBasedClassFileProcessor (itself extending ContentBasedFileSubstitutor), but now in version 0.6 I'm using the IntelliJ 13.1 extension point ClassFileDecompilers.Light. I supposed this new extension point will be used for a lot more than navigating decompiled source, and other stuff like quick definition, etc.

So the thing is we added realignment of the source code line of the decompiled source. But when a breakpoint is set the debugger does not use these lines and somehow only sees breakpoint as method breakpoint, and somehow it doesn't get the right code so debugger is unusable with decompiled code.

Should I provide another extension point for the debugger ? Or is it a limitation of the current infrastructure and only you guys can fix it?


TIA
Cheers,
Brice

0
6 comments
Avatar
Permanently deleted user

Hi Brice,
Looks like registering your own com.intellij.debugger.PositionManager implementation will help.
Your position manager should work only for breakpoints in decompiled files, otherwise delegating calls to other managers.
Please check available implementations of this interface as code samples.
Should  you have any questions/problems with implementation, we'll be glad to assist.

Eugene

0

Ok, nice I will take a look and play with it once I'm back from my travel.

Thank you Eugene :)

0

Hi Eugene,
I'm trying to implement com.intellij.debugger.PositionManager. I should provide information about this implementation to IDE. As I understand the com.intellij.debugger.PositionManagerFactory instance used for this purposes: it should return my implementation of PositionManager. I created my implementation of PositionManagerFactory and registered it in plugin.xml by <debugger.positionManagerFactory implementation="jd.ide.intellij.JavaDecompilerPositionManagerFactory"/> statement in the <extensions> section. But it looks that Idea does not load my implementation of Position Manager Factory. The same result if I use <applicationService> statement to register my implementation of Position Manager Factory.

Can you explain how should I register the Position Manager Factory?


Thank you, Eugene.

0
Avatar
Permanently deleted user

Hi Eugene,
Registering like "<debugger.positionManagerFactory implementation="jd.ide.intellij.JavaDecompilerPositionManagerFactory"/>" should work, it looks like a configuration issue.
As examples you may check groovy and aspectj plugins that register their own position manager factories org.jetbrains.plugins.groovy.debugger.GroovyPositionManagerFactory and com.intellij.lang.aspectj.debug.AjPositionManagerFactory respectively.

Please check that plugin.xml with the registration is indeed copied to output dir.

0

Hi Eugene!
Thank you for your answer, but it looks that it does not work for me.

In Java Decompiler used com.intellij.psi.compiled.ClassFileDecompilers.Light type of decompiler. Every time when I try to set break point in the decompiled method I got the warning "Method breakpoints may dramatically slow down debugging".
I think that I should override the standard mechanism for brakpoint  handling of IntelliJ IDEA integrated java decompiler.

Also I added log message in the non-argument constructor of JavaDecompilerPositionManagerFactory class and it looks that this instance dose not created - it is open question.



Eugene.

0

Hi,
if your files are of java type then you'll need to override standard java breakpoints first.
To do so (in 14 trunk) you should create and register your own XLineBreakpointType with correct canPutAt implementation and getPriority higher than 100.

Then if you want to reuse standard java debugger you'll need position manager for sure and also correct JavaBreakpointHandlerFactory (14 trunk)

0

Please sign in to leave a comment.