Pass the debug_info_offset explicitly.

In order to use debug_info_offset for encoding implementation details,
rewrite all indirect users of it to fetch it before calling DexFile
methods.

This allows keeping the DexFile interface clean of runtime
considerations.

Test: test.py
Change-Id: I4591e0039b5f822f4409aae411071ecbe97082b1
diff --git a/openjdkjvmti/ti_method.cc b/openjdkjvmti/ti_method.cc
index cf93bf0..448ce41 100644
--- a/openjdkjvmti/ti_method.cc
+++ b/openjdkjvmti/ti_method.cc
@@ -48,6 +48,7 @@
 #include "mirror/object_array-inl.h"
 #include "modifiers.h"
 #include "nativehelper/scoped_local_ref.h"
+#include "oat_file.h"
 #include "runtime_callbacks.h"
 #include "scoped_thread_state_change-inl.h"
 #include "stack.h"
@@ -259,7 +260,9 @@
   };
 
   LocalVariableContext context(env);
+  uint32_t debug_info_offset = art::OatFile::GetDebugInfoOffset(*dex_file, code_item);
   if (!dex_file->DecodeDebugLocalInfo(code_item,
+                                      debug_info_offset,
                                       art_method->IsStatic(),
                                       art_method->GetDexMethodIndex(),
                                       LocalVariableContext::Callback,
@@ -480,7 +483,9 @@
   }
 
   LineNumberContext context;
-  bool success = dex_file->DecodeDebugPositionInfo(code_item, CollectLineNumbers, &context);
+  uint32_t debug_info_offset = art::OatFile::GetDebugInfoOffset(*dex_file, code_item);
+  bool success = dex_file->DecodeDebugPositionInfo(
+      code_item, debug_info_offset, CollectLineNumbers, &context);
   if (!success) {
     return ERR(ABSENT_INFORMATION);
   }
@@ -648,7 +653,9 @@
     };
 
     GetLocalVariableInfoContext context(slot_, dex_pc, descriptor, type);
+    uint32_t debug_info_offset = art::OatFile::GetDebugInfoOffset(*dex_file, code_item);
     if (!dex_file->DecodeDebugLocalInfo(code_item,
+                                        debug_info_offset,
                                         method->IsStatic(),
                                         method->GetDexMethodIndex(),
                                         GetLocalVariableInfoContext::Callback,