libgcj/370: gij doesn't show (uncaught) exceptions

mark@klomp.org mark@klomp.org
Sun Nov 12 04:50:00 GMT 2000


>Number:         370
>Category:       libgcj
>Synopsis:       gij doesn't show (uncaught) exceptions
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    tromey
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Nov 12 04:50:01 PST 2000
>Closed-Date:
>Last-Modified:
>Originator:     Mark Wielaard
>Release:        gij (GNU libgcj) version 0.0.7
>Organization:
>Environment:

>Description:
When a program throws an (uncaught) exception an executable
made with gcj does show an stack trace. But running the same
program as a class file under gij does not show anything
that went wrong.
>How-To-Repeat:
Compile the following with gcj -C and the run it with gij

public class test {
    int i = 42;
    public static void main(String[] args) {
        test p = null;
        System.out.println(p.i);
    }   
}
>Fix:
The following makes sure that there is at least a stack trace shown
(although it does not contain the java source file and line number.)
_Jv_argv is null when running gij.

diff -u -u -r1.5 name-finder.cc
--- name-finder.cc	2000/10/09 01:54:50	1.5
+++ name-finder.cc	2000/11/12 12:34:39
@@ -149,7 +149,7 @@
 	strncpy (method_name, dl_info.dli_sname, sizeof method_name);
        
        /* Don't trust dladdr() if the address is from the main program. */
-       if (strcmp (file_name, _Jv_argv[0]) != 0)
+       if (_Jv_argv == NULL || strcmp (file_name, _Jv_argv[0]) != 0)
          return true;
       }
   }
>Release-Note:
>Audit-Trail:
>Unformatted:
 


More information about the Java-prs mailing list