Add a flag to distinguish shared VMAs
This flag is required to filter out shared VMAs when compacting memory
using process_madvise.
Test: atest bionic-unit-tests-static
Bug: 173258203
Change-Id: I01fc0cc614b03128a5a9b0a6c8c5c2d829b701f9
diff --git a/tests/dlext_test.cpp b/tests/dlext_test.cpp
index 01bf8ab..e3caf0e 100644
--- a/tests/dlext_test.cpp
+++ b/tests/dlext_test.cpp
@@ -717,13 +717,12 @@
uint64_t addr = reinterpret_cast<uint64_t>(ptr);
std::string found_name = "<not found>";
- EXPECT_TRUE(android::procinfo::ReadMapFile(
- "/proc/self/maps",
- [&](uint64_t start, uint64_t end, uint16_t, uint16_t, ino_t, const char* name) {
- if (addr >= start && addr < end) {
- found_name = name;
- }
- }));
+ EXPECT_TRUE(android::procinfo::ReadMapFile("/proc/self/maps",
+ [&](const android::procinfo::MapInfo& mapinfo) {
+ if (addr >= mapinfo.start && addr < mapinfo.end) {
+ found_name = mapinfo.name;
+ }
+ }));
return found_name;
}
diff --git a/tests/malloc_iterate_test.cpp b/tests/malloc_iterate_test.cpp
index 738a57b..e896c90 100644
--- a/tests/malloc_iterate_test.cpp
+++ b/tests/malloc_iterate_test.cpp
@@ -95,7 +95,8 @@
test_data->total_allocated_bytes = 0;
// Find all of the maps that are from the native allocator.
- auto callback = [&](uint64_t start, uint64_t end, uint16_t, uint64_t, ino_t, const char* name) {
+ auto callback = [&](uint64_t start, uint64_t end, uint16_t, uint64_t, ino_t, const char* name,
+ bool) {
if (strcmp(name, "[anon:libc_malloc]") == 0 || strncmp(name, "[anon:scudo:", 12) == 0 ||
strncmp(name, "[anon:GWP-ASan", 14) == 0) {
malloc_iterate(start, end - start, SavePointers, test_data);
@@ -192,7 +193,8 @@
TestDataType test_data = {};
// Only attempt to get memory data for maps that are not from the native allocator.
- auto callback = [&](uint64_t start, uint64_t end, uint16_t, uint64_t, ino_t, const char* name) {
+ auto callback = [&](uint64_t start, uint64_t end, uint16_t, uint64_t, ino_t, const char* name,
+ bool) {
if (strcmp(name, "[anon:libc_malloc]") != 0 && strncmp(name, "[anon:scudo:", 12) != 0 &&
strncmp(name, "[anon:GWP-ASan", 14) != 0) {
size_t total = test_data.total_allocated_bytes;