public static string ReadJavaString(HeapObject stringObj) { FieldReferenceValue charArrayReference = (FieldReferenceValue)stringObj.GetField("value", "[C"); HeapArray charArray = (HeapArray)Heap.GetItem(charArrayReference.Address); return(new string((char[])charArray.Array)); }
public static void PrintObject(HeapObject obj) { Console.WriteLine(); string className = obj.ClassFile.Name; Console.ForegroundColor = classNameColor; Console.Write(className); Console.ForegroundColor = separatorColor; Console.Write('/'); Console.ForegroundColor = objAddrColor; Console.WriteLine(obj.Address); foreach (FieldInfo field in obj.ClassFile.InstanceFields()) { Console.ForegroundColor = fieldNameColor; Console.Write(field.Name); Console.ForegroundColor = separatorColor; Console.Write('/'); WriteFieldValue(field, obj.GetField(field.Name, field.Descriptor)); Console.WriteLine(); } }