Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Source not found in debugger
Source not found in debugger [message #989150] Tue, 04 December 2012 15:33 Go to next message
Patson Luk is currently offline Patson Luk
Messages: 2
Registered: December 2012
Junior Member
Hi all,

I am stumbled on a source not found problem in debug mode and could not figure out the reason. I have simplified and compared the problem as below:

Problem:
1. Project "A" with class "com.a.Test" with public static method "test()", put a break point within the test() method. Project A is built as jar "a.jar" using Maven (mvn package)

2. Project "B" (not a maven managed project) with class "com.b.TestDriver" with main() method that calls the com.a.Test.test(). Project B uses the a.jar

3. When I debug on com.b.TestDriver.main(), the Debugger halts correctly at the Test.test() line and the editor has only a single red line saying "Source not found" and right below a button to "Edit Source Lookup Path..."

4. Click the "Edit Source Lookup Path...", Add the Java Project "A" in the source lookup. But the editor stills shows "Source not found"



In order to narrow down the problem, I modified the flow a little bit and source lookup work as intended:
1. Everything is the same for project A. But instead of using "mvn package" to build the jar, I exported it as a jar directly from eclipse using "Export...> Java > JAR file"

3. When I debug on com.b.TestDriver.main(), the Debugger halts correctly at Test.test() line and the editor has black line saying "Source not found" but with more information about the method signature and so on". It also has button "Attach Source..." instead of "Edit Source Lookup Path..."

4. Click the "Attach Source...", add the java Project A from workspace and the editor locates the source code correctly.



The thing that I cannot figure out is that why the jar built by "mvn package" triggers a different "source not found" behavior on eclipse? In both test cases eclipse managed to halt at the correct break-point and prompt for source but prompts are different and the source lookup for the mvn packaged one did not work.

Can someone please kindly help me with this or give me some pointers?

Zillion thanks in advance!





Re: Source not found in debugger [message #989158 is a reply to message #989150] Tue, 04 December 2012 17:24 Go to previous messageGo to next message
David Wegener is currently offline David Wegener
Messages: 1334
Registered: July 2009
Senior Member
The mvn package build probably isn't building the class files with debugging information.
Re: Source not found in debugger [message #989159 is a reply to message #989150] Tue, 04 December 2012 17:26 Go to previous message
Patson Luk is currently offline Patson Luk
Messages: 2
Registered: December 2012
Junior Member
Hi all,

Upon further investigation, it turns out that the Maven build process uses Proguard plugin with obfuscate set to TRUE. Therefore the generated bytecode included in the jar was modified which triggered debugger failure on eclipse side.

The debugger did manage to lookup the correct line number but it showed [local variables unavailable] next to the stack trace. I bet the obfuscation hinders the debugger from correctly linking the bytecode with the provided source therefore the failure of using lookup source.

To me it is expected that debugger would not work on obfuscated bytecode. The source showed up just fine once I set the obfuscate option to false in the maven build process.

Thanks all again!
Previous Topic:Axis2 - Create web service on existing Dynamic Web Project
Next Topic:Ignoring "Type Value is not a valid NMToken" on web.xml
Goto Forum:
  


Current Time: Tue Jul 22 19:47:48 EDT 2014

Powered by FUDForum. Page generated in 0.09355 seconds