gcj and debugging

Michael Haupt <[email protected]> Fri, 1 Feb 2013 16:07:17 +0100
Newsgroups gmane.comp.gcc.java.devel
Message-ID <[email protected]>
Hello,

in a research project, I'm generating DWARF debugging info for machine code generated from Java. I looked at some of the DWARF debug info generated by gcj (including that contained in libgcj.so).

Some things I could not figure out.

Java arrays are all merely declared in the DWARF; structural information about Java array objects is not given. In libgcj's array.h, there are two classes, __JArray and JArray<T> (inheriting from __Jarray), that hold a length field and, in addition, a T* array[0].

The debug info for libgcj does not contain any structural information about these two classes. 

How does gdb determine that there is a length field, and how many elements there are if the length is assigned dynamically? I reckon the latter can be done by describing the length as a DWARF exprloc, but the description is nowhere to be found.

How does the DWARF description of a Java array look?
Is this generated at run-time somehow?
Do gcj-generated binaries and gdb interact in some other ways than through DWARF when it comes to meta-info exchange?

Likewise, how does gdb know how to display a java.lang.String as a, well, string?

BTW I have read a thread on this mailing list from June 2004 (http://gcc.gnu.org/ml/java/2004-06/msg00065.html), which touches upon the subject but does not really address my question.

Thanks,

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