aspose file tools*
The moose likes Java in General and the fly likes Debugging code without sources Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Debugging code without sources" Watch "Debugging code without sources" New topic
Author

Debugging code without sources

Anatoly Chervyakov
Greenhorn

Joined: Feb 17, 2011
Posts: 2
Hello guys!

I've got third party jars (compiled for production environment) that I need to debug. I don't have the source files. A clever colleague gave me a suggestion that I followed. Here it is:

1. I send remote debug flags to jvm when I start the application to be debugged. Something like -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n

2. In Eclipse I created a dummy project and added all the jars to be debugged to this project. I've installed "JD decompiler" plugin to be able to view the sources (through decompiling of the class files).

3. I set a break point via "toggle breakpoint" in one of the jars

4. Then I start this dummy project in Eclipse with a debug launch I've created for it.

Up to this point everything goes well. The application pops up, I press a button, and execution hits my breakpoint but then... Eclipce shows a message saying that (in my own words) the breakpoint cannot be installed as the source file does not contain line number information.

Question: is that it? Or can I "fix" this problem somehow to be able to debug these jars?

Thanks in advance,
Anatoly
Siddhesh Deodhar
Ranch Hand

Joined: Mar 05, 2009
Posts: 118
Welcome to Forum. Did you tried adding break point's at more places ? because code generated by De-compiler may not be in exact sync with original code.


Good, Better, Best, Don't take rest until, Good becomes Better, and Better becomes Best.
Sidd : (SCJP 6 [90%] )
Mohamed Sanaulla
Saloon Keeper

Joined: Sep 08, 2007
Posts: 3099
    
  33

Am just curious- Why would you want to debug the Third Party Jars? If there's any issue you think is due to the 3rd party jars- You can intimate them and ask them debug/fix them. Otherwise De-compiling the jar would not be ideal.


Mohamed Sanaulla | My Blog
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42951
    
  72
Source code created by a decompiler in useless in this context, as the line numbers would be guaranteed to be different from the original ones. In your case it wouldn't even work if you had the actual sources, as the library has apparently been compiled without the debug flag being set - which results in the class files not having line number information to begin with.

I agree with Mohamed that you should not need to debug the library, but instead contact its vendor/author to either a) obtain the source code, or b) have them investigate any aberrant behavior.

By the way, make sure that the license of the library allows decompiling; that's not a given.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Debugging code without sources