Consider thumb bit when repacking and compressing JIT mini-debug-info.

ARM uses least significant bit of function address to encode thumb mode.
This means the function address might not point to first byte of code.

Normalize the addresses by rounding them down to instruction size.
This fixes memory leak (debug info would not be freed) on 32-bit ARM.

Bug: 151137723
Test: ./art/test.py -r --target -t 137 --jit --32
Change-Id: I6851c2ac874badec8b385eb0b3f21e8119178e22
diff --git a/compiler/debug/elf_debug_writer.cc b/compiler/debug/elf_debug_writer.cc
index 79d1198..765a81d 100644
--- a/compiler/debug/elf_debug_writer.cc
+++ b/compiler/debug/elf_debug_writer.cc
@@ -237,8 +237,12 @@
   using Elf_Sym = typename ElfTypes::Sym;
   const InstructionSet isa = kRuntimeISA;
   CHECK_EQ(sizeof(Elf_Addr), static_cast<size_t>(GetInstructionSetPointerSize(isa)));
+  const uint32_t kPcAlign = GetInstructionSetInstructionAlignment(isa);
+  auto is_pc_aligned = [](const void* pc) { return IsAligned<kPcAlign>(pc); };
+  DCHECK(std::all_of(removed_symbols.begin(), removed_symbols.end(), is_pc_aligned));
   auto is_removed_symbol = [&removed_symbols](Elf_Addr addr) {
-    const void* code_ptr = reinterpret_cast<const void*>(addr);
+    // Remove thumb-bit, if any (using the fact that address is instruction aligned).
+    const void* code_ptr = AlignDown(reinterpret_cast<const void*>(addr), kPcAlign);
     return std::binary_search(removed_symbols.begin(), removed_symbols.end(), code_ptr);
   };
   uint64_t min_address = std::numeric_limits<uint64_t>::max();