gcj and debugging
Michael Haupt
michael.haupt@oracle.com
Mon Feb 11 16:26:00 GMT 2013
Tom,
thank you very much for your reply.
Am 07.02.2013 um 19:47 schrieb Tom Tromey <tromey@redhat.com>:
> Michael> in a research project, I'm generating DWARF debugging info for machine
> Michael> code generated from Java. I looked at some of the DWARF debug info
> Michael> generated by gcj (including that contained in libgcj.so).
>
> I think the first thing to realize is that the gdb support for Java was
> all written to target gcj specifically, and also written long ago and
> then barely updated.
>
> It isn't very general or done the way it would be done now.
> It was never updated for the gcj binary compatibility ABI.
Would you suggest to generate DWARF info with the language set to C89 then, to avoid misleading gdb?
> I thought things like "print array[0]" used to work, but even that seems
> to fail for me now. There is definitely some code for this in gdb, see
> jv-valprint.c:java_value_print. It seems to know a bit about array
> layout and then goes from there (though the code looks somewhat bogus to
> me...). See also jv-lang.c:evaluate_subexp_java for the code that tries
> to do array subscripting.
If gdb's Java language support is really tailored to gcj, it surely assumes internal layout details about arrays. I cannot guarantee that "my" arrays have the same internal representation. :-)
> gdb has special code for this. It looks for a type named
> "java.lang.String" and then knows what fields it has.
>
> Yucky.
Indeed.
Thanks again,
Michael
--
Dr. Michael Haupt
Principal Member of Technical Staff
Phone: +49 331 200 7277, Fax: +49 331 200 7561
Oracle Labs
Oracle Deutschland B.V. & Co. KG, Schiffbauergasse 14, 14467 Potsdam, Germany
More information about the Java
mailing list