Print better debug messages in extent map

Test: th
Bug: 177104308
Change-Id: I4ed31ff1b54f5f57008efa1c6b652f4d5dbaa6ce
diff --git a/payload_consumer/extent_map.h b/payload_consumer/extent_map.h
index 65f1bcd..953eed0 100644
--- a/payload_consumer/extent_map.h
+++ b/payload_consumer/extent_map.h
@@ -54,9 +54,14 @@
   std::optional<T> Get(const Extent& extent) const {
     const auto it = map_.find(extent);
     if (it == map_.end()) {
-      LOG_IF(WARNING, set_.OverlapsWithExtent(extent))
-          << "Looking up a partially intersecting extent isn't supported by "
-             "this data structure.";
+      for (const auto& ext : set_.GetCandidateRange(extent)) {
+        if (ExtentRanges::ExtentsOverlap(ext, extent)) {
+          LOG(WARNING) << "Looking up a partially intersecting extent isn't "
+                          "supported by "
+                          "this data structure. Querying extent: "
+                       << extent << ", partial match in map: " << ext;
+        }
+      }
       return {};
     }
     return {it->second};
diff --git a/payload_consumer/xor_extent_writer.cc b/payload_consumer/xor_extent_writer.cc
index 5c89c93..b0a8c08 100644
--- a/payload_consumer/xor_extent_writer.cc
+++ b/payload_consumer/xor_extent_writer.cc
@@ -32,10 +32,15 @@
   for (const auto& xor_ext : xor_extents) {
     const auto merge_op_opt = xor_map_.Get(xor_ext);
     if (!merge_op_opt.has_value()) {
+      // If a file in the target build contains duplicate blocks, e.g.
+      // [120503-120514], [120503-120503], we can end up here. If that's the
+      // case then there's no bug, just some annoying edge cases.
       LOG(ERROR)
           << xor_ext
           << " isn't in XOR map but it's returned by GetIntersectingExtents(), "
-             "this is a bug inside GetIntersectingExtents";
+             "this is either a bug inside GetIntersectingExtents, or some "
+             "duplicate blocks are present in target build. OTA extent: "
+          << extent;
       return false;
     }