patch to emit debug into emitted classes

Bryce McKinlay mckinlay@redhat.com
Thu Apr 7 05:05:00 GMT 2005


Ranjit Mathew wrote:

>>In principle, the Java type data in the debug info is redundant anyway 
>>- gdb could, in theory, get all the info it needs from GCJ's metadata. 
>>In fact, with the BC-ABI it needs to do this to be correct: the type 
>>layouts can change at runtime, so the debug info is not only redundant 
>>but wrong!
>>
>>So, I don't think libraries lacking debugging info would be a 
>>significant problem, and it looks like the size savings are awesome.
>>
>>Per: I'll try and test this tomorrow.
>>    
>>
>
>This had looked like a promising patch.
>
>Whatever happened to it?
>  
>

It is certainly promising:

-rwxr-xr-x  1 mckinlay mckinlay 83349961 Apr  7 00:18 
/home/mckinlay/gcc-clean-x86_64/lib64/libgcj.so.6.0.0
-rwxr-xr-x  1 mckinlay mckinlay 52813922 Apr  6 23:26 
/home/mckinlay/gcc-HEAD-x86_64/lib64/libgcj.so.6.0.0

ie there is a ~38% reduction in the TOTAL size of libgcj.so with 
debugging info. I've had this patch in my tree for a while now and 
havn't encountered any debugging problems that couldn't be attributed to 
something else. It certainly passes the most obvious tests - ie I can 
print type information for libgcj types:

(gdb) p h
$1 = warning: RTTI symbol not found for class 'java::util::Hashtable'
java.util.Hashtable@2a9941c850
(gdb) ptype h
type = class java.util.Hashtable
     extends java.util.Dictionary implements java.util.Map, 
java.lang.Cloneable, java.io.Serializable {
    private static int DEFAULT_CAPACITY;
    public static int KEYS;
....

(gdb) ptype h.buckets
type = class java.util.Hashtable$HashEntry[]  extends java.lang.Object {
    public int length;
    public java.util.Hashtable$HashEntry data[0];
}
(gdb) ptype h.buckets.data[0]
type = class java.util.Hashtable$HashEntry
     extends java.util.AbstractMap$BasicMapEntry {
    public java.util.Hashtable$HashEntry next;

    Hashtable$HashEntry(java.lang.Object, java.lang.Object);
    java.lang.Object setValue(java.lang.Object);
}

If I don't hear any objections, I plan to check this in to HEAD in order 
for it to receive more widespread testing ;-)

Bryce



More information about the Java-patches mailing list