Documentation Archive Developer
Search

ADC Home > Reference Library > Technical Q&As > Legacy Documents > Java >

Legacy Documentclose button

Important: This document is part of the Legacy section of the ADC Reference Library. This information should not be used for new development.

Current information on this Reference Library topic can be found here:

Stack Crawl Not Showing Line Numbers


Q: I have a Java stack crawl (from an exception printed to the console, or via the 'mrj' dcmd) that does not show source line numbers for some or all methods. How can I get it to show the line numbers so I can debug the problem?

A: There are two explanations. The most likely is that the method has been translated to native code by the JIT. In this case, the phrase "(Compiled code)" will appear where the source filename and line number would have been. If you're debugging and really need the line numbers, disable the JIT -- see the Q&A on disabling the JIT.

If there is no "(Compiled code)" text, or if you've already disabled the JIT and still don't get line numbers, then the Java compiler must have omitted the source-file and line-number tables when it compiled the class. This is a compiler setting which can be changed. Recompiling with this option ON will solve the problem; however, leaving out these tables makes your compiled code noticeably smaller. If you're using the "javac" compiler which comes with the MRJ SDK, this is accomplished through the "Debugging tables" checkbox. If you're using Metrowerks CodeWarrior, make sure the debugging dot (in the column underneath the bug icon) is ON for all source files, then recompile. (Note also that turning on optimization and inlining in the Metrowerks compiler can make line numbers inaccurate or confusing.)

[Feb 22 1999]