Stub to capture method entry/exit.

Added stubs to allow traceview to do method tracing. Currently only
outputs to logcat, and a later change will generate the proper log file.

Change-Id: Icaafc50e2eaf042ddc4d882011f7e8121bdd8b1c
diff --git a/src/object.cc b/src/object.cc
index 14e8c5c..614df3c 100644
--- a/src/object.cc
+++ b/src/object.cc
@@ -447,7 +447,8 @@
     return DexFile::kDexNoIndex;   // Special no mapping case
   }
   size_t mapping_table_length = GetMappingTableLength();
-  uint32_t sought_offset = pc - reinterpret_cast<uintptr_t>(GetCode());
+  const void* code_offset = Trace::IsMethodTracingActive() ? Trace::GetSavedCodeFromMap(this) : GetCode();
+  uint32_t sought_offset = pc - reinterpret_cast<uintptr_t>(code_offset);
   uint32_t best_offset = 0;
   uint32_t best_dex_offset = 0;
   for (size_t i = 0; i < mapping_table_length; i += 2) {
@@ -477,7 +478,11 @@
     uint32_t map_offset = mapping_table[i];
     uint32_t map_dex_offset = mapping_table[i + 1];
     if (map_dex_offset == dex_pc) {
-      return reinterpret_cast<uintptr_t>(GetCode()) + map_offset;
+      if (Trace::IsMethodTracingActive()) {
+        return reinterpret_cast<uintptr_t>(Trace::GetSavedCodeFromMap(this)) + map_offset;
+      } else {
+        return reinterpret_cast<uintptr_t>(GetCode()) + map_offset;
+      }
     }
   }
   LOG(FATAL) << "Looking up Dex PC not contained in method";