aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Ferris <cferris@google.com>2019-05-08 16:14:26 -0700
committerandroid-build-merger <android-build-merger@google.com>2019-05-08 16:14:26 -0700
commit9cc9af1e6021525a817215ccf61ab2e010fefd01 (patch)
tree4185f5e54a3bbaa4eee0fb2f6fd09ed66186337f
parente33dc8a8b903bf3e53815bd2829f6f2f239c5fe7 (diff)
parent51ad27180bbfa1746bd4de8575bb0033d4f38587 (diff)
downloadandroid_bionic-9cc9af1e6021525a817215ccf61ab2e010fefd01.tar.gz
android_bionic-9cc9af1e6021525a817215ccf61ab2e010fefd01.tar.bz2
android_bionic-9cc9af1e6021525a817215ccf61ab2e010fefd01.zip
Merge "Add removed platform functions used by apps." into qt-dev
am: 51ad27180b Change-Id: Ia96df84946fe463d7f452f22620bb80d68f91996
-rw-r--r--libc/bionic/malloc_common_dynamic.cpp37
-rw-r--r--libc/libc.map.txt2
2 files changed, 39 insertions, 0 deletions
diff --git a/libc/bionic/malloc_common_dynamic.cpp b/libc/bionic/malloc_common_dynamic.cpp
index 599ac6a58..803574649 100644
--- a/libc/bionic/malloc_common_dynamic.cpp
+++ b/libc/bionic/malloc_common_dynamic.cpp
@@ -500,3 +500,40 @@ extern "C" bool android_mallopt(int opcode, void* arg, size_t arg_size) {
return HeapprofdMallopt(opcode, arg, arg_size);
}
// =============================================================================
+
+#if !defined(__LP64__) && defined(__arm__)
+// =============================================================================
+// Old platform only functions that some old 32 bit apps are still using.
+// See b/132175052.
+// Only compile the functions for 32 bit arm, so that new apps do not use
+// these functions.
+// =============================================================================
+extern "C" void get_malloc_leak_info(uint8_t** info, size_t* overall_size, size_t* info_size,
+ size_t* total_memory, size_t* backtrace_size) {
+ if (info == nullptr || overall_size == nullptr || info_size == nullptr ||
+ total_memory == nullptr || backtrace_size == nullptr) {
+ return;
+ }
+
+ *info = nullptr;
+ *overall_size = 0;
+ *info_size = 0;
+ *total_memory = 0;
+ *backtrace_size = 0;
+
+ android_mallopt_leak_info_t leak_info = {};
+ if (android_mallopt(M_GET_MALLOC_LEAK_INFO, &leak_info, sizeof(leak_info))) {
+ *info = leak_info.buffer;
+ *overall_size = leak_info.overall_size;
+ *info_size = leak_info.info_size;
+ *total_memory = leak_info.total_memory;
+ *backtrace_size = leak_info.backtrace_size;
+ }
+}
+
+extern "C" void free_malloc_leak_info(uint8_t* info) {
+ android_mallopt_leak_info_t leak_info = { .buffer = info };
+ android_mallopt(M_FREE_MALLOC_LEAK_INFO, &leak_info, sizeof(leak_info));
+}
+// =============================================================================
+#endif
diff --git a/libc/libc.map.txt b/libc/libc.map.txt
index f0fccf553..88192239a 100644
--- a/libc/libc.map.txt
+++ b/libc/libc.map.txt
@@ -1713,6 +1713,8 @@ LIBC_PRIVATE {
LIBC_DEPRECATED {
global:
__system_property_wait_any;
+ free_malloc_leak_info; # arm
+ get_malloc_leak_info; # arm
};
LIBC_PLATFORM {