Skip to main content

Debugging without sources

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
1 reply [Last post]
anatoly71
Offline
Joined: 2011-02-17

Hello gurus!

I've got third party jars (compiled for production environment) that I need to debug. I don't have the source files. Here's what I did:
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? Is there nothing could be done at all? Or can I "fix" this problem somehow to be able to debug these jars?
Thanks in advance,
Anatoly

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
landrus
Offline
Joined: 2003-06-12

Hi Anatoly,
well it might be it. What the libraries are missing are the debuging symbols like line number information. So you cannot set a breakpoint inside the libraries, even if you would have the real source code. But you can try one other thing. Set a breakpoint in your source code, that calls the library code and then from there on you can step through the libraries. But you will lack some things like:

  • parameter names
  • local variables
  • line number information

You need to interpret the source (from jd) at hand and guess whats happening, then you can try to find these information in the debugger. For example, if you see that the value of a local variable is used as a parameter in a method, you can step inside the method and then look at the value of the parameter (now named arg0, ... argn instead of e.g. myVarName). Its awkward and you don't have all information at hand. But if you are lucky, you do have enough to track down problems.

Christian