Hi,
I was fuzzing dex2oat awhile back and so was running on host. I managed to get it running with the tree as of mid-May, but when I upgraded August 4th to master, my patch to the build system failed and I did not easily get things going again and so I stopped the fuzzing work. So, the below is going off of that slightly outdated bit of information:
After ‘make build-art-host’,
$ export ANDROID_DATA=/path/to/Android-Sources/android-5.1.1_r4/out/host/datadir/dalvik-cache/x86_64$ export ANDROID_ROOT=out/host/linux-x86$ mkdir -p $ANDROID_DATA$ out/host/linux-x86/bin/dex2oat --runtime-arg -classpath --runtime-arg $1--instruction-set=x86 \--runtime-arg -Xrelocate --host --boot-image=/path/to/Android-Sources/android-5.1.1_r4/out/host/linux-x86/framework/core.art \--dex-file=$1--oat-file=$ANDROID_DATA/out1.oat
I hope this helps you out!
Cheers,Andrew
From: Ryan Riley <rril...@gmail.com>
Reply-To: "android-...@googlegroups.com" <android-...@googlegroups.com>
Date: Monday, October 26, 2015 at 1:57 AM
To: android-platform <android-...@googlegroups.com>
Subject: Running dex2oat on the host
Hello,
I'm working on a research project that involves analyzing the native code output from dex2oat.
Right now our procedure for getting the compiled native code for an apk is as follows:1. Install APK on a nexus 5 with Android 5.1.1, this causes the phone to run dex2oat and produce the native code2. Grab the .dex file produced and load it onto a computer3. Use oatdump on the .dex file to disassemble the code and get the assembly instructions.
This worked fine for 300-400 apps, but now we want to do this at scale (10,000 apps) and obviously step 1 is a huge bottleneck. I'd like to run dex2oat on the host in order to produce the native code. I can successfully build it without problem, but I can't figure out what arguments to pass it to get it to successfully compile an apk. (I also can't run any of the tests in art/test)
Does anyone have any tips or thoughts?
ThanksRyan
--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-platfo...@googlegroups.com.
To post to this group, send email to android-...@googlegroups.com.
Visit this group at http://groups.google.com/group/android-platform.
For more options, visit https://groups.google.com/d/optout.
$
export ANDROID_DATA=/path/to/Android-Sources/android-5.1.1_r4/out/host/datadir/dalvik-cache/x86_64$
export ANDROID_ROOT=out/host/linux-x86$
mkdir -p $ANDROID_DATA$
out/host/linux-x86/bin/dex2oat --runtime-arg -classpath --runtime-arg $1 --instruction-set=x86
\ --runtime-arg
-Xrelocate --host --boot-image=/path/to/Android-Sources/android-5.1.1_r4/out/host/linux-x86/framework/core.art
\ --dex-file=$1 --oat-file=$ANDROID_DATA/out1.oat$ mkdir -p com/foo
$ vi com/foo/Foo.java
$ cat ~/com/foo/Foo.java
package com.foo;
public class Foo {
public static void main(String[] args) {
System.out.println("What's up\n");
}
}
$ cd com/foo && javac Foo.java
$ jar cf foo.jar com
$ android-sdk-linux/build-tools/android-4.4W/dx --dex --output=mine.dex foo.jar
$ linux-x86/bin/art --32 -classpath ~/mine.dex com.foo.Foo
art I 18572 18572 art/runtime/gc/space/image_space.cc:270] RelocateImage: /home/areiter/Android-Sources/l-p2/out/host/linux-x86/bin/../bin/patchoat --input-image-location=/home/areiter/Android-Sources/l-p2/out/host/linux-x86/bin/../framework/core.art --output-image-file=/home/areiter/Android-Sources/l-p2/out/host/android-data18564/dalvik-cache/x86/home@areiter@Android-Sources@l-p2@out@host@linux-x86@bin@..@fram...@core.art --input-oat-location=/home/areiter/Android-Sources/l-p2/out/host/linux-x86/bin/../framework/core.oat --output-oat-file=/home/areiter/Android-Sources/l-p2/out/host/android-data18564/dalvik-cache/x86/home@areiter@Android-Sources@l-p2@out@host@linux-x86@bin@..@fram...@core.oat --instruction-set=x86 --base-offset-delta=1875968
dex2oat I 18574 18574 art/dex2oat/dex2oat.cc:1262] /home/areiter/Android-Sources/l-p2/out/host/linux-x86/bin/../bin/dex2oat --runtime-arg -classpath --runtime-arg /home/areiter/mine.dex --instruction-set=x86 --instruction-set-features=none --runtime-arg -Xrelocate --host --boot-image=/home/areiter/Android-Sources/l-p2/out/host/linux-x86/bin/../framework/core.art --dex-file=/home/areiter/mine.dex --oat-fd=3 --oat-location=/home/areiter/Android-Sources/l-p2/out/host/android-data18564/dalvik-cache/x86/home@areiter@mine.dex
dex2oat I 18574 18574 art/dex2oat/dex2oat.cc:292] dex2oat took 242.693ms (threads: 8)
What's up
$