Add extra output when patchoat_test fails.

Print up to 16 bytes of the data from the first difference.

Test: m test-art-host-gtest-patchoat_test
Bug: 70918261
Change-Id: Icd0247c3a745bfca0bc9745c8756452cd9b89feb
diff --git a/patchoat/patchoat_test.cc b/patchoat/patchoat_test.cc
index 974ed32..69728ae 100644
--- a/patchoat/patchoat_test.cc
+++ b/patchoat/patchoat_test.cc
@@ -24,6 +24,7 @@
 #include "android-base/stringprintf.h"
 #include "android-base/strings.h"
 
+#include "base/hex_dump.h"
 #include "base/leb128.h"
 #include "dexopt_test.h"
 #include "runtime.h"
@@ -320,6 +321,12 @@
       if (image1[i] != image2[i]) {
         *error_msg =
             StringPrintf("%s and %s differ at offset %zu", filename1.c_str(), filename2.c_str(), i);
+        size_t hexdump_size = std::min<size_t>(16u, size - i);
+        HexDump dump1(&image1[i], hexdump_size, /* show_actual_addresses */ false, /* prefix */ "");
+        HexDump dump2(&image2[i], hexdump_size, /* show_actual_addresses */ false, /* prefix */ "");
+        std::ostringstream oss;
+        oss << "\n" << dump1 << "\n" << dump2;
+        *error_msg += oss.str();
         return true;
       }
     }