Improve ImageWriter logging.

In the case of a locked object log the type of object and the thread
that locked it.

Test: test.py --host

Change-Id: Ibaf79cead765df6c212213017248d0f70d9cfbd7
diff --git a/compiler/image_writer.cc b/compiler/image_writer.cc
index e75f75b..76ffc53 100644
--- a/compiler/image_writer.cc
+++ b/compiler/image_writer.cc
@@ -398,12 +398,18 @@
   // Before we stomp over the lock word, save the hash code for later.
   LockWord lw(object->GetLockWord(false));
   switch (lw.GetState()) {
-    case LockWord::kFatLocked: {
-      LOG(FATAL) << "Fat locked object " << object << " found during object copy";
-      break;
-    }
+    case LockWord::kFatLocked:
+      FALLTHROUGH_INTENDED;
     case LockWord::kThinLocked: {
-      LOG(FATAL) << "Thin locked object " << object << " found during object copy";
+      std::ostringstream oss;
+      bool thin = (lw.GetState() == LockWord::kThinLocked);
+      oss << (thin ? "Thin" : "Fat")
+          << " locked object " << object << "(" << object->PrettyTypeOf()
+          << ") found during object copy";
+      if (thin) {
+        oss << ". Lock owner:" << lw.ThinLockOwner();
+      }
+      LOG(FATAL) << oss.str();
       break;
     }
     case LockWord::kUnlocked: