Refactor the malloc_info code.
malloc_info needs to be per native allocator, but the code treated it
like a global function that doesn't depend on the native memory allocator.
Update malloc debug to dump the actual pointers that it has been tracking.
Test: bionic-unit-tests pass.
Test: malloc debug tests pass.
Test: malloc hook tests pass.
Change-Id: I3b0d4d748489dd84c16d16933479dc8b8d79013e
Merged-In: I3b0d4d748489dd84c16d16933479dc8b8d79013e
(cherry picked from commit a3656a98b10d2a4a6194a5d9705ad9c2cc5877b0)
diff --git a/libc/malloc_debug/PointerData.h b/libc/malloc_debug/PointerData.h
index 6955c9a..24ca748 100644
--- a/libc/malloc_debug/PointerData.h
+++ b/libc/malloc_debug/PointerData.h
@@ -132,9 +132,6 @@
void PostForkParent();
void PostForkChild();
- static void GetList(std::vector<ListInfoType>* list, bool only_with_backtrace);
- static void GetUniqueList(std::vector<ListInfoType>* list, bool only_with_backtrace);
-
static size_t AddBacktrace(size_t num_frames);
static void RemoveBacktrace(size_t hash_index);
@@ -151,6 +148,7 @@
static void VerifyFreedPointer(const FreePointerInfoType& info);
static void VerifyAllFreed();
+ static void GetAllocList(std::vector<ListInfoType>* list);
static void LogLeaks();
static void DumpLiveToFile(FILE* fp);
@@ -165,6 +163,9 @@
static std::string GetHashString(uintptr_t* frames, size_t num_frames);
static void LogBacktrace(size_t hash_index);
+ static void GetList(std::vector<ListInfoType>* list, bool only_with_backtrace);
+ static void GetUniqueList(std::vector<ListInfoType>* list, bool only_with_backtrace);
+
size_t alloc_offset_ = 0;
std::vector<uint8_t> cmp_mem_;