Add option for duplicate classes check to return all dupes.

When verbose oat is enabled, duplicate classes check will not stop at
the first duplicate found, outputting all duplicates found.
Can be enabled via: adb shell setprop dalvik.vm.extra-opts -verbose:oat

Test: mm test-art-host
Change-Id: If1cd55e2ad18fa4bb12d9237e18735ee0f89840b
diff --git a/runtime/oat_file_manager.cc b/runtime/oat_file_manager.cc
index d04dbbe..a950980 100644
--- a/runtime/oat_file_manager.cc
+++ b/runtime/oat_file_manager.cc
@@ -482,6 +482,8 @@
   }
 
   // Now drain the queue.
+  bool has_duplicates = false;
+  error_msg->clear();
   while (!queue.empty()) {
     // Modifying the top element is only safe if we pop right after.
     DexFileAndClassPair compare_pop(queue.top());
@@ -493,12 +495,15 @@
       if (strcmp(compare_pop.GetCachedDescriptor(), top.GetCachedDescriptor()) == 0) {
         // Same descriptor. Check whether it's crossing old-oat-files to new-oat-files.
         if (compare_pop.FromLoadedOat() != top.FromLoadedOat()) {
-          *error_msg =
-              StringPrintf("Found duplicated class when checking oat files: '%s' in %s and %s",
+          error_msg->append(
+              StringPrintf("Found duplicated class when checking oat files: '%s' in %s and %s\n",
                            compare_pop.GetCachedDescriptor(),
                            compare_pop.GetDexFile()->GetLocation().c_str(),
-                           top.GetDexFile()->GetLocation().c_str());
-          return true;
+                           top.GetDexFile()->GetLocation().c_str()));
+          if (!VLOG_IS_ON(oat)) {
+            return true;
+          }
+          has_duplicates = true;
         }
         queue.pop();
         AddNext(top, queue);
@@ -510,7 +515,7 @@
     AddNext(compare_pop, queue);
   }
 
-  return false;
+  return has_duplicates;
 }
 
 // Check for class-def collisions in dex files.