[Kaffe] problem with stack traces

Moses DeJong dejong at cs.umn.edu
Wed Feb 3 21:01:08 PST 1999

Hello all.

I just ran into a problem with the way that Kaffe prints out
stack trace info. I will start out by just showing you the
output of a small example in the JDK and in Kaffe.

JDK output

% java ExceptionFile
        at SomeClass.foo(ExceptionFile.java:22)
        at SomeClass.run(ExceptionFile.java:15)
        at java.lang.Thread.run(Thread.java)

Kaffe output

)% kaffe ExceptionFile
        at java/lang/Throwable.<init>(31)
        at java/lang/Exception.<init>(17)
        at SomeClass.foo(22)
        at SomeClass.run(15)
        at java/lang/Thread.run(245)

The problem here is that Kaffe does not print the
name of the file where the class was defined in
the stack trace. This can make it very difficult
to figure out which file a stack trace is really
talking about when the class in question is defined
as non public and is located in another file.

// Start file ExceptionFile.java

public class ExceptionFile
    public static void main(String[] argv) throws Exception {
	SomeClass sc = new SomeClass();
	Thread t = new Thread(sc);

class SomeClass implements Runnable {
    public void run() {
	try {
	} catch (Exception e) {

    public static void foo() throws Exception {
	throw new Exception();

// End file ExceptionFile.java

Of course we know it is in ExceptionFile.java in this simple
example, but if you has thousands of .java files and you
got a Kaffe stack trace that did not tell you the name of
the source file how would you know where to look?

I poked around in stackTrace.c but I could not find any
way to get the name of the file a class object was defined
in. Does anyone know how I could find this info so that I
can add it to the printStackTrace() method?

I also noticed that class names were being printed like
java/lang/Thread instead of java.lang.Thread. Is that
a bug?

Mo DeJong
dejong at cs.umn.edu

More information about the kaffe mailing list