Bug 28352 - gcj -C fails to generate line number info for method
Summary: gcj -C fails to generate line number info for method
Alias: None
Product: gcc
Classification: Unclassified
Component: java (show other bugs)
Version: unknown
: P3 normal
Target Milestone: 4.3.0
Assignee: Not yet assigned to anyone
Depends on: 28067
  Show dependency treegraph
Reported: 2006-07-11 21:30 UTC by Bryce McKinlay
Modified: 2007-01-09 20:48 UTC (History)
2 users (show)

See Also:
Known to work:
Known to fail:
Last reconfirmed: 2006-07-12 01:46:30


Note You need to log in before you can comment on or make changes to this bug.
Description Bryce McKinlay 2006-07-11 21:30:56 UTC
When the following test case is built with gcj -C, the innermost frame is missing from the stack trace:

public class Ex {
   void snafu( ) throws Exception {
     throw new Exception();
   void bar( ) throws Exception {
     snafu( );
   void foo( ) throws Exception {
     bar( );
   public static void main( String[] args) throws Exception {
     new Ex( ).foo( );

$ gij Ex
Exception in thread "main" java.lang.Exception
   at Ex.snafu(Ex.java)
   at Ex.bar(Ex.java:6)
   at Ex.foo(Ex.java:9)
   at Ex.main(Ex.java:12)

In addition, when built with a different bytecode compiler (ecj), the stack trace is complete, but has off-by-one line number errors:

$ gij Ex
Exception in thread "main" java.lang.Exception
   at Ex.snafu(Ex.java:3)
   at Ex.bar(Ex.java:7)
   at Ex.foo(Ex.java:10)
   at Ex.main(Ex.java:13)
Comment 1 Bryce McKinlay 2006-07-11 21:32:41 UTC
Correction: the description should read "the line number for the inner-most frame is missing from the stack trace".
Comment 2 Ranjit Mathew 2006-07-12 01:46:30 UTC
Comment 3 bryce@gcc.gnu.org 2006-07-12 13:56:36 UTC
Subject: Bug 28352

Author: bryce
Date: Wed Jul 12 13:56:25 2006
New Revision: 115370

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=115370
2006-07-12  Bryce McKinlay  <mckinlay@redhat.com>

	PR libgcj/28352
	* stacktrace.cc (getLineNumberForFrame): Roll back PC by 1 when
	looking up line number for interpreted frame.


Comment 4 Bryce McKinlay 2006-07-12 13:59:50 UTC
I've committed a patch which fixes the "off by one" error seen with ecj-produced bytecode. The missing line number issue is a different bug. It seems that "gcj -C" simply does not generate any debug info for the "snafu" method in the example below. 

I'm reassigning this as a front-end bug.
Comment 5 Tom Tromey 2007-01-09 20:48:44 UTC
All gcj front end bugs have been fixed by the gcj-eclipse branch merge.
I'm mass-closing the affected PRs.
If you believe one of these was closed in error, please reopen it
with a note explaining why.