gdb & java

Tom Tromey tromey@cygnus.com
Sat Aug 19 12:48:00 GMT 2000


Jeff> I'm not having much luck with gdb and java sources.  I'm using
Jeff> gdb 19991004.  Anybody else finding gdb useful?  Are there
Jeff> patches or newer versions that are likely to help?

gdb support for Java has rotted a bit.  It went from being minimally
useful to being somewhat useless.

Jeff> threads

Threads only sort of work for me.  If a thread exits, sometimes gdb
gets into a confused state.  gdb often gets into a confused state for
me, though, if I set breakpoints in libgcj -- it doesn't always react
well to re-running the inferior when a breakpoint is set in a shared
library, at least on Linux.

Jeff> breakpoints at Class.method (or Class::method)

This might be shared library related.

Try doing "b main", then "r", and then set your Class.method
breakpoint when the `main' bp is hit.  gdb won't let you put a
breakpoint on a function in a shared library until after the inferior
has started.  This is losing, and is a change from gdbs of yore.  I
don't know why this happens now.  I wish it would change back.

Jeff> examining instance variables

This fails for me if the class has a $finit$ function, because gdb's
stabs reader gets confused by the first `$'.  Alex's recent gcj/libgcj
patches address this by renaming the function to `finit$'.

Jeff> examining static variables

I haven't seen this one, but I also don't recall trying this lately.

Sometimes gdb won't let you print a local variable declared in a
nested block.  The gdb hackers tell me this is a gcc bug, but I don't
have a nice test case to report.

Tom


More information about the Java mailing list