Refactor MethodDebugInfo (input of DWARF writer).

Do not pass CompiledMethod pointer through since it is only available
during AOT compile but not during JIT compile or at runtime. Creating
mock CompiledMethod just pass data is proving increasingly tricky, so
copy the fields that we need to MethodDebugInfo instead.

Change-Id: I820297b41e769fcac488c0ff2d2ea0492bb13ed8
diff --git a/compiler/debug/elf_debug_writer.cc b/compiler/debug/elf_debug_writer.cc
index 79069d1..4f2a007 100644
--- a/compiler/debug/elf_debug_writer.cc
+++ b/compiler/debug/elf_debug_writer.cc
@@ -62,8 +62,11 @@
     }
     ElfCompilationUnit& cu = compilation_units.back();
     cu.methods.push_back(&mi);
-    cu.low_pc = std::min(cu.low_pc, mi.low_pc);
-    cu.high_pc = std::max(cu.high_pc, mi.high_pc);
+    // All methods must have the same addressing mode otherwise the min/max below does not work.
+    DCHECK_EQ(cu.methods.front()->is_code_address_text_relative, mi.is_code_address_text_relative);
+    cu.is_code_address_text_relative = mi.is_code_address_text_relative;
+    cu.code_address = std::min(cu.code_address, mi.code_address);
+    cu.code_end = std::max(cu.code_end, mi.code_address + mi.code_size);
     last_source_file = source_file;
   }