views:

29

answers:

2

I can't seem to find anything on google telling me why this might be and what the resolution is. I'm Stepping through third party code (that I have the source for) and would really like to see the current line being executed...

Looking at javac compile flags, I see the -g:none flag. If this flag is set, would this be enough to explain why I'm not able to see line numbers? If so, why would someone do this, are there performance implications? Do I need to recompile the jar myself to attach the missing debug info (if possible)?

Thanks!

+1  A: 

Looking at javac compile flags, I see the -g:none flag. If this flag is set, would this be enough to explain why I'm not able to see line numbers?

Yes, that's the reason.

If so, why would someone do this?

Perhaps the author of the library wanted to make his jar as small as possible. The performance won't be very different if you compile without the -g:none switch.

tangens
Roger. Is there anything I can do short of recompiling myself? Are there performance gains for using this flag?
Mike
The only thing you can do is to build the jar yourself and include the debugging info.
tangens
Gotcha, thanks!
Mike
A: 

I would imagine there would be performance implications, but debug information will definitely make your class files larger. So that's another motivation.

Also, companies that want to protect their source often won't compile in debug information to make disassembly (reverse engineering) less valuable to someone so motivated (this is the same reason some companies obfuscate their bytecode).

Clearly if the source is available to you the above point is irrelevant. If the code is open source, you shouldn't have too much trouble compiling yourself the library (after all, every other contributor would need to be able to do that!). And yes, that is your best option at this point.

Mark Peters
Right, but I might not have RCS access to the source and all of the assembly instructions (ant or maven) - just a source jar. If that is the case, it could be necessary to look into whether the project has a svn or cvs server that the build scripts can be pulled from...
Mike