Print error message if ImageSpace::Init fails.
Also changed some of the args in mem_map.cc to print as hex.
Bug: 13323732
Change-Id: I02cd81300793515d143e94473f48fc701e401b38
diff --git a/runtime/mem_map.cc b/runtime/mem_map.cc
index 393ea68..fdfb477 100644
--- a/runtime/mem_map.cc
+++ b/runtime/mem_map.cc
@@ -110,7 +110,7 @@
if (actual == MAP_FAILED) {
std::string maps;
ReadFileToString("/proc/self/maps", &maps);
- *error_msg = StringPrintf("anonymous mmap(%p, %zd, %x, %x, %d, 0) failed\n%s",
+ *error_msg = StringPrintf("anonymous mmap(%p, %zd, 0x%x, 0x%x, %d, 0) failed\n%s",
addr, page_aligned_byte_count, prot, flags, fd.get(),
maps.c_str());
return nullptr;
@@ -151,7 +151,8 @@
std::string strerr(strerror(errno));
std::string maps;
ReadFileToString("/proc/self/maps", &maps);
- *error_msg = StringPrintf("mmap(%p, %zd, %x, %x, %d, %" PRId64 ") of file '%s' failed: %s\n%s",
+ *error_msg = StringPrintf("mmap(%p, %zd, 0x%x, 0x%x, %d, %" PRId64
+ ") 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, strerr.c_str(),
maps.c_str());
@@ -247,7 +248,7 @@
if (actual == MAP_FAILED) {
std::string maps;
ReadFileToString("/proc/self/maps", &maps);
- *error_msg = StringPrintf("anonymous mmap(%p, %zd, %x, %x, %d, 0) failed\n%s",
+ *error_msg = StringPrintf("anonymous mmap(%p, %zd, 0x%x, 0x%x, %d, 0) failed\n%s",
tail_base_begin, tail_base_size, tail_prot, flags, fd.get(),
maps.c_str());
return nullptr;
@@ -272,7 +273,7 @@
}
std::ostream& operator<<(std::ostream& os, const MemMap& mem_map) {
- os << StringPrintf("[MemMap: %s prot=%x %p-%p]",
+ os << StringPrintf("[MemMap: %s prot=0x%x %p-%p]",
mem_map.GetName().c_str(), mem_map.GetProtect(),
mem_map.BaseBegin(), mem_map.BaseEnd());
return os;