strace

718 views
Skip to first unread message

perumal316

unread,
Dec 14, 2009, 2:31:45 AM12/14/09
to Android Linux Kernel Development
Hi,

I want to trace the system calls (using strace) made by Android
Applications. I can do it using terminal emulator or adb shell.

I wrote a simple Hello World app in C and the Cross-Compile it and adb
push it into /data and I could use strace.

But how to use strace on the Android Applications installed in the
menu? Must I write a module or an app to do it?

Thanks in Advance,
Perumal

Alberto Panizzo

unread,
Dec 14, 2009, 1:34:45 PM12/14/09
to android...@googlegroups.com
Hi Perumal
> --
> unsubscribe: android-kerne...@googlegroups.com
> website: http://groups.google.com/group/android-kernel

Normal application runs in the dalvik VM, are you sure you want to
strace them?

The only way is to modify the init script to run zygote over strace
and follow the forks.

Android have a step-by-step debugger why you do not explore this
option?

http://developer.android.com/intl/it/guide/developing/debug-tasks.html

Android provide his source code, you can look into this to find
what is going on if you would to go deeper.

Best regards.
Alberto!





perumal316

unread,
Dec 15, 2009, 8:41:00 PM12/15/09
to Android Linux Kernel Development
Hi,

I currently working on a monitoring tool in a form of LKM, which I
want to use to monitor the system calls made and aruguments passed
during the calls.

I can access into the system call table and replace system calls
(using the LKM) but this is only for one system call.

Any idea how to capture parameters passed and monitor the system calls
made by applications?

Regards,
Perumal

On Dec 15, 2:34 am, Alberto Panizzo <maramaopercheseimo...@gmail.com>
wrote:

Alberto Panizzo

unread,
Dec 16, 2009, 4:47:25 AM12/16/09
to perumal316, Android Kernel Development
Il giorno mar, 15/12/2009 alle 17.39 -0800, perumal316 ha scritto:
> Hi,
>
> I currently working on a monitoring tool in a form of LKM, which I
> want to use to monitor the system calls made and aruguments passed
> during the calls.
>
> I can access into the system call table and replace system calls
> (using the LKM) but this is only for one system call.
>
> Any idea how to capture parameters passed and monitor the system calls
> made by applications?
>
> Regards,
> Perumal

Do not top respond please, and follow the mailing list way :)

I am not so experienced in system call, maybe some guru here can
make better suggestion.

What I know is the presence of the LTT (Linux Tracing Tool) project
that maybe do what you want.

You may wait for an answer here, you can reproduce this question
in the linux kernel mailing list and at the LTT project maintainers.

Good luck
Alberto!


Mahdieh Kazemipour

unread,
Apr 29, 2014, 2:13:03 PM4/29/14
to android...@googlegroups.com
Hi
I want to monitor android app and sys callas with "Starce"
but I can not!
at adb shell "Strace " with "-e trace=open,read " or with "-o <Filename>" options get no info
and I must use "Ctrl+c" and exit from adb with no output
why??

Rohit Kumar

unread,
May 12, 2014, 3:33:03 AM5/12/14
to android...@googlegroups.com
Hi Perumal,
First thing this is not forum for this question.
You have to build your own application for this purpose. For starting up you can use runtime.exec, you need some permission for your application. I am not sure but you can discuss more on this on application forum.
Thanks,

Peeyush Varshney

unread,
May 13, 2014, 10:05:15 AM5/13/14
to android...@googlegroups.com
hello,
run starce command on cmd like below

strace pid >log.txt


--
---
You received this message because you are subscribed to the Google Groups "Android Linux Kernel Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-kerne...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Thank & Regards
Peeyush Varshney

Peter Teoh

unread,
May 13, 2014, 12:04:10 PM5/13/14
to android...@googlegroups.com
strace uses the ptrace API, and it is only useful if you want to trace all system calls.  that also usually means C program compiled with Android NDK.   

Java program runs in its own VM call DalvikVM, and you use logcat to see the tracing of all java API executed in this way.  If you use strace, it is meaningless as you are actually tracing both the DalvikVM and is intepretation of the Java bytecodes.





--
Regards,
Peter Teoh
Reply all
Reply to author
Forward
0 new messages