Add more logging when mmap fails.
We now print the reason that the mmap failed.
Change-Id: Ie515e4bba117c9ea1f4297abb826d32172bea962
diff --git a/runtime/mem_map.cc b/runtime/mem_map.cc
index 3afb606..39e838f 100644
--- a/runtime/mem_map.cc
+++ b/runtime/mem_map.cc
@@ -133,12 +133,13 @@
fd,
page_aligned_offset));
if (actual == MAP_FAILED) {
+ std::string strerr(strerror(errno));
std::string maps;
ReadFileToString("/proc/self/maps", &maps);
- *error_msg = StringPrintf("mmap(%p, %zd, %x, %x, %d, %lld) of file '%s' failed\n%s",
+ *error_msg = StringPrintf("mmap(%p, %zd, %x, %x, %d, %lld) of file '%s' failed: %s\n%s",
page_aligned_addr, page_aligned_byte_count, prot, flags, fd,
- static_cast<int64_t>(page_aligned_offset),
- filename, maps.c_str());
+ static_cast<int64_t>(page_aligned_offset), filename, strerr.c_str(),
+ maps.c_str());
return NULL;
}
return new MemMap("file", actual + page_offset, byte_count, actual, page_aligned_byte_count,