Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2b653eab authored by Christopher Ferris's avatar Christopher Ferris Committed by Gerrit Code Review
Browse files

Merge "Add new header to support 32 bit/64 bit dumps."

parents 523afd15 bebb2672
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -35,7 +35,15 @@ extern "C" void get_malloc_leak_info(uint8_t** info, size_t* overallSize,

extern "C" void free_malloc_leak_info(uint8_t* info);

#define DDMS_HEADER_SIGNATURE 0x812345dd
#define DDMS_VERSION 2

struct Header {
#if defined(__LP64__)
    uint32_t signature;
    uint16_t version;
    uint16_t pointerSize;
#endif
    size_t mapSize;
    size_t allocSize;
    size_t allocInfoSize;
@@ -77,6 +85,12 @@ static jbyteArray DdmHandleNativeHeap_getLeakInfo(JNIEnv* env, jobject) {
    ALOGD("*** mapSize: %d allocSize: %d allocInfoSize: %d totalMemory: %d",
          header.mapSize, header.allocSize, header.allocInfoSize, header.totalMemory);

#if defined(__LP64__)
    header.signature = DDMS_HEADER_SIGNATURE;
    header.version = DDMS_VERSION;
    header.pointerSize = sizeof(void*);
#endif

    jbyteArray array = env->NewByteArray(sizeof(Header) + header.mapSize + header.allocSize);
    if (array != NULL) {
        env->SetByteArrayRegion(array, 0,