ART: Print maps directly to log
Do not read proc maps into a string before printing them later back
to the log. In low-memory situations this can cause a bad_alloc.
External bug: http://b.android.com/153990
Bug: 19494774
Change-Id: Ie63d8788afe8c9da65b30b2f89c50d3dbb820755
diff --git a/runtime/oat_file.cc b/runtime/oat_file.cc
index 9061bb3..ae09c6d 100644
--- a/runtime/oat_file.cc
+++ b/runtime/oat_file.cc
@@ -171,10 +171,10 @@
return false;
}
if (requested_base != NULL && begin_ != requested_base) {
+ PrintFileToLog("/proc/self/maps", LogSeverity::WARNING);
*error_msg = StringPrintf("Failed to find oatdata symbol at expected address: "
- "oatdata=%p != expected=%p /proc/self/maps:\n",
+ "oatdata=%p != expected=%p. See process maps in the log.",
begin_, requested_base);
- ReadFileToString("/proc/self/maps", error_msg);
return false;
}
end_ = reinterpret_cast<uint8_t*>(dlsym(dlopen_handle_, "oatlastword"));
@@ -209,10 +209,10 @@
return false;
}
if (requested_base != NULL && begin_ != requested_base) {
+ PrintFileToLog("/proc/self/maps", LogSeverity::WARNING);
*error_msg = StringPrintf("Failed to find oatdata symbol at expected address: "
- "oatdata=%p != expected=%p /proc/self/maps:\n",
+ "oatdata=%p != expected=%p. See process maps in the log.",
begin_, requested_base);
- ReadFileToString("/proc/self/maps", error_msg);
return false;
}
end_ = elf_file_->FindDynamicSymbolAddress("oatlastword");