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: http://www.sigmobile.org/mobicom/2012/slides/Gomez.pdf

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

https://groups.google.com/forum/?fromgroups=#!topic/android-kernel/34bI16acwLQ

4. Strace result example (runtime) and analyze: http://benno.id.au/blog/2007/11/18/android-runtime-strace

simple parameter instruction: http://blog.chinaunix.net/uid-12453618-id-2935263.html

5. SystemTap : https://01.org/android-ia/blogs/dragos/2012/systemtap-android

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

Advertisements
This entry was posted in Android. Bookmark the permalink.

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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