javadebuggingjdb

How do I print an array in Java's jdb debugger?


How do I print out the values of the byte array all at once? I seem to recall I could specify a memory range in gdb. Is similar functionality is available in jdb?

I have a Java byte array:

byte [] decompressed = new byte[OUTPUT_FILE_IO_BUFFER_SIZE];

which I populate from a String:

System.arraycopy(decompressedString.getBytes(), 0, decompressed, 0, 
                         decompressedString.length());

In jdb, I want to print the contents of the byte array. I tried

main[1] print decompressed

which returns:

 decompressed = instance of byte[7] (id=342)

Solution

  • One solution:

    dump decompressed
    

    This dumps the byte values! :)