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

Commit 1b04ed79 authored by Brian Carlstrom's avatar Brian Carlstrom Committed by Android (Google) Code Review
Browse files

Merge "Extended android.os.Debug.dumpNativeHeap to include /proc/self/maps contents"

parents 027610a7 393b84c1
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -397,8 +397,22 @@ static void dumpNativeHeap(FILE* fp)
        ptr += infoSize;
    }

    fprintf(fp, "END\n");
    free_malloc_leak_info(info);

    fprintf(fp, "MAPS\n");
    const char* maps = "/proc/self/maps";
    FILE* in = fopen(maps, "r");
    if (in == NULL) {
        fprintf(fp, "Could not open %s\n", maps);
        return;
    }
    char buf[BUFSIZ];
    while (size_t n = fread(buf, sizeof(char), BUFSIZ, in)) {
        fwrite(buf, sizeof(char), n, fp);
    }
    fclose(in);

    fprintf(fp, "END\n");
}
#endif /*HAVE_ANDROID_OS*/