Strace Android

1. strace  (from wikipedia)

You can use strace on Android. It is included in the Android open source project (at least as of Android 2.1), and appears to be automatically installed in engineering builds of the software.

To use strace during early initialization, you can put it in the /init.rc file. For example, to trace zygote initialization, change the following line in /init.rc.

service zygote /system/bin/app_process -Xzygote /system/bin --zygote --start-system-server

should be changed to:

service zygote /system/xbin/strace -tt -o/data/boot.strace /system/bin/app_process -Xzygote /system/bin --zygote --start system-server

2. Profiledroid:

Use strace on system call level, classified calls to four categories.

3. System call Problem:

syscall_983042(0x47a8e074, 0x47a8e078, 0, 0xfff, 0x408 …)  do not know what’s that ..!topic/android-kernel/34bI16acwLQ

4. Strace result example (runtime) and analyze:

simple parameter instruction:

5. SystemTap :

another one for system call tracing.

6. Basic Steps:

1.) connect devices, make sure adb works and then enter the shell mode

2.) ps:  get process id and find the process you want to trace

3.) run strace, eg: strace -ff -F -t -p PID -o /data/name     (the -t time unit is second)

4.) Then adb pull /data/name ,  get the results out

7. If you want to run strace on real device, please make sure to get su authority

e.g.  $ su

$ strace -ff -F -tt -T -p 822 &>/sdcard/twitter.log

This entry was posted in Android. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s