Fix dump-oat-Calculator
also add --host-prefix defaulting to oatdump matching oatexec
Change-Id: I0e82f78510be18dcb09dbb1ec14931fe46173a68
diff --git a/Android.mk b/Android.mk
index 2dd2d8f..0d24024 100644
--- a/Android.mk
+++ b/Android.mk
@@ -154,17 +154,17 @@
.PHONY: dump-oat-core
dump-oat-core: $(TARGET_CORE_OAT_OUT) $(OATDUMP)
- $(OATDUMP) --image=$(TARGET_CORE_IMG_OUT) --host-prefix=$(PRODUCT_OUT) --output=/tmp/core.oatdump.txt
+ $(OATDUMP) --image=$(TARGET_CORE_IMG_OUT) --output=/tmp/core.oatdump.txt
@echo Output in /tmp/core.oatdump.txt
.PHONY: dump-oat-boot
dump-oat-boot: $(TARGET_BOOT_OAT_OUT) $(OATDUMP)
- $(OATDUMP) --image=$(TARGET_BOOT_IMG_OUT) --host-prefix=$(PRODUCT_OUT) --output=/tmp/boot.oatdump.txt
+ $(OATDUMP) --image=$(TARGET_BOOT_IMG_OUT) --output=/tmp/boot.oatdump.txt
@echo Output in /tmp/boot.oatdump.txt
.PHONY: dump-oat-Calculator
-dump-oat-Calculator: $(call art-cache-oat,system/app/Calculator.apk) $(TARGET_BOOT_OAT_OUT) $(OATDUMP)
- $(OATDUMP) --oat-file=$< --boot-image=$(TARGET_BOOT_IMG) --host-prefix=$(PRODUCT_OUT) --output=/tmp/Calculator.oatdump.txt
+dump-oat-Calculator: $(call art-cache-out,system/app/Calculator.apk.oat) $(TARGET_BOOT_IMG_OUT) $(OATDUMP)
+ $(OATDUMP) --oat-file=$< --output=/tmp/Calculator.oatdump.txt
@echo Output in /tmp/Calculator.oatdump.txt
diff --git a/src/oatdump.cc b/src/oatdump.cc
index 44632c0..0dde41f 100644
--- a/src/oatdump.cc
+++ b/src/oatdump.cc
@@ -57,6 +57,7 @@
" --host-prefix may be used to translate host paths to target paths during\n"
" cross compilation.\n"
" Example: --host-prefix=out/target/product/crespo\n"
+ " Default: $ANDROID_PRODUCT_OUT\n"
"\n");
fprintf(stderr,
" --output=<file> may be used to send the output to a file.\n"
@@ -743,6 +744,12 @@
options.push_back(std::make_pair(image_option.c_str(), reinterpret_cast<void*>(NULL)));
}
+ if (host_prefix.empty()) {
+ const char* android_product_out = getenv("ANDROID_PRODUCT_OUT");
+ if (android_product_out != NULL) {
+ host_prefix = android_product_out;
+ }
+ }
if (!host_prefix.empty()) {
options.push_back(std::make_pair("host-prefix", host_prefix.c_str()));
}