Search code examples
androidandroid-emulatortraceqemu

Tracing by Android Emulator


I have two questions:

*** First question:

In this page of Android developers website: https://developer.android.com/studio/run/emulator-commandline.html

It is said that there's a -trace option for the emulator. However, when I run the following command:

me@my_computer:~$ $SDK_ROOT/tools/emulator -avd Nexus_4_API_19_ARM -trace $OUTPUT_FILE

I get this error:

unknown option: -trace
please use -help for a list of valid options

Also, when I run this command:

me@my_computer:~$ $SDK_ROOT/tools/emulator -help | grep trace

the result is empty.

Is this really an inconsistency between the website manual and the command line help of the emulator?

*** Second question:

Looking for a way of tracing, I found that the -qemu option has something like this:

me@my_computer:~$ $SDK_ROOT/tools/emulator -qemu -h | grep trace
-trace [events=<file>][,file=<file>]

But when I add the -qemu option:

me@my_computer:~$ $SDK_ROOT/tools/emulator -avd Nexus_4_API_19_ARM -qemu -trace file=$OUTPUT_FILE

what I get is:

$SDK_ROOT/tools/emulator64-arm: invalid option -- '-trace'

At the QEMU documention web page (http://wiki.qemu.org/download/qemu-doc.html#index-_002dtrace), it is said that:

-trace [events=file][,file=file]

...

file=file

Log output traces to file. This option is only available if QEMU has been compiled with the simple tracing backend.

Is this the reason that -qemu -trace doesn't work in Android emulator?

I'd appreciate it if someone helps me on this issue.

Any other suggestions for collecting traces (especially instruction traces) of a real or virtual Android device are appreciated as well.

Thanks


Solution

  • Sadly, the manual page is outdated. As of now, emulator doesn't support own tracing features and it build the QEMU engine with no tracing support as well. I'll file a bug to update the manual.