Some java questions

Keith Seitz keiths@redhat.com
Tue Sep 9 19:44:00 GMT 2008


Hi,

I've been mucking with Daniel's DWARF2 "full names" patch, and a number 
issues with java and the gdb.java/jmisc.exp and gdb.java/jprint.exp 
tests have appeared.

Both of these test cases have the following comment:

     # Ref PR gdb:java/1565.  Don't use the simpler "break jmisc.main".
     # As of 2004-02-24 it wasn't working and is being tested separatly.
     # Before GCJ 4.1 (approximately) the demangled name did not include
     # a method signature; after that point it does include a trailing
     # signature.

In the case of jmisc,exp, the test suite attempts to set breakpoints on 
"'jmisc.main(java.lang.String[])'" and 
"'jmisc.main(java.lang.String[])void'", working around the gcc bug 
(similar in jprint.exp). IMO, this is a very dangerous precedent. Bugs 
in the toolchain should not be worked around like this. They should be 
xfailed or (in this case), breaks at the correct "jmisc.main" should 
have been left in as well.

IMO this bug should be closed/not-a-bug, and jmisc/jprint.exp should be 
"fixed". [There are several ways this could be done. The simplest is to 
simply break at "jmisc.main" as it should. Maybe add 
"jmisc.main(java.lang.String[])" as a back-up. If someone recommends a 
course of action, I would be happy to follow it up.]

But that's not my real concern. What puzzles me is this second function 
"jmisc.main(java.lang.String[])void". What the heck is that, 'cause it 
isn't java. It looks to me like some partially demangled java method 
signature (which is still not valid input to a java compiler).

I also note this in "info func":

(gdb) info func jmisc
All functions matching regular expression "jmisc":

File /tmp/ccozBSfv.jar:
void jmisc.jmisc();
void jmisc.main(java.lang.String[])void;

Now maybe my java is really rusty after two months, but I'm pretty sure 
"void jmisc.main(java.lang.String[])void;" is not a valid method 
declaration.

What's puzzling about all of this is that the gcc/gdb versions which 
java/1565 affect actually show something sane:

(old-gdb) info func jmisc
All functions matching regular expression "jmisc":

File jmisc.java:
void jmisc.jmisc();
void jmisc.main(java.lang.String[]);

While it is true that one cannot "break jmisc.main" on those "broken" 
versions, one can simply do "break jmisc.main(java.lang.String[])". Any 
attempt to tack on the "void" either results in a "junk at end of 
argument list" error (without surrounding ') or a "make pending 
breakpoint?" query (with surrounding ' -- breakpoint never gets hit).

At long last, my question is: Is gdb supposed to be able to do something 
with "jmisc.main(java.lang.String[])void", i.e. is it considered valid 
"input" to break, print, and other commands?

Keith



More information about the Gdb mailing list