20

我选择了几个跟踪标记,当我运行跟踪时(来自DDMS),我得到以下输出:

Unexpected error while collecting system trace. Unable to find trace start marker 'TRACE:':
error opening /sys/kernel/debug/tracing/options/overwrite: 
No such file or directory (2)

error openi(在这里切断错误)

内核目录中确实没有调试文件,但是哪种机制会生成必要的路径?

4

2 回答 2

6

It looks like your cellphone is running a boot(kernel) image that does not support systrace.

"error opening /sys/kernel/debug/tracing/options/overwrite: No such file or directory (2)"

This error message means adb daemon (the adb module running on device side) could not find /sys/kernel/debug/tracing/options/overwrite on your device's file system. systrace works over adb and communicates with kernel though sysfs nodes under /sys/kernel/debug/tracing. If these nodes are not exposed on you phone for whatever reason, systrace just will not work.

So you should first get a shell on your device using:

adb shell

Then browse to confirm if /sys exists at all and if /sys/kernel/debug/tracing exists.

If they are there which is extremely unlikely, you have to debug systrace.py to figure out how come systrace think the nodes were not there. Otherwise, you need to flash a different boot image which has systrace support, because sysfs is controlled by kernel(mostly by configurations at compile time) and init.rc , both of which are part of boot image.

Flashing a different boot image might involve unlocking/rooting the device. You probably have to go to fan sites like xdadeveloper for information and image. Another option is to download the source of kernel for your device, compile kernel and make the boot image yourself. Linux is under GPL thus manufacturer of your device is obligated to release the source code of the specialized kernel they use.

-NAM http://www.willpromo.com

于 2015-01-22T16:50:32.227 回答
1

您可能需要稍微修改内核映像(boot.img)。以下作品为我找到,仅供大家参考。

  1. 打开终端并输入:$adb shell
  2. (1) $su(2) $mount -t debugfs none /sys/kernel/debug。现在您应该能够看到 /sys/kernel/debug/ 下的许多目录。(您可以 cd 进入 /sys/kernel/debug 来确认这一点)
  3. 输入:$dd if=/dev/block/platform/msm_sdcc.1/by-name/boot of=/sdcard/boot.img从您的设备生成 boot.img 内核映像。
  4. 使用 AndroidImageKitchen 解压 boot.img 并在 Ramdisk 文件夹中找到 default.prop。然后更改ro.debuggable=0ro.debuggable=1. 重新打包 boot.img 并将其闪存引导到您的设备。
  5. 设备启动后,在终端下输入:并可能会弹出$adb root消息:$restarting adbd as root断开 USB 并重新连接。
  6. cd 到 systrace 文件夹,例如 ~/androidSDK/platform-tools/systrace 并使用: python systrace.py --time=10 -o mynewtrace.html sched gfx view wm
  7. 现在您可以生成自己的 systrace 文件。
于 2016-08-24T07:44:08.780 回答