通过 Android 仿真器进行跟踪

Tracing by Android Emulator

我有两个问题:

*** 第一题:

在 Android 开发者网站的这个页面中: https://developer.android.com/studio/run/emulator-commandline.html

据说模拟器有一个-trace选项。但是,当我 运行 以下命令时:

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

我收到这个错误:

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

此外,当我 运行 这个命令时:

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

结果为空。

这真的是网站手册和模拟器命令行帮助不一致吗?

*** 第二个问题:

寻找追踪的方式,发现-qemu选项有这样的东西:

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

但是当我添加 -qemu 选项时:

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

我得到的是:

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

在 QEMU 文档网页(http://wiki.qemu.org/download/qemu-doc.html#index-_002dtrace),据说:

-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.

这就是 -qemu -trace 在 Android 模拟器中不起作用的原因吗?

如果有人能帮助我解决这个问题,我将不胜感激。

对于收集真实或虚拟 Android 设备的痕迹(尤其是指令痕迹)的任何其他建议也表示赞赏。

谢谢

遗憾的是,手册页已过时。截至目前,模拟器不支持自己的跟踪功能,它构建的 QEMU 引擎也不支持跟踪。我会提交一个错误来更新手册。