oatdump

FROM MAKE:
mm dump-boot-oat

ON HOST:
oatdump --dex-file=$ANDROID_PRODUCT_OUT/system/framework/core.jar --image=$ANDROID_PRODUCT_OUT/system/framework/boot.oat --strip-prefix=$ANDROID_PRODUCT_OUT
oatdump --boot-dex-file=$ANDROID_PRODUCT_OUT/system/framework/core.jar --boot=$ANDROID_PRODUCT_OUT/system/framework/boot.oat --dex-file=$ANDROID_PRODUCT_OUT/system/framework/art-test-dex-HelloWorld.jar --image=$ANDROID_PRODUCT_OUT//system/framework/art-test-dex-HelloWorld.oat --strip-prefix=$ANDROID_PRODUCT_OUT

ON TARGET:
adb shell oatdump --dex-file=/system/framework/core.jar --image=/system/framework/boot.oat
adb shell oatdumpd --boot-dex-file=/system/framework/core.jar --boot=/system/framework/boot.oat --dex-file=/system/framework/art-test-dex-HelloWorld.jar --image=/system/framework/art-test-dex-HelloWorld.oat

Change-Id: Iad2ae40a9cf2dc28799ff5dc5222d50f1bc6b39f
diff --git a/src/dex_file.cc b/src/dex_file.cc
index 71fd5a7..46fb2dc 100644
--- a/src/dex_file.cc
+++ b/src/dex_file.cc
@@ -42,6 +42,20 @@
                         reinterpret_cast<const DexFile::ClassDef*>(NULL));
 }
 
+void DexFile::OpenDexFiles(std::vector<const char*>& dex_filenames,
+                           std::vector<const DexFile*>& dex_files,
+                           const std::string& strip_location_prefix) {
+  for (size_t i = 0; i < dex_filenames.size(); i++) {
+    const char* dex_filename = dex_filenames[i];
+    const DexFile* dex_file = Open(dex_filename, strip_location_prefix);
+    if (dex_file == NULL) {
+      fprintf(stderr, "could not open .dex from file %s\n", dex_filename);
+      exit(EXIT_FAILURE);
+    }
+    dex_files.push_back(dex_file);
+  }
+}
+
 const DexFile* DexFile::Open(const std::string& filename,
                              const std::string& strip_location_prefix) {
   if (filename.size() < 4) {