jdeclipse-realign icon indicating copy to clipboard operation
jdeclipse-realign copied to clipboard

Decompiler does not work with JARs within Eclipse Debugger

Open kwin opened this issue 12 years ago • 8 comments

When I set a breakpoint within a JAR of a Maven dependency of a project and afterwards debug that project, the debugger will not show the decompiled source of the Maven dependency when stepping through the code. Also I cannot I cannot evaluate new expressions. I don't know though, whether this problem can be fixed in jdeclipse-realign, or whether it is the problem in m2e described here: https://bugs.eclipse.org/bugs/show_bug.cgi?id=384065.

kwin avatar Dec 10 '12 22:12 kwin

It sounds like there are two issues here:

  1. You don't get decompiled source when you expect to.

  2. You can't evaluate new expressions.


General: What version of JD-Eclipse realign are you using? What version of Eclipse?

  1. Have you tried explicitly attaching/detaching decompiled source using the toolbar menus?

  2. What do you mean by "evaluate new expressions"?

On 10 Dec 2012, at 22:13, kwin [email protected] wrote:

When I set a breakpoint within a JAR of a Maven dependency of a project and afterwards debug that project, the debugger will not show the decompiled source of the Maven dependency when stepping through the code. Also I cannot I cannot evaluate new expressions.

— Reply to this email directly or view it on GitHub.

mchr3k avatar Dec 11 '12 07:12 mchr3k

You can see an example at https://github.com/digital-wonderland/jdeclipse-issue-16

(note that the cq-mailer jar has to be downloaded manually from the adobe repository (or that one added as repo).

After that please set a breakpoint within the CqMailingService constructor and start debugging the App class. When the breakpoint is reached neither the source is shown nor does the 'Expressions' view work within the 'Debug' perspective.

Now use JD-Gui to decompile the jar (open jar and select File->'Save all Sources'), associate the created src.zip manually with the cq-mailer .jar within Eclipse and restart debugging the App class. Now the source is correctly shown and also the 'Expressions' view works.

Our expectation / hope is that jdeclipse would automatically decompile the class so everything 'magically' works and one doesn't have to attach the source manually.

digital-wonderland avatar Dec 11 '12 11:12 digital-wonderland

Just as an addition: We use the latest version of JD-Eclipse Realign (1.1.1) in Eclipse 4.2 SR1 under Mac OS 10.8.

Another remark about the demo application attached above: It works fine, if you rely on a maven dependency where the source is available as well (JAR with source attachment), so I assume, this really is a problem with JD-Eclipse and not with m2e.

kwin avatar Dec 11 '12 11:12 kwin

I also hava the problem; stat tomcat in debug in eclipse server plugin , using external web module ;

source not found , I add external archive class jar in source ; source will flash but finally " source not found " again , jd eclipse can not decomile the class in this situation

wangchgiboz avatar Sep 03 '13 18:09 wangchgiboz

do you notice that the 'source not found' problem is because the class file not associated with a jar file!juset because this jar file is loaded dynamic(e.g. Maven) so: Source not found might be legitimate for dynamically loaded code (e.g. Maven). There are three workarounds known to me (after months of search): Connect to a running JVM with the debugger and you will see the code. Use Dynamic Source Lookup plugin for Eclipse from here:https://github.com/ifedorenko/com.ifedorenko.m2e.sourcelookup

Use run-jetty-run Maven plugin http://code.google.com/p/run-jetty-run/

if you are working with J2EE,it is recommend to use the run-jetty-run and the DECVM technique,enjoy it

tiann avatar Sep 11 '13 05:09 tiann

Did anyone get this resolved.. I can get it to work on a straight java app.. but as soon as I run via jboss and put in a breakpoint.. the debugger flashes the decompiled code and then closes going back to Source not found

jcotsell avatar Dec 07 '16 16:12 jcotsell

As a temporary solution what I did was copying decompiled source of classes from Eclipse, saving them in a folder (with complete package paths), then added that folder in the Source Lookup. If there are not too many classes to save it works for now. It shows the source code during the debugging and sets active green line when stepping through.

Evaluating expressions as well as Inspecting variables doesn't work. It's Eclipse restriction. Suppose it's because decompiled source doesn't match the original source code for a class (at least all theese decompiler comments makes the whole code text different). What works is hovering over a variable to see its content, though for expressions or method chains it fails).

mortalis13 avatar Sep 29 '17 08:09 mortalis13

Hi All,

While working on any version of eclipse, add the required jars directly to your build path, not through any libraries....for me I have tried this on Eclipse Galileo as well as Eclipse Neon. I have deployed my application in tomcat, and added all the jars from WEB-INF/lib and .properties files from WEB-INF/classes directly to build path and removed the existing Web App library that takes the contents of lib/classes to the build path. If you work like this you will be able to debug inside jar files. Inside Jar files, you will not be able to check values of any local method variable or evaluate any expression manually, but you will be able to check any global variable (both class as well as member) value as well as arguments passed to the current method.

asamant2 avatar Nov 21 '17 09:11 asamant2