Merge changes Iffbd6261,Ic7382a61
* changes:
fs_mgr: overlayfs: test: adding diagnostic value
fs_mgr: overlayfs: test: skip apex mounts
diff --git a/libunwindstack/MapInfo.cpp b/libunwindstack/MapInfo.cpp
index fe32b5e..e3b48ca 100644
--- a/libunwindstack/MapInfo.cpp
+++ b/libunwindstack/MapInfo.cpp
@@ -96,11 +96,6 @@
}
}
- // If the map isn't readable, don't bother trying to read from process memory.
- if (!(flags & PROT_READ)) {
- return nullptr;
- }
-
// Need to verify that this elf is valid. It's possible that
// only part of the elf file to be mapped into memory is in the executable
// map. In this case, there will be another read-only map that includes the
@@ -132,18 +127,19 @@
}
}
- if (ro_map_info != nullptr) {
- // Make sure that relative pc values are corrected properly.
- elf_offset = offset - closest_offset;
-
- MemoryRanges* ranges = new MemoryRanges;
- ranges->Insert(new MemoryRange(process_memory, ro_map_info->start,
- ro_map_info->end - ro_map_info->start, 0));
- ranges->Insert(new MemoryRange(process_memory, start, end - start, elf_offset));
-
- return ranges;
+ if (ro_map_info == nullptr) {
+ return nullptr;
}
- return nullptr;
+
+ // Make sure that relative pc values are corrected properly.
+ elf_offset = offset - closest_offset;
+
+ MemoryRanges* ranges = new MemoryRanges;
+ ranges->Insert(new MemoryRange(process_memory, ro_map_info->start,
+ ro_map_info->end - ro_map_info->start, 0));
+ ranges->Insert(new MemoryRange(process_memory, start, end - start, elf_offset));
+
+ return ranges;
}
Elf* MapInfo::GetElf(const std::shared_ptr<Memory>& process_memory, ArchEnum expected_arch) {
diff --git a/libunwindstack/tests/MapInfoGetElfTest.cpp b/libunwindstack/tests/MapInfoGetElfTest.cpp
index f3b4679..99f8fa3 100644
--- a/libunwindstack/tests/MapInfoGetElfTest.cpp
+++ b/libunwindstack/tests/MapInfoGetElfTest.cpp
@@ -290,27 +290,6 @@
ASSERT_TRUE(elf->memory()->ReadFully(0x1000, buffer.data(), 1));
}
-TEST_F(MapInfoGetElfTest, process_memory_not_read_only) {
- MapInfo info(nullptr, 0x9000, 0xa000, 0x1000, 0, "");
-
- // Create valid elf data in process memory only.
- Elf64_Ehdr ehdr;
- TestInitEhdr<Elf64_Ehdr>(&ehdr, ELFCLASS64, EM_AARCH64);
- ehdr.e_shoff = 0x2000;
- ehdr.e_shentsize = sizeof(Elf64_Shdr) + 100;
- ehdr.e_shnum = 0;
- memory_->SetMemory(0x9000, &ehdr, sizeof(ehdr));
-
- Elf* elf = info.GetElf(process_memory_, ARCH_ARM64);
- ASSERT_TRUE(elf != nullptr);
- ASSERT_FALSE(elf->valid());
-
- info.elf.reset();
- info.flags = PROT_READ;
- elf = info.GetElf(process_memory_, ARCH_ARM64);
- ASSERT_TRUE(elf->valid());
-}
-
TEST_F(MapInfoGetElfTest, check_device_maps) {
MapInfo info(nullptr, 0x7000, 0x8000, 0x1000, PROT_READ | MAPS_FLAGS_DEVICE_MAP,
"/dev/something");
diff --git a/logcat/tests/logcat_test.cpp b/logcat/tests/logcat_test.cpp
index 9483bb2..d5c40be 100644
--- a/logcat/tests/logcat_test.cpp
+++ b/logcat/tests/logcat_test.cpp
@@ -1404,7 +1404,7 @@
int count = 0;
char buffer[BIG_BUFFER];
-#define logcat_regex_prefix ___STRING(logcat) "_test"
+#define logcat_regex_prefix logcat_executable "_test"
snprintf(buffer, sizeof(buffer),
logcat_executable " --pid %d -d -e " logcat_regex_prefix "_a+b",
@@ -1550,7 +1550,7 @@
{
static const struct tag sync = { 2720, "sync" };
- static const char id[] = ___STRING(logcat) ".descriptive-sync";
+ static const char id[] = logcat_executable ".descriptive-sync";
{
android_log_event_list ctx(sync.tagNo);
ctx << id << (int32_t)42 << (int32_t)-1 << (int32_t)0;
@@ -1665,7 +1665,7 @@
// Invent new entries because existing can not serve
EventTagMap* map = android_openEventTagMap(nullptr);
ASSERT_TRUE(nullptr != map);
- static const char name[] = ___STRING(logcat) ".descriptive-monotonic";
+ static const char name[] = logcat_executable ".descriptive-monotonic";
int myTag = android_lookupEventTagNum(map, name, "(new|1|s)",
ANDROID_LOG_UNKNOWN);
android_closeEventTagMap(map);