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/gc/space/image_space.cc b/runtime/gc/space/image_space.cc
index 8426fab..ca5b5a9 100644
--- a/runtime/gc/space/image_space.cc
+++ b/runtime/gc/space/image_space.cc
@@ -115,6 +115,8 @@
     space::ImageSpace* image_space = ImageSpace::Init(image_file_name.c_str(), true, &error_msg);
     if (image_space != nullptr) {
       return image_space;
+    } else {
+      LOG(WARNING) << error_msg;
     }
   }
   CHECK(GenerateImage(image_file_name, &error_msg))
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;